Chris@4: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@5: /* Chris@35: Copyright (c) 2016-2018 Queen Mary, University of London Chris@5: Chris@5: Permission is hereby granted, free of charge, to any person Chris@5: obtaining a copy of this software and associated documentation Chris@5: files (the "Software"), to deal in the Software without Chris@5: restriction, including without limitation the rights to use, copy, Chris@5: modify, merge, publish, distribute, sublicense, and/or sell copies Chris@5: of the Software, and to permit persons to whom the Software is Chris@5: furnished to do so, subject to the following conditions: Chris@5: Chris@5: The above copyright notice and this permission notice shall be Chris@5: included in all copies or substantial portions of the Software. Chris@5: Chris@5: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, Chris@5: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF Chris@5: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND Chris@5: NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY Chris@5: CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF Chris@5: CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION Chris@5: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Chris@5: Chris@5: Except as contained in this notice, the names of the Centre for Chris@5: Digital Music and Queen Mary, University of London shall not be Chris@5: used in advertising or otherwise to promote the sale, use or other Chris@5: dealings in this Software without prior written authorization. Chris@5: */ Chris@4: Chris@4: #ifndef KNOWN_PLUGINS_H Chris@4: #define KNOWN_PLUGINS_H Chris@4: Chris@4: #include Chris@4: #include Chris@4: #include Chris@4: Chris@28: /** Chris@35: * Class to provide information about a hardcoded set of known plugin Chris@35: * formats. Chris@28: * Chris@28: * Requires C++11 and the Qt5 QtCore library. Chris@28: */ Chris@4: class KnownPlugins Chris@4: { Chris@4: typedef std::vector stringlist; Chris@4: Chris@4: public: Chris@4: enum PluginType { Chris@19: VampPlugin, Chris@19: LADSPAPlugin, Chris@19: DSSIPlugin Chris@4: }; Chris@4: Chris@35: enum BinaryFormat { Chris@35: FormatNative, Chris@35: FormatNonNative32Bit // i.e. a 32-bit plugin but on a 64-bit host Chris@35: }; Chris@35: Chris@35: KnownPlugins(BinaryFormat format); Chris@4: Chris@34: std::vector getKnownPluginTypes() const; Chris@4: Chris@4: std::string getTagFor(PluginType type) const { Chris@19: return m_known.at(type).tag; Chris@4: } Chris@4: Chris@34: std::string getPathEnvironmentVariableFor(PluginType type) const { Chris@34: return m_known.at(type).variable; Chris@34: } Chris@34: Chris@35: stringlist getDefaultPathFor(PluginType type) const { Chris@35: return m_known.at(type).defaultPath; Chris@35: } Chris@35: Chris@34: stringlist getPathFor(PluginType type) const { Chris@34: return m_known.at(type).path; Chris@34: } Chris@34: Chris@35: std::string getDescriptorFor(PluginType type) const { Chris@35: return m_known.at(type).descriptor; Chris@21: } Chris@4: Chris@4: private: Chris@4: struct TypeRec { Chris@19: std::string tag; Chris@34: std::string variable; Chris@35: stringlist defaultPath; Chris@19: stringlist path; Chris@19: std::string descriptor; Chris@4: }; Chris@34: typedef std::map Known; Chris@34: Known m_known; Chris@4: Chris@35: std::string getUnexpandedDefaultPathString(PluginType type); Chris@35: std::string getDefaultPathString(PluginType type); Chris@35: Chris@35: stringlist expandPathString(std::string pathString); Chris@35: stringlist expandConventionalPath(PluginType type, std::string variable); Chris@4: Chris@35: BinaryFormat m_format; Chris@4: }; Chris@4: Chris@4: #endif