2013-10-30 11:46:18 +00:00
|
|
|
#include "BaseDefinition.h"
|
|
|
|
|
|
|
|
BaseDefinition::BaseDefinition(BaseDefinition* parent):
|
|
|
|
parent(parent)
|
|
|
|
{
|
2013-10-30 14:39:56 +00:00
|
|
|
if (parent)
|
|
|
|
{
|
|
|
|
root = parent->root;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
root = this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BaseDefinition::~BaseDefinition()
|
|
|
|
{
|
|
|
|
QListIterator<BaseDefinition*> it(children);
|
|
|
|
while (it.hasNext())
|
|
|
|
{
|
|
|
|
delete it.next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseDefinition::addChild(BaseDefinition* child)
|
|
|
|
{
|
|
|
|
if (not children.contains(child))
|
|
|
|
{
|
|
|
|
children.append(child);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseDefinition::removeChild(BaseDefinition* child)
|
|
|
|
{
|
|
|
|
children.removeOne(child);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseDefinition::save(PackStream* pack)
|
|
|
|
{
|
|
|
|
QListIterator<BaseDefinition*> it(children);
|
|
|
|
while (it.hasNext())
|
|
|
|
{
|
|
|
|
it.next()->save(pack);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseDefinition::load(PackStream* pack)
|
|
|
|
{
|
|
|
|
QListIterator<BaseDefinition*> it(children);
|
|
|
|
while (it.hasNext())
|
|
|
|
{
|
|
|
|
it.next()->load(pack);
|
|
|
|
}
|
2013-10-30 11:46:18 +00:00
|
|
|
}
|