mirror of
https://github.com/love2d/love.git
synced 2026-08-13 17:10:54 +02:00
Slightly reduced internal reliance on specific module backends
This commit is contained in:
+15
-2
@@ -54,9 +54,9 @@ void Module::registerInstance(Module *instance)
|
||||
registry.insert(make_pair(name, instance));
|
||||
}
|
||||
|
||||
Module *Module::getInstance(const char *name)
|
||||
Module *Module::getInstance(const std::string &name)
|
||||
{
|
||||
std::map<std::string, Module*>::iterator it = registry.find(std::string(name));
|
||||
std::map<std::string, Module*>::const_iterator it = registry.find(name);
|
||||
|
||||
if (registry.end() == it)
|
||||
return NULL;
|
||||
@@ -64,4 +64,17 @@ Module *Module::getInstance(const char *name)
|
||||
return it->second;
|
||||
}
|
||||
|
||||
Module *Module::findInstance(const std::string &name)
|
||||
{
|
||||
std::map<std::string, Module*>::const_iterator it;
|
||||
|
||||
for (it = registry.begin(); it != registry.end(); ++it)
|
||||
{
|
||||
if (it->first.find(name) == 0)
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
} // love
|
||||
|
||||
Reference in New Issue
Block a user