/* * Copyright (C) 2007-2013 Xagasoft, All rights reserved. * * This file is part of the libgats library and is released under the * terms of the license contained in the file LICENSE. */ #ifndef GATS_OBJECT_H #define GATS_OBJECT_H #include #include class QIODevice; namespace Gats { enum Type { typeDictionary, typeList, typeString, typeInteger, typeFloat, typeBoolean, typeNull }; /** * The baseclass for every type that can be stored in a packet. */ class Object : public QObject { Q_OBJECT; public: Object(); virtual ~Object(); virtual Object *clone() const=0; virtual Type getType() const =0; virtual void write( QIODevice &rOut ) const=0; virtual void read( QIODevice &rIn, char cType )=0; virtual QString toString( int iIndent=0 ) const = 0; static Object *read( QIODevice &rIn ); // static Object *strToGats( const &sStr ); private: // static Object *strToGats( QByteArray::const_iterator &i ); // static QByteArray token( QByteArray::const_iterator &i ); // static void skipWs( QByteArray::const_iterator &i ); }; const char *typeToStr( Type t ); }; //Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Object &obj ); //Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Type &t ); #endif