paysages3d/src/definition/LegacyLayer.cpp

44 lines
903 B
C++
Raw Normal View History

2013-10-31 16:59:18 +00:00
#include "LegacyLayer.h"
LegacyLayer::LegacyLayer(BaseDefinition* parent, LayerType* type):
BaseDefinition(parent), type(*type)
{
legacy = type->callback_create();
2013-10-31 23:09:51 +00:00
setName(getName());
2013-10-31 16:59:18 +00:00
}
LegacyLayer::~LegacyLayer()
{
type.callback_delete(legacy);
}
void LegacyLayer::save(PackStream* pack)
{
2013-10-31 23:09:51 +00:00
BaseDefinition::save(pack);
2013-10-31 16:59:18 +00:00
type.callback_save(pack, legacy);
}
void LegacyLayer::load(PackStream* pack)
{
2013-10-31 23:09:51 +00:00
BaseDefinition::load(pack);
2013-10-31 16:59:18 +00:00
type.callback_load(pack, legacy);
}
2013-10-31 23:09:51 +00:00
void LegacyLayer::copy(BaseDefinition* destination)
2013-10-31 16:59:18 +00:00
{
2013-10-31 23:09:51 +00:00
BaseDefinition::copy(destination);
type.callback_copy(legacy, ((LegacyLayer*)destination)->legacy);
2013-10-31 16:59:18 +00:00
}
void LegacyLayer::validate()
{
2013-10-31 23:09:51 +00:00
BaseDefinition::validate();
2013-10-31 16:59:18 +00:00
type.callback_validate(legacy);
}
2013-10-31 23:09:51 +00:00
void LegacyLayer::setName(QString name)
{
BaseDefinition::setName(name);
qstrncpy(legacy_name, name.toUtf8().constData(), 99);
}