Added name member
This commit is contained in:
parent
34c19f7a9a
commit
e7bb903f03
@ -34,7 +34,8 @@ namespace sc {
|
|||||||
std::string::size_type lastdot = plugname.rfind(".");
|
std::string::size_type lastdot = plugname.rfind(".");
|
||||||
if (plugname.substr(lastdot + 1) == ext) {
|
if (plugname.substr(lastdot + 1) == ext) {
|
||||||
plugin plugin {dir + '/' + plugname};
|
plugin plugin {dir + '/' + plugname};
|
||||||
plugins.emplace(plugname.substr(0, lastdot), std::move(plugin));
|
plugin.name(plugname.substr(0, lastdot));
|
||||||
|
plugins.emplace(plugin.name(), std::move(plugin));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,7 +103,10 @@ namespace sc {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string path() const { return _path; }
|
const std::string& path() const { return _path; }
|
||||||
|
|
||||||
|
const std::string& name() const { return _name; }
|
||||||
|
void name(const std::string& nm) { _name = nm; }
|
||||||
|
|
||||||
std::unique_ptr<T> operator()() const {
|
std::unique_ptr<T> operator()() const {
|
||||||
std::unique_ptr<T> obj;
|
std::unique_ptr<T> obj;
|
||||||
@ -116,6 +120,7 @@ namespace sc {
|
|||||||
static std::map<std::string, plugin<T>> plugins;
|
static std::map<std::string, plugin<T>> plugins;
|
||||||
|
|
||||||
std::string _path;
|
std::string _path;
|
||||||
|
std::string _name;
|
||||||
void* _plugin {nullptr};
|
void* _plugin {nullptr};
|
||||||
using factory = T*(*)();
|
using factory = T*(*)();
|
||||||
factory _factory {nullptr};
|
factory _factory {nullptr};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user