#pragma once #include #include "InputOutputStream.h" using namespace std; class Tag { public: static const byte TAG_End = static_cast(0); static const byte TAG_Byte = static_cast(1); static const byte TAG_Short = static_cast(2); static const byte TAG_Int = static_cast(3); static const byte TAG_Long = static_cast(4); static const byte TAG_Float = static_cast(5); static const byte TAG_Double = static_cast(6); static const byte TAG_Byte_Array = static_cast(7); static const byte TAG_String = static_cast(8); static const byte TAG_List = static_cast(9); static const byte TAG_Compound = static_cast(10); static const byte TAG_Int_Array = static_cast(11); private: wstring name; protected: Tag(const wstring &name); public: virtual void write(DataOutput *dos) = 0; virtual void load(DataInput *dis) = 0; virtual wstring toString() = 0; virtual byte getId() = 0; void print(ostream out); void print(char *prefix, wostream out); wstring getName(); Tag *setName(const wstring& name); static Tag *readNamedTag(DataInput *dis); static void writeNamedTag(Tag *tag, DataOutput *dos); static Tag *newTag(byte type, const wstring &name); static wchar_t *getTagName(byte type); virtual ~Tag() {} virtual bool equals(Tag *obj); // 4J Brought forward from 1.2 virtual Tag *copy() = 0; // 4J Brought foward from 1.2 };