diff options
author | Mike Buland <eichlan@xagasoft.com> | 2010-10-20 18:35:28 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2010-10-20 18:35:28 +0000 |
commit | b5eb1431c28254bfa90147f9ee4857598384be31 (patch) | |
tree | 4f111a568a975d228730f7b2a4898dc7939c8954 | |
parent | d14a4c34d01102baa830c6762ef80b0dc6db6389 (diff) | |
download | libgats-b5eb1431c28254bfa90147f9ee4857598384be31.tar.gz libgats-b5eb1431c28254bfa90147f9ee4857598384be31.tar.bz2 libgats-b5eb1431c28254bfa90147f9ee4857598384be31.tar.xz libgats-b5eb1431c28254bfa90147f9ee4857598384be31.zip |
Fixed a few minor things.
-rw-r--r-- | src/dictionary.cpp | 71 | ||||
-rw-r--r-- | src/dictionary.h | 15 | ||||
-rw-r--r-- | src/gatsstream.cpp | 6 | ||||
-rw-r--r-- | src/gatsstream.h | 1 | ||||
-rw-r--r-- | src/protocolgats.cpp | 5 | ||||
-rw-r--r-- | src/protocolgats.h | 2 |
6 files changed, 90 insertions, 10 deletions
diff --git a/src/dictionary.cpp b/src/dictionary.cpp index 29bbd4e..9b84518 100644 --- a/src/dictionary.cpp +++ b/src/dictionary.cpp | |||
@@ -56,26 +56,89 @@ void Gats::Dictionary::read( Bu::Stream &rIn, char cType ) | |||
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | void Gats::Dictionary::insert( const Bu::FString &sKey, int32_t i ) | 59 | void Gats::Dictionary::insert( const Bu::FString &sKey, char i ) |
60 | { | 60 | { |
61 | ((Bu::Hash<Gats::String, Gats::Object *> *)this)->insert( | 61 | ((Bu::Hash<Gats::String, Gats::Object *> *)this)->insert( |
62 | sKey, new Gats::Integer( i ) | 62 | sKey, new Gats::Integer( i ) |
63 | ); | 63 | ); |
64 | } | 64 | } |
65 | 65 | ||
66 | void Gats::Dictionary::insert( const Bu::FString &sKey, int64_t i ) | 66 | void Gats::Dictionary::insert( const Bu::FString &sKey, unsigned char i ) |
67 | { | 67 | { |
68 | ((Bu::Hash<Gats::String, Gats::Object *> *)this)->insert( | 68 | ((Bu::Hash<Gats::String, Gats::Object *> *)this)->insert( |
69 | sKey, new Gats::Integer( i ) | 69 | sKey, new Gats::Integer( i ) |
70 | ); | 70 | ); |
71 | } | 71 | } |
72 | 72 | ||
73 | /*void Gats::Dictionary::insert( const Bu::FString &sKey, bool b ) | 73 | void Gats::Dictionary::insert( const Bu::FString &sKey, signed char i ) |
74 | { | ||
75 | ((Bu::Hash<Gats::String, Gats::Object *> *)this)->insert( | ||
76 | sKey, new Gats::Integer( i ) | ||
77 | ); | ||
78 | } | ||
79 | |||
80 | void Gats::Dictionary::insert( const Bu::FString &sKey, unsigned short i ) | ||
81 | { | ||
82 | ((Bu::Hash<Gats::String, Gats::Object *> *)this)->insert( | ||
83 | sKey, new Gats::Integer( i ) | ||
84 | ); | ||
85 | } | ||
86 | |||
87 | void Gats::Dictionary::insert( const Bu::FString &sKey, signed short i ) | ||
88 | { | ||
89 | ((Bu::Hash<Gats::String, Gats::Object *> *)this)->insert( | ||
90 | sKey, new Gats::Integer( i ) | ||
91 | ); | ||
92 | } | ||
93 | |||
94 | void Gats::Dictionary::insert( const Bu::FString &sKey, unsigned int i ) | ||
95 | { | ||
96 | ((Bu::Hash<Gats::String, Gats::Object *> *)this)->insert( | ||
97 | sKey, new Gats::Integer( i ) | ||
98 | ); | ||
99 | } | ||
100 | |||
101 | void Gats::Dictionary::insert( const Bu::FString &sKey, signed int i ) | ||
102 | { | ||
103 | ((Bu::Hash<Gats::String, Gats::Object *> *)this)->insert( | ||
104 | sKey, new Gats::Integer( i ) | ||
105 | ); | ||
106 | } | ||
107 | |||
108 | void Gats::Dictionary::insert( const Bu::FString &sKey, unsigned long i ) | ||
109 | { | ||
110 | ((Bu::Hash<Gats::String, Gats::Object *> *)this)->insert( | ||
111 | sKey, new Gats::Integer( i ) | ||
112 | ); | ||
113 | } | ||
114 | |||
115 | void Gats::Dictionary::insert( const Bu::FString &sKey, signed long i ) | ||
116 | { | ||
117 | ((Bu::Hash<Gats::String, Gats::Object *> *)this)->insert( | ||
118 | sKey, new Gats::Integer( i ) | ||
119 | ); | ||
120 | } | ||
121 | |||
122 | void Gats::Dictionary::insert( const Bu::FString &sKey, unsigned long long i ) | ||
123 | { | ||
124 | ((Bu::Hash<Gats::String, Gats::Object *> *)this)->insert( | ||
125 | sKey, new Gats::Integer( i ) | ||
126 | ); | ||
127 | } | ||
128 | |||
129 | void Gats::Dictionary::insert( const Bu::FString &sKey, signed long long i ) | ||
130 | { | ||
131 | ((Bu::Hash<Gats::String, Gats::Object *> *)this)->insert( | ||
132 | sKey, new Gats::Integer( i ) | ||
133 | ); | ||
134 | } | ||
135 | |||
136 | void Gats::Dictionary::insert( const Bu::FString &sKey, bool b ) | ||
74 | { | 137 | { |
75 | Bu::Hash<Gats::String, Gats::Object *>::insert( | 138 | Bu::Hash<Gats::String, Gats::Object *>::insert( |
76 | sKey, new Gats::Boolean( b ) | 139 | sKey, new Gats::Boolean( b ) |
77 | ); | 140 | ); |
78 | }*/ | 141 | } |
79 | 142 | ||
80 | void Gats::Dictionary::insert( const Bu::FString &sKey, double d ) | 143 | void Gats::Dictionary::insert( const Bu::FString &sKey, double d ) |
81 | { | 144 | { |
diff --git a/src/dictionary.h b/src/dictionary.h index c9bf1cb..620b7c3 100644 --- a/src/dictionary.h +++ b/src/dictionary.h | |||
@@ -22,9 +22,18 @@ namespace Gats | |||
22 | 22 | ||
23 | void insert( const Bu::FString &sKey, const char *s ); | 23 | void insert( const Bu::FString &sKey, const char *s ); |
24 | void insert( const Bu::FString &sKey, const Bu::FString &s ); | 24 | void insert( const Bu::FString &sKey, const Bu::FString &s ); |
25 | void insert( const Bu::FString &sKey, int32_t i ); | 25 | void insert( const Bu::FString &sKey, char i ); |
26 | void insert( const Bu::FString &sKey, int64_t i ); | 26 | void insert( const Bu::FString &sKey, unsigned char i ); |
27 | //void insert( const Bu::FString &sKey, bool b ); | 27 | void insert( const Bu::FString &sKey, signed char i ); |
28 | void insert( const Bu::FString &sKey, unsigned short i ); | ||
29 | void insert( const Bu::FString &sKey, signed short i ); | ||
30 | void insert( const Bu::FString &sKey, unsigned int i ); | ||
31 | void insert( const Bu::FString &sKey, signed int i ); | ||
32 | void insert( const Bu::FString &sKey, unsigned long i ); | ||
33 | void insert( const Bu::FString &sKey, signed long i ); | ||
34 | void insert( const Bu::FString &sKey, unsigned long long i ); | ||
35 | void insert( const Bu::FString &sKey, signed long long i ); | ||
36 | void insert( const Bu::FString &sKey, bool b ); | ||
28 | void insert( const Bu::FString &sKey, double d ); | 37 | void insert( const Bu::FString &sKey, double d ); |
29 | using Bu::Hash<Gats::String, Gats::Object *>::insert; | 38 | using Bu::Hash<Gats::String, Gats::Object *>::insert; |
30 | 39 | ||
diff --git a/src/gatsstream.cpp b/src/gatsstream.cpp index 38adfbb..3e9b211 100644 --- a/src/gatsstream.cpp +++ b/src/gatsstream.cpp | |||
@@ -1,11 +1,15 @@ | |||
1 | #include "gats/gatsstream.h" | 1 | #include "gats/gatsstream.h" |
2 | #include "gats/object.h" | 2 | #include "gats/object.h" |
3 | 3 | ||
4 | #ifdef WIN32 | ||
5 | #include <winsock2.h> | ||
6 | #else | ||
4 | #include <arpa/inet.h> | 7 | #include <arpa/inet.h> |
8 | #endif | ||
5 | 9 | ||
6 | // #include <bu/sio.h> | 10 | // #include <bu/sio.h> |
7 | #include <bu/nullstream.h> | 11 | #include <bu/nullstream.h> |
8 | using namespace Bu; | 12 | // using namespace Bu; |
9 | 13 | ||
10 | Gats::GatsStream::GatsStream( Bu::Stream &rStream ) : | 14 | Gats::GatsStream::GatsStream( Bu::Stream &rStream ) : |
11 | rStream( rStream ) | 15 | rStream( rStream ) |
diff --git a/src/gatsstream.h b/src/gatsstream.h index b5efb87..39719cf 100644 --- a/src/gatsstream.h +++ b/src/gatsstream.h | |||
@@ -42,6 +42,7 @@ namespace Gats | |||
42 | * non-null in the most recent call, this should always be false. | 42 | * non-null in the most recent call, this should always be false. |
43 | */ | 43 | */ |
44 | bool hasReadBuffer() { return qbRead.getSize() > 0; } | 44 | bool hasReadBuffer() { return qbRead.getSize() > 0; } |
45 | int getReadBufferSize() { return qbRead.getSize(); } | ||
45 | 46 | ||
46 | private: | 47 | private: |
47 | bool skipReadNulls(); | 48 | bool skipReadNulls(); |
diff --git a/src/protocolgats.cpp b/src/protocolgats.cpp index 2ef6079..827eb65 100644 --- a/src/protocolgats.cpp +++ b/src/protocolgats.cpp | |||
@@ -3,6 +3,9 @@ | |||
3 | 3 | ||
4 | #include <bu/client.h> | 4 | #include <bu/client.h> |
5 | 5 | ||
6 | #include <bu/sio.h> | ||
7 | using namespace Bu; | ||
8 | |||
6 | Gats::ProtocolGats::ProtocolGats() : | 9 | Gats::ProtocolGats::ProtocolGats() : |
7 | pStream( NULL ), | 10 | pStream( NULL ), |
8 | pUsedClient( NULL ) | 11 | pUsedClient( NULL ) |
@@ -42,7 +45,7 @@ void Gats::ProtocolGats::onNewData( Bu::Client *pClient ) | |||
42 | Gats::Object *pObj = pStream->readObject(); | 45 | Gats::Object *pObj = pStream->readObject(); |
43 | if( pObj == NULL ) | 46 | if( pObj == NULL ) |
44 | break; | 47 | break; |
45 | onNewObject( pObj ); | 48 | onNewObject( pClient, pObj ); |
46 | } | 49 | } |
47 | } | 50 | } |
48 | 51 | ||
diff --git a/src/protocolgats.h b/src/protocolgats.h index e261ab5..7ed58d4 100644 --- a/src/protocolgats.h +++ b/src/protocolgats.h | |||
@@ -17,7 +17,7 @@ namespace Gats | |||
17 | virtual void onNewConnection( Bu::Client *pClient ); | 17 | virtual void onNewConnection( Bu::Client *pClient ); |
18 | virtual void onNewData( Bu::Client *pClient ); | 18 | virtual void onNewData( Bu::Client *pClient ); |
19 | 19 | ||
20 | virtual void onNewObject( Gats::Object *pObj )=0; | 20 | virtual void onNewObject( Bu::Client *pClient, Gats::Object *pObj )=0; |
21 | 21 | ||
22 | void writeObject( Gats::Object *pObj ); | 22 | void writeObject( Gats::Object *pObj ); |
23 | 23 | ||