From 3fe1622eda7df9c11c1bc798e37629a5defca6b8 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Wed, 4 Apr 2012 12:07:38 +0000 Subject: Fixed a parsing error in NBT classes (doubles weren't parsing correctly); Added a working NBT serialization (verified in another project) git-svn-id: http://mc-server.googlecode.com/svn/trunk@451 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/NBT.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'source/NBT.h') diff --git a/source/NBT.h b/source/NBT.h index 75ff6e361..6d3ecebd9 100644 --- a/source/NBT.h +++ b/source/NBT.h @@ -200,6 +200,34 @@ public: +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// The serializer: + +class cNBTSerializer +{ + static void WriteTag (AString & a_Out, const cNBTTag * a_Tag); + + static void WriteByte (AString & a_Out, const char a_Value); + static void WriteInt16 (AString & a_Out, const Int16 a_Value); + static void WriteInt32 (AString & a_Out, const Int32 a_Value); + static void WriteInt64 (AString & a_Out, const Int64 a_Value); + static void WriteFloat (AString & a_Out, const float a_Value); + static void WriteDouble (AString & a_Out, const double a_Value); + static void WriteByteArray(AString & a_Out, const AString & a_Value); + static void WriteString (AString & a_Out, const AString & a_Value); + static void WriteList (AString & a_Out, const cNBTList * a_List); + static void WriteCompound (AString & a_Out, const cNBTCompound * a_Compound); + static void WriteIntArray (AString & a_Out, const cNBTIntArray * a_Array); + +public: + + static void Serialize(const cNBTTree * a_Tree, AString & a_Out); +} ; + + + + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Dumping the tree (DEBUG-only) -- cgit v1.2.3