aboutsummaryrefslogtreecommitdiff
path: root/c++-qt/src/object.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-03-31 17:34:11 +0000
committerMike Buland <eichlan@xagasoft.com>2012-03-31 17:34:11 +0000
commit82da0238a8171cf8bba6bb1c82d5abba207a10aa (patch)
tree83ff9b022b658e7a056fc85f132937b8bda4c1c3 /c++-qt/src/object.h
parent7dd5c386611e31930e7ccfb83cb585df27696881 (diff)
downloadlibgats-82da0238a8171cf8bba6bb1c82d5abba207a10aa.tar.gz
libgats-82da0238a8171cf8bba6bb1c82d5abba207a10aa.tar.bz2
libgats-82da0238a8171cf8bba6bb1c82d5abba207a10aa.tar.xz
libgats-82da0238a8171cf8bba6bb1c82d5abba207a10aa.zip
Gats for QT is here. It's a pretty basic conversion right now, it doesn't
support debugging formatting (Bu::sio), it doesn't support gats-text string parsing, and the exceptions need to be fixed to be real exceptions. The basic functions have been renamed to match the Qt API and we use QT types for everything (QHash, QList, QByteArray). It needs more testing, but it's a great start.
Diffstat (limited to '')
-rw-r--r--c++-qt/src/object.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/c++-qt/src/object.h b/c++-qt/src/object.h
new file mode 100644
index 0000000..0c08d41
--- /dev/null
+++ b/c++-qt/src/object.h
@@ -0,0 +1,51 @@
1#ifndef GATS_OBJECT_H
2#define GATS_OBJECT_H
3
4#include <QObject>
5#include <QByteArray>
6
7class QIODevice;
8
9namespace Gats
10{
11 enum Type
12 {
13 typeDictionary,
14 typeList,
15 typeString,
16 typeInteger,
17 typeFloat,
18 typeBoolean
19 };
20
21 /**
22 * The baseclass for every type that can be stored in a packet.
23 */
24 class Object : public QObject
25 {
26 Q_OBJECT;
27 public:
28 Object();
29 virtual ~Object();
30
31 virtual Type getType() const =0;
32
33 virtual void write( QIODevice &rOut ) const=0;
34 virtual void read( QIODevice &rIn, char cType )=0;
35
36 static Object *read( QIODevice &rIn );
37// static Object *strToGats( const &sStr );
38
39 private:
40// static Object *strToGats( QByteArray::const_iterator &i );
41// static QByteArray token( QByteArray::const_iterator &i );
42// static void skipWs( QByteArray::const_iterator &i );
43 };
44
45 const char *typeToStr( Type t );
46};
47
48//Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Object &obj );
49//Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Type &t );
50
51#endif