Add addObjects to add multiple objects in one step

This commit is contained in:
wmayer
2017-05-05 21:21:09 +02:00
parent 77386684fb
commit 3e862bd557
6 changed files with 140 additions and 19 deletions

View File

@@ -92,24 +92,7 @@ void *Type::createInstanceByName(const char* TypeName, bool bLoadModule)
{
// if not already, load the module
if(bLoadModule)
{
// cut out the module name
string Mod = getModuleName(TypeName);
// ignore base modules
if(Mod != "App" && Mod != "Gui" && Mod != "Base")
{
// remember already loaded modules
set<string>::const_iterator pos = loadModuleSet.find(Mod);
if(pos == loadModuleSet.end())
{
Interpreter().loadModule(Mod.c_str());
#ifdef FC_LOGLOADMODULE
Console().Log("Act: Module %s loaded through class %s \n",Mod.c_str(),TypeName);
#endif
loadModuleSet.insert(Mod);
}
}
}
importModule(TypeName);
// now the type should be in the type map
Type t = fromName(TypeName);
@@ -117,7 +100,24 @@ void *Type::createInstanceByName(const char* TypeName, bool bLoadModule)
return 0;
return t.createInstance();
}
void Type::importModule(const char* TypeName)
{
// cut out the module name
string Mod = getModuleName(TypeName);
// ignore base modules
if (Mod != "App" && Mod != "Gui" && Mod != "Base") {
// remember already loaded modules
set<string>::const_iterator pos = loadModuleSet.find(Mod);
if (pos == loadModuleSet.end()) {
Interpreter().loadModule(Mod.c_str());
#ifdef FC_LOGLOADMODULE
Console().Log("Act: Module %s loaded through class %s \n",Mod.c_str(),TypeName);
#endif
loadModuleSet.insert(Mod);
}
}
}
string Type::getModuleName(const char* ClassName)