Mercurial > hg > vamp-plugin-load-checker
comparison checker/knownplugins.h @ 37:3ccc384c0161
Merge from branch plugin-path-config
author | Chris Cannam |
---|---|
date | Mon, 11 Jun 2018 17:46:50 +0100 |
parents | 4154894d638c |
children |
comparison
equal
deleted
inserted
replaced
33:cf18645ff411 | 37:3ccc384c0161 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ |
2 /* | 2 /* |
3 Copyright (c) 2016 Queen Mary, University of London | 3 Copyright (c) 2016-2018 Queen Mary, University of London |
4 | 4 |
5 Permission is hereby granted, free of charge, to any person | 5 Permission is hereby granted, free of charge, to any person |
6 obtaining a copy of this software and associated documentation | 6 obtaining a copy of this software and associated documentation |
7 files (the "Software"), to deal in the Software without | 7 files (the "Software"), to deal in the Software without |
8 restriction, including without limitation the rights to use, copy, | 8 restriction, including without limitation the rights to use, copy, |
28 */ | 28 */ |
29 | 29 |
30 #ifndef KNOWN_PLUGINS_H | 30 #ifndef KNOWN_PLUGINS_H |
31 #define KNOWN_PLUGINS_H | 31 #define KNOWN_PLUGINS_H |
32 | 32 |
33 #include "plugincandidates.h" | |
34 | |
35 #include <string> | 33 #include <string> |
36 #include <map> | 34 #include <map> |
37 #include <vector> | 35 #include <vector> |
38 | 36 |
39 /** | 37 /** |
40 * Class to identify and list candidate shared-library files possibly | 38 * Class to provide information about a hardcoded set of known plugin |
41 * containing plugins in a hardcoded set of known formats. Uses a | 39 * formats. |
42 * separate process (the "helper", whose executable name must be | |
43 * provided at construction) to test-load each library in order to | |
44 * winnow out any that fail to load or crash on load. | |
45 * | 40 * |
46 * Requires C++11 and the Qt5 QtCore library. | 41 * Requires C++11 and the Qt5 QtCore library. |
47 */ | 42 */ |
48 class KnownPlugins | 43 class KnownPlugins |
49 { | 44 { |
54 VampPlugin, | 49 VampPlugin, |
55 LADSPAPlugin, | 50 LADSPAPlugin, |
56 DSSIPlugin | 51 DSSIPlugin |
57 }; | 52 }; |
58 | 53 |
59 KnownPlugins(std::string helperExecutableName, | 54 enum BinaryFormat { |
60 PluginCandidates::LogCallback *cb = 0); | 55 FormatNative, |
56 FormatNonNative32Bit // i.e. a 32-bit plugin but on a 64-bit host | |
57 }; | |
58 | |
59 KnownPlugins(BinaryFormat format); | |
61 | 60 |
62 std::vector<PluginType> getKnownPluginTypes() const { | 61 std::vector<PluginType> getKnownPluginTypes() const; |
63 return { VampPlugin, LADSPAPlugin, DSSIPlugin }; | |
64 }; | |
65 | 62 |
66 std::string getTagFor(PluginType type) const { | 63 std::string getTagFor(PluginType type) const { |
67 return m_known.at(type).tag; | 64 return m_known.at(type).tag; |
68 } | 65 } |
69 | 66 |
70 stringlist getCandidateLibrariesFor(PluginType type) const { | 67 std::string getPathEnvironmentVariableFor(PluginType type) const { |
71 return m_candidates.getCandidateLibrariesFor(getTagFor(type)); | 68 return m_known.at(type).variable; |
69 } | |
70 | |
71 stringlist getDefaultPathFor(PluginType type) const { | |
72 return m_known.at(type).defaultPath; | |
72 } | 73 } |
73 | 74 |
74 std::string getHelperExecutableName() const { | 75 stringlist getPathFor(PluginType type) const { |
75 return m_helperExecutableName; | 76 return m_known.at(type).path; |
76 } | 77 } |
77 | 78 |
78 std::string getFailureReport() const; | 79 std::string getDescriptorFor(PluginType type) const { |
80 return m_known.at(type).descriptor; | |
81 } | |
79 | 82 |
80 private: | 83 private: |
81 struct TypeRec { | 84 struct TypeRec { |
82 std::string tag; | 85 std::string tag; |
86 std::string variable; | |
87 stringlist defaultPath; | |
83 stringlist path; | 88 stringlist path; |
84 std::string descriptor; | 89 std::string descriptor; |
85 }; | 90 }; |
86 std::map<PluginType, TypeRec> m_known; | 91 typedef std::map<PluginType, TypeRec> Known; |
92 Known m_known; | |
87 | 93 |
88 stringlist expandConventionalPath(PluginType type, std::string var); | 94 std::string getUnexpandedDefaultPathString(PluginType type); |
89 std::string getDefaultPath(PluginType type); | 95 std::string getDefaultPathString(PluginType type); |
96 | |
97 stringlist expandPathString(std::string pathString); | |
98 stringlist expandConventionalPath(PluginType type, std::string variable); | |
90 | 99 |
91 PluginCandidates m_candidates; | 100 BinaryFormat m_format; |
92 std::string m_helperExecutableName; | |
93 | |
94 bool is32bit() const; // true if helper looks to be 32-bit on 64-bit system | |
95 }; | 101 }; |
96 | 102 |
97 #endif | 103 #endif |