diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-11-09 17:20:11 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-11-09 17:20:11 +0000 |
commit | d534a56d95bca7bdd812be024d9eacba4734e2b7 (patch) | |
tree | f9b98ee2b80e645a7b54e7934882be6c9f73c165 /c++-libbu++/src/object.h | |
parent | 61ccc86fdf06f12cb72a8b7e65286f812cf62154 (diff) | |
download | libgats-d534a56d95bca7bdd812be024d9eacba4734e2b7.tar.gz libgats-d534a56d95bca7bdd812be024d9eacba4734e2b7.tar.bz2 libgats-d534a56d95bca7bdd812be024d9eacba4734e2b7.tar.xz libgats-d534a56d95bca7bdd812be024d9eacba4734e2b7.zip |
Many changes: tabconv'd the C++ code, added a license, BSD, and docs.
Diffstat (limited to '')
-rw-r--r-- | c++-libbu++/src/object.h | 83 |
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 | ||
6 | namespace Bu | 13 | namespace Bu |
7 | { | 14 | { |
8 | class Stream; | 15 | class Stream; |
9 | class Formatter; | 16 | class Formatter; |
10 | }; | 17 | }; |
11 | 18 | ||
12 | namespace Gats | 19 | namespace 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 | ||
52 | Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Object &obj ); | 59 | Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Object &obj ); |