diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-03-20 23:13:52 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-03-20 23:13:52 +0000 |
commit | 50dd460655e0ab563de388bad37d3f678ffbb3b4 (patch) | |
tree | fe79c205433e2de48095d81e2a03fb5f9ffca078 /src | |
parent | 2b8255fabce194b35f7b2a350fd08f43d1e698a6 (diff) | |
download | libbu++-50dd460655e0ab563de388bad37d3f678ffbb3b4.tar.gz libbu++-50dd460655e0ab563de388bad37d3f678ffbb3b4.tar.bz2 libbu++-50dd460655e0ab563de388bad37d3f678ffbb3b4.tar.xz libbu++-50dd460655e0ab563de388bad37d3f678ffbb3b4.zip |
Minor updates to the Hash and FString, Hash got a getKeys function, and FString
got the more normal getStr and getSize functions.
Diffstat (limited to '')
-rw-r--r-- | src/fstring.h | 23 | ||||
-rw-r--r-- | src/hash.h | 19 | ||||
-rw-r--r-- | src/serializerconnection.cpp | 14 | ||||
-rw-r--r-- | src/serializerconnection.h | 23 |
4 files changed, 79 insertions, 0 deletions
diff --git a/src/fstring.h b/src/fstring.h index 2f508b7..c3ab6cd 100644 --- a/src/fstring.h +++ b/src/fstring.h | |||
@@ -143,6 +143,29 @@ public: | |||
143 | nLength = nNewSize; | 143 | nLength = nNewSize; |
144 | } | 144 | } |
145 | 145 | ||
146 | long getSize() | ||
147 | { | ||
148 | return nLength; | ||
149 | } | ||
150 | |||
151 | chr *getStr() | ||
152 | { | ||
153 | if( pFirst == NULL ) | ||
154 | return NULL; | ||
155 | |||
156 | flatten(); | ||
157 | return pFirst->pData; | ||
158 | } | ||
159 | |||
160 | const chr *getStr() const | ||
161 | { | ||
162 | if( pFirst == NULL ) | ||
163 | return NULL; | ||
164 | |||
165 | flatten(); | ||
166 | return pFirst->pData; | ||
167 | } | ||
168 | |||
146 | chr *c_str() | 169 | chr *c_str() |
147 | { | 170 | { |
148 | if( pFirst == NULL ) | 171 | if( pFirst == NULL ) |
@@ -5,6 +5,7 @@ | |||
5 | #include <string.h> | 5 | #include <string.h> |
6 | #include <memory> | 6 | #include <memory> |
7 | #include <iostream> | 7 | #include <iostream> |
8 | #include <list> | ||
8 | #include "exceptionbase.h" | 9 | #include "exceptionbase.h" |
9 | #include "hashable.h" | 10 | #include "hashable.h" |
10 | #include "serializable.h" | 11 | #include "serializable.h" |
@@ -450,6 +451,24 @@ public: | |||
450 | return iterator( *this, true ); | 451 | return iterator( *this, true ); |
451 | } | 452 | } |
452 | 453 | ||
454 | std::list<key> getKeys() | ||
455 | { | ||
456 | std::list<key> lKeys; | ||
457 | |||
458 | for( uint32_t j = 0; j < nCapacity; j++ ) | ||
459 | { | ||
460 | if( isFilled( j ) ) | ||
461 | { | ||
462 | if( !isDeleted( j ) ) | ||
463 | { | ||
464 | lKeys.push_back( aKeys[j] ); | ||
465 | } | ||
466 | } | ||
467 | } | ||
468 | |||
469 | return lKeys; | ||
470 | } | ||
471 | |||
453 | protected: | 472 | protected: |
454 | virtual void onInsert() {} | 473 | virtual void onInsert() {} |
455 | virtual void onUpdate() {} | 474 | virtual void onUpdate() {} |
diff --git a/src/serializerconnection.cpp b/src/serializerconnection.cpp new file mode 100644 index 0000000..b2c545c --- /dev/null +++ b/src/serializerconnection.cpp | |||
@@ -0,0 +1,14 @@ | |||
1 | #include "serializerconnection.h" | ||
2 | |||
3 | SerializerConnection::SerializerConnection( | ||
4 | Connection *pCon, int nTimeSec, int nTimeUSec ) : | ||
5 | pCon( pCon ), | ||
6 | nTimeSec( nTimeSec ), | ||
7 | nTimeUSec( nTimeUSec ) | ||
8 | { | ||
9 | } | ||
10 | |||
11 | SerializerConnection::~SerializerConnection() | ||
12 | { | ||
13 | } | ||
14 | |||
diff --git a/src/serializerconnection.h b/src/serializerconnection.h new file mode 100644 index 0000000..85ee84d --- /dev/null +++ b/src/serializerconnection.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef SERIALIZER_CONNECTION_H | ||
2 | #define SERIALIZER_CONNECTION_H | ||
3 | |||
4 | #include <stdint.h> | ||
5 | |||
6 | #include "serializer.h" | ||
7 | |||
8 | /** | ||
9 | * | ||
10 | */ | ||
11 | class SerializerConnection : public Serializer | ||
12 | { | ||
13 | public: | ||
14 | SerializerConnection( Connection *pCon, int nTimeSec, int nTimeUSec ); | ||
15 | virtual ~SerializerConnection(); | ||
16 | |||
17 | private: | ||
18 | Connection *pCon; | ||
19 | int nTimeSec; | ||
20 | int nTimeUSec; | ||
21 | }; | ||
22 | |||
23 | #endif | ||