BASE: PLUGINS: Implement a getEngineId for PluginObjects, return nullptr by default.

- See comments.
This commit is contained in:
aryanrawlani28 2020-07-29 14:25:15 +05:30 committed by Eugene Sandulenko
parent a73858a3df
commit f2dd03e7d8
2 changed files with 21 additions and 0 deletions

View File

@ -49,6 +49,14 @@ const char *Plugin::getName() const {
return _pluginObject->getName();
}
const char *Plugin::getEngineId() const {
if (_type == PLUGIN_TYPE_METAENGINE) {
return _pluginObject->getEngineId();
}
return nullptr;
}
class StaticPlugin : public Plugin {
public:
StaticPlugin(PluginObject *pluginobject, PluginType type) {

View File

@ -152,6 +152,18 @@ public:
/** Returns the name of the plugin. */
virtual const char *getName() const = 0;
/**
* Returns the engine id of the plugin, if implemented.
* This mostly has the use with MetaEngines, but if another
* type of plugins request this, we return a nullptr.
* This is used because MetaEngines are now available in the
* executable, and querying this we can match a MetaEngine
* with it's related engine.
*/
virtual const char *getEngineId() const {
return nullptr;
}
};
/**
@ -182,6 +194,7 @@ public:
**/
PluginType getType() const;
const char *getName() const;
const char *getEngineId() const;
template <class T>
T &get() const {