annotate checker/knownplugins.h @ 64:e839338d3869 tip

Further Windows fix
author Chris Cannam
date Wed, 15 Apr 2020 16:30:40 +0100
parents 4154894d638c
children
rev   line source
Chris@4 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@5 2 /*
Chris@35 3 Copyright (c) 2016-2018 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 <string>
Chris@4 34 #include <map>
Chris@4 35 #include <vector>
Chris@4 36
Chris@28 37 /**
Chris@35 38 * Class to provide information about a hardcoded set of known plugin
Chris@35 39 * formats.
Chris@28 40 *
Chris@28 41 * Requires C++11 and the Qt5 QtCore library.
Chris@28 42 */
Chris@4 43 class KnownPlugins
Chris@4 44 {
Chris@4 45 typedef std::vector<std::string> stringlist;
Chris@4 46
Chris@4 47 public:
Chris@4 48 enum PluginType {
Chris@19 49 VampPlugin,
Chris@19 50 LADSPAPlugin,
Chris@19 51 DSSIPlugin
Chris@4 52 };
Chris@4 53
Chris@35 54 enum BinaryFormat {
Chris@35 55 FormatNative,
Chris@35 56 FormatNonNative32Bit // i.e. a 32-bit plugin but on a 64-bit host
Chris@35 57 };
Chris@35 58
Chris@35 59 KnownPlugins(BinaryFormat format);
Chris@4 60
Chris@34 61 std::vector<PluginType> getKnownPluginTypes() const;
Chris@4 62
Chris@4 63 std::string getTagFor(PluginType type) const {
Chris@19 64 return m_known.at(type).tag;
Chris@4 65 }
Chris@4 66
Chris@34 67 std::string getPathEnvironmentVariableFor(PluginType type) const {
Chris@34 68 return m_known.at(type).variable;
Chris@34 69 }
Chris@34 70
Chris@35 71 stringlist getDefaultPathFor(PluginType type) const {
Chris@35 72 return m_known.at(type).defaultPath;
Chris@35 73 }
Chris@35 74
Chris@34 75 stringlist getPathFor(PluginType type) const {
Chris@34 76 return m_known.at(type).path;
Chris@34 77 }
Chris@34 78
Chris@35 79 std::string getDescriptorFor(PluginType type) const {
Chris@35 80 return m_known.at(type).descriptor;
Chris@21 81 }
Chris@4 82
Chris@4 83 private:
Chris@4 84 struct TypeRec {
Chris@19 85 std::string tag;
Chris@34 86 std::string variable;
Chris@35 87 stringlist defaultPath;
Chris@19 88 stringlist path;
Chris@19 89 std::string descriptor;
Chris@4 90 };
Chris@34 91 typedef std::map<PluginType, TypeRec> Known;
Chris@34 92 Known m_known;
Chris@4 93
Chris@35 94 std::string getUnexpandedDefaultPathString(PluginType type);
Chris@35 95 std::string getDefaultPathString(PluginType type);
Chris@35 96
Chris@35 97 stringlist expandPathString(std::string pathString);
Chris@35 98 stringlist expandConventionalPath(PluginType type, std::string variable);
Chris@4 99
Chris@35 100 BinaryFormat m_format;
Chris@4 101 };
Chris@4 102
Chris@4 103 #endif