diff 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
line wrap: on
line diff
--- a/checker/knownplugins.h	Sun Mar 05 17:15:22 2017 +0000
+++ b/checker/knownplugins.h	Mon Jun 11 17:46:50 2018 +0100
@@ -1,6 +1,6 @@
 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
 /*
-    Copyright (c) 2016 Queen Mary, University of London
+    Copyright (c) 2016-2018 Queen Mary, University of London
 
     Permission is hereby granted, free of charge, to any person
     obtaining a copy of this software and associated documentation
@@ -30,18 +30,13 @@
 #ifndef KNOWN_PLUGINS_H
 #define KNOWN_PLUGINS_H
 
-#include "plugincandidates.h"
-
 #include <string>
 #include <map>
 #include <vector>
 
 /**
- * Class to identify and list candidate shared-library files possibly
- * containing plugins in a hardcoded set of known formats. Uses a
- * separate process (the "helper", whose executable name must be
- * provided at construction) to test-load each library in order to
- * winnow out any that fail to load or crash on load.
+ * Class to provide information about a hardcoded set of known plugin
+ * formats.
  *
  * Requires C++11 and the Qt5 QtCore library.
  */
@@ -56,42 +51,53 @@
         DSSIPlugin
     };
 
-    KnownPlugins(std::string helperExecutableName,
-                 PluginCandidates::LogCallback *cb = 0);
+    enum BinaryFormat {
+        FormatNative,
+        FormatNonNative32Bit // i.e. a 32-bit plugin but on a 64-bit host
+    };
+    
+    KnownPlugins(BinaryFormat format);
 
-    std::vector<PluginType> getKnownPluginTypes() const {
-        return { VampPlugin, LADSPAPlugin, DSSIPlugin };
-    };
+    std::vector<PluginType> getKnownPluginTypes() const;
     
     std::string getTagFor(PluginType type) const {
         return m_known.at(type).tag;
     }
 
-    stringlist getCandidateLibrariesFor(PluginType type) const {
-        return m_candidates.getCandidateLibrariesFor(getTagFor(type));
+    std::string getPathEnvironmentVariableFor(PluginType type) const {
+        return m_known.at(type).variable;
+    }
+    
+    stringlist getDefaultPathFor(PluginType type) const {
+        return m_known.at(type).defaultPath;
     }
 
-    std::string getHelperExecutableName() const {
-        return m_helperExecutableName;
+    stringlist getPathFor(PluginType type) const {
+        return m_known.at(type).path;
     }
 
-    std::string getFailureReport() const;
+    std::string getDescriptorFor(PluginType type) const {
+        return m_known.at(type).descriptor;
+    }
     
 private:
     struct TypeRec {
         std::string tag;
+        std::string variable;
+        stringlist defaultPath;
         stringlist path;
         std::string descriptor;
     };
-    std::map<PluginType, TypeRec> m_known;
+    typedef std::map<PluginType, TypeRec> Known;
+    Known m_known;
 
-    stringlist expandConventionalPath(PluginType type, std::string var);
-    std::string getDefaultPath(PluginType type);
+    std::string getUnexpandedDefaultPathString(PluginType type);
+    std::string getDefaultPathString(PluginType type);
+    
+    stringlist expandPathString(std::string pathString);
+    stringlist expandConventionalPath(PluginType type, std::string variable);
 
-    PluginCandidates m_candidates;
-    std::string m_helperExecutableName;
-
-    bool is32bit() const; // true if helper looks to be 32-bit on 64-bit system
+    BinaryFormat m_format;
 };
 
 #endif