Added reflection memory cleanup
This commit is contained in:
@@ -6,7 +6,8 @@ Instance::Instance(std::string className)
|
||||
{
|
||||
this->parent = NULL;
|
||||
this->dataTable = new Reflection::ReflectionDataTable(this, className);
|
||||
this->name = Reflection::ReflectionProperty<std::string>(new std::string("Default Game Instance"), Reflection::TYPE_STRING, dataTable);
|
||||
this->name = Reflection::ReflectionProperty<std::string>("Name", new std::string("Level"), Reflection::TYPE_STRING, dataTable);
|
||||
Reflection::ReflectionProperty<std::string>("Name", new std::string("Level"), Reflection::TYPE_STRING, dataTable);
|
||||
}
|
||||
|
||||
Instance::Instance(void)
|
||||
|
||||
@@ -14,9 +14,23 @@ ReflectionDataTable::ReflectionDataTable(void)
|
||||
|
||||
ReflectionDataTable::~ReflectionDataTable(void)
|
||||
{
|
||||
std::map<std::string, ReflectionProperty<void*>*>::iterator it;
|
||||
for (it = propertyTable.begin(); it != propertyTable.end(); it++)
|
||||
{
|
||||
it->second->dispose();
|
||||
}
|
||||
}
|
||||
|
||||
std::string ReflectionDataTable::getClassName(void)
|
||||
{
|
||||
return className;
|
||||
}
|
||||
|
||||
void ReflectionDataTable::mapProperty(std::string key, ReflectionProperty<void*>* prop)
|
||||
{
|
||||
if(propertyTable.find(key) != propertyTable.end())
|
||||
{
|
||||
throw std::string("Reflection error: Key") + key + std::string("already defined!");
|
||||
}
|
||||
propertyTable[key] = prop;
|
||||
}
|
||||
Reference in New Issue
Block a user