1 //=========================================================
2 //  MusE
3 //  Linux Music Editor
4 //
5 //  plugin_list.h
6 //  (C) Copyright 2018 Tim E. Real (terminator356 on users dot sourceforge dot net)
7 //
8 //  This program is free software; you can redistribute it and/or
9 //  modify it under the terms of the GNU General Public License
10 //  as published by the Free Software Foundation; version 2 of
11 //  the License, or (at your option) any later version.
12 //
13 //  This program is distributed in the hope that it will be useful,
14 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 //  GNU General Public License for more details.
17 //
18 //  You should have received a copy of the GNU General Public License
19 //  along with this program; if not, write to the Free Software
20 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 //
22 //=========================================================
23 
24 #ifndef __PLUGIN_LIST_H__
25 #define __PLUGIN_LIST_H__
26 
27 #include "plugin_scan.h"
28 #include <list>
29 #include <memory>
30 
31 namespace MusEPlugin {
32 
33 //-------------------------------------------------
34 // PluginScanListRef
35 // A reference counted pointer to PluginScanInfo
36 //-------------------------------------------------
37 
38 typedef std::shared_ptr<PluginScanInfo> PluginScanInfoRef;
39 
40 //-----------------------------------------
41 // PluginScanList
42 //-----------------------------------------
43 
44 class PluginScanList : public std::list<PluginScanInfoRef>
45 {
46   public:
PluginScanList()47     PluginScanList() {}
48 
49     bool add(PluginScanInfo* info);
50     // Each argument optional, can be empty.
51     // If uri is not empty, the search is based solely on it, the other arguments are ignored.
52     PluginScanInfoRef find(const PluginInfoString_t& file,
53                            const PluginInfoString_t& uri,
54                            const PluginInfoString_t& label,
55                            PluginScanInfoStruct::PluginType_t types = PluginScanInfoStruct::PluginTypeAll) const;
56     // If uri is not empty, the search is based solely on it, the other info members are ignored.
57     PluginScanInfoRef find(const PluginScanInfoStruct& info) const;
58 };
59 typedef PluginScanList::iterator iPluginScanList;
60 typedef PluginScanList::const_iterator ciPluginScanList;
61 
62 
63 } // namespace MusEPlugin
64 
65 #endif
66 
67 
68