aboutsummaryrefslogtreecommitdiff
path: root/c++-libbu++/src/object.h
diff options
context:
space:
mode:
Diffstat (limited to 'c++-libbu++/src/object.h')
-rw-r--r--c++-libbu++/src/object.h83
1 files changed, 45 insertions, 38 deletions
diff --git a/c++-libbu++/src/object.h b/c++-libbu++/src/object.h
index 2724189..e4da8de 100644
--- a/c++-libbu++/src/object.h
+++ b/c++-libbu++/src/object.h
@@ -1,3 +1,10 @@
1/*
2 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libgats library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
1#ifndef GATS_OBJECT_H 8#ifndef GATS_OBJECT_H
2#define GATS_OBJECT_H 9#define GATS_OBJECT_H
3 10
@@ -5,48 +12,48 @@
5 12
6namespace Bu 13namespace Bu
7{ 14{
8 class Stream; 15 class Stream;
9 class Formatter; 16 class Formatter;
10}; 17};
11 18
12namespace Gats 19namespace Gats
13{ 20{
14 enum Type 21 enum Type
15 { 22 {
16 typeDictionary, 23 typeDictionary,
17 typeList, 24 typeList,
18 typeString, 25 typeString,
19 typeInteger, 26 typeInteger,
20 typeFloat, 27 typeFloat,
21 typeBoolean, 28 typeBoolean,
22 typeNull 29 typeNull
23 }; 30 };
24 31
25 /** 32 /**
26 * The baseclass for every type that can be stored in a packet. 33 * The baseclass for every type that can be stored in a packet.
27 */ 34 */
28 class Object 35 class Object
29 { 36 {
30 public: 37 public:
31 Object(); 38 Object();
32 virtual ~Object(); 39 virtual ~Object();
33 40
34 virtual Type getType() const =0; 41 virtual Type getType() const =0;
35 42
36 virtual void write( Bu::Stream &rOut ) const=0; 43 virtual void write( Bu::Stream &rOut ) const=0;
37 virtual void read( Bu::Stream &rIn, char cType )=0; 44 virtual void read( Bu::Stream &rIn, char cType )=0;
38 virtual Object *clone() const=0; 45 virtual Object *clone() const=0;
39 46
40 static Object *read( Bu::Stream &rIn ); 47 static Object *read( Bu::Stream &rIn );
41 static Object *strToGats( const Bu::String &sStr ); 48 static Object *strToGats( const Bu::String &sStr );
42 49
43 private: 50 private:
44 static Object *strToGats( Bu::String::const_iterator &i ); 51 static Object *strToGats( Bu::String::const_iterator &i );
45 static Bu::String token( Bu::String::const_iterator &i ); 52 static Bu::String token( Bu::String::const_iterator &i );
46 static void skipWs( Bu::String::const_iterator &i ); 53 static void skipWs( Bu::String::const_iterator &i );
47 }; 54 };
48 55
49 const char *typeToStr( Type t ); 56 const char *typeToStr( Type t );
50}; 57};
51 58
52Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Object &obj ); 59Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Object &obj );