paysages3d/src/definition/LegacyLayer.h

56 lines
1.4 KiB
C
Raw Normal View History

2013-10-31 16:59:18 +00:00
#ifndef LEGACYLAYER_H
#define LEGACYLAYER_H
2013-11-03 12:00:31 +00:00
#include <BaseDefinition.h>
namespace paysages {
namespace system {class PackStream;}
namespace definition {
2013-10-31 16:59:18 +00:00
typedef void* (*LayerCallbackCreate)();
typedef void (*LayerCallbackDelete)(void* layer);
typedef void (*LayerCallbackCopy)(void* source, void* definition);
typedef void (*LayerCallbackValidate)(void* layer);
typedef void (*LayerCallbackSave)(PackStream* stream, void* layer);
typedef void (*LayerCallbackLoad)(PackStream* stream, void* layer);
typedef struct {
LayerCallbackCreate callback_create;
LayerCallbackDelete callback_delete;
LayerCallbackCopy callback_copy;
LayerCallbackValidate callback_validate;
LayerCallbackSave callback_save;
LayerCallbackLoad callback_load;
} LayerType;
/**
* @brief Wrapper around the old LayerType, used by C code.
*/
class LegacyLayer:public BaseDefinition
{
public:
LegacyLayer(BaseDefinition* parent, LayerType* type);
virtual ~LegacyLayer();
virtual void save(PackStream* pack);
virtual void load(PackStream* pack);
2013-10-31 23:09:51 +00:00
virtual void copy(BaseDefinition* destination);
2013-10-31 16:59:18 +00:00
virtual void validate();
2013-10-31 23:09:51 +00:00
virtual void setName(QString name);
2013-10-31 16:59:18 +00:00
inline void* getLegacyDefinition() { return legacy; }
2013-10-31 23:09:51 +00:00
inline char* getLegacyName() {return legacy_name;}
2013-10-31 16:59:18 +00:00
private:
LayerType type;
void* legacy;
2013-10-31 23:09:51 +00:00
char legacy_name[100];
2013-10-31 16:59:18 +00:00
};
2013-11-03 12:00:31 +00:00
}
}
2013-10-31 16:59:18 +00:00
#endif // LEGACYLAYER_H