Chris@4
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@5
|
2 /*
|
Chris@5
|
3 Copyright (c) 2016 Queen Mary, University of London
|
Chris@5
|
4
|
Chris@5
|
5 Permission is hereby granted, free of charge, to any person
|
Chris@5
|
6 obtaining a copy of this software and associated documentation
|
Chris@5
|
7 files (the "Software"), to deal in the Software without
|
Chris@5
|
8 restriction, including without limitation the rights to use, copy,
|
Chris@5
|
9 modify, merge, publish, distribute, sublicense, and/or sell copies
|
Chris@5
|
10 of the Software, and to permit persons to whom the Software is
|
Chris@5
|
11 furnished to do so, subject to the following conditions:
|
Chris@5
|
12
|
Chris@5
|
13 The above copyright notice and this permission notice shall be
|
Chris@5
|
14 included in all copies or substantial portions of the Software.
|
Chris@5
|
15
|
Chris@5
|
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
Chris@5
|
17 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
Chris@5
|
18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
Chris@5
|
19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
Chris@5
|
20 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
Chris@5
|
21 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
Chris@5
|
22 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
Chris@5
|
23
|
Chris@5
|
24 Except as contained in this notice, the names of the Centre for
|
Chris@5
|
25 Digital Music and Queen Mary, University of London shall not be
|
Chris@5
|
26 used in advertising or otherwise to promote the sale, use or other
|
Chris@5
|
27 dealings in this Software without prior written authorization.
|
Chris@5
|
28 */
|
Chris@4
|
29
|
Chris@4
|
30 #ifndef KNOWN_PLUGINS_H
|
Chris@4
|
31 #define KNOWN_PLUGINS_H
|
Chris@4
|
32
|
Chris@4
|
33 #include "plugincandidates.h"
|
Chris@4
|
34
|
Chris@4
|
35 #include <string>
|
Chris@4
|
36 #include <map>
|
Chris@4
|
37 #include <vector>
|
Chris@4
|
38
|
Chris@4
|
39 class KnownPlugins
|
Chris@4
|
40 {
|
Chris@4
|
41 typedef std::vector<std::string> stringlist;
|
Chris@4
|
42
|
Chris@4
|
43 public:
|
Chris@4
|
44 enum PluginType {
|
Chris@4
|
45 VampPlugin,
|
Chris@4
|
46 LADSPAPlugin,
|
Chris@4
|
47 DSSIPlugin
|
Chris@4
|
48 };
|
Chris@4
|
49
|
Chris@6
|
50 KnownPlugins(std::string helperExecutableName,
|
Chris@6
|
51 PluginCandidates::LogCallback *cb = 0);
|
Chris@4
|
52
|
Chris@4
|
53 std::vector<PluginType> getKnownPluginTypes() const {
|
Chris@4
|
54 return { VampPlugin, LADSPAPlugin, DSSIPlugin };
|
Chris@4
|
55 };
|
Chris@4
|
56
|
Chris@4
|
57 std::string getTagFor(PluginType type) const {
|
Chris@4
|
58 return m_known.at(type).tag;
|
Chris@4
|
59 }
|
Chris@4
|
60
|
Chris@4
|
61 stringlist getCandidateLibrariesFor(PluginType type) const {
|
Chris@4
|
62 return m_candidates.getCandidateLibrariesFor(getTagFor(type));
|
Chris@4
|
63 }
|
Chris@4
|
64
|
Chris@4
|
65 std::string getFailureReport() const;
|
Chris@4
|
66
|
Chris@4
|
67 private:
|
Chris@4
|
68 struct TypeRec {
|
Chris@4
|
69 std::string tag;
|
Chris@4
|
70 stringlist path;
|
Chris@4
|
71 std::string descriptor;
|
Chris@4
|
72 };
|
Chris@4
|
73 std::map<PluginType, TypeRec> m_known;
|
Chris@4
|
74
|
Chris@4
|
75 stringlist expandConventionalPath(PluginType type, std::string var);
|
Chris@4
|
76 std::string getDefaultPath(PluginType type);
|
Chris@4
|
77
|
Chris@4
|
78 PluginCandidates m_candidates;
|
Chris@4
|
79 };
|
Chris@4
|
80
|
Chris@4
|
81 #endif
|