X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FTypeDescription.h;h=ab8c1bf1ba13328b399d721c46fb26cb2053af65;hb=4bc70f5311dcbcca4e6b9e852bbcb19602f50eeb;hp=edd0177c418fe3f344834165d7638d278749276b;hpb=389d2fcb1e9ca1023cda11da80f00272ab20903a;p=l2e.git diff --git a/src/loader/TypeDescription.h b/src/loader/TypeDescription.h index edd0177..ab8c1bf 100644 --- a/src/loader/TypeDescription.h +++ b/src/loader/TypeDescription.h @@ -8,6 +8,7 @@ #ifndef LOADER_TYPEDESCRIPTION_H_ #define LOADER_TYPEDESCRIPTION_H_ +#include #include #include #include @@ -18,15 +19,21 @@ namespace loader { class FieldDescription { public: - FieldDescription(std::ptrdiff_t offset, int type, bool reference = true, bool aggregate = false) - : offset(offset), type(type), reference(reference), aggregate(aggregate) { } + FieldDescription(std::ptrdiff_t offset, int type) + : description(0), offset(offset), type(type), reference(false), aggregate(false) { } std::ptrdiff_t Offset() const { return offset; }; int TypeId() const { return type; } bool IsReferenced() const { return reference; } bool IsAggregate() const { return aggregate; } + const char *Description() const { return description; } + + FieldDescription &SetReferenced() { reference = true; return *this; } + FieldDescription &SetAggregate() { aggregate = true; return *this; } + FieldDescription &SetDescription(const char *d) { description = d; return *this; } private: + const char *description; std::ptrdiff_t offset; int type; bool reference; @@ -56,6 +63,9 @@ public: void SetSize(int s) { size = s; } int Size() const { return size; } + void SetDescription(const char *d) { description = d; } + const char *Description() const { return description; } + typedef std::map::const_iterator FieldIterator; FieldIterator FieldsBegin() const { return fields.begin(); } FieldIterator FieldsEnd() const { return fields.end(); } @@ -64,12 +74,15 @@ public: static int GetTypeId(const std::string &); static const TypeDescription &Get(int id); + static void WriteSourceWiki(std::ostream &); + private: - TypeDescription(int id, const std::string &name) : constructor(0), loader(0), name(name), id(id), size(0) { } + TypeDescription(int id, const std::string &name) : constructor(0), loader(0), description(0), name(name), id(id), size(0) { } private: void (*constructor)(void *); void (*loader)(void *); + const char *description; std::string name; std::map fields; std::map supertypes;