diff options
author | Mike Buland <eichlan@xagasoft.com> | 2010-08-14 07:12:29 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2010-08-14 07:12:29 +0000 |
commit | 1b797548dff7e2475826ba29a71c3f496008988f (patch) | |
tree | 2a81ee2e8fa2f17fd95410aabbf44533d35a727a /src/string.cpp | |
download | libgats-1b797548dff7e2475826ba29a71c3f496008988f.tar.gz libgats-1b797548dff7e2475826ba29a71c3f496008988f.tar.bz2 libgats-1b797548dff7e2475826ba29a71c3f496008988f.tar.xz libgats-1b797548dff7e2475826ba29a71c3f496008988f.zip |
libgats gets it's own repo. The rest of the history is in my misc repo.
Diffstat (limited to 'src/string.cpp')
-rw-r--r-- | src/string.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/string.cpp b/src/string.cpp new file mode 100644 index 0000000..416375d --- /dev/null +++ b/src/string.cpp | |||
@@ -0,0 +1,38 @@ | |||
1 | #include "gats/string.h" | ||
2 | |||
3 | #include "gats/integer.h" | ||
4 | |||
5 | Gats::String::String() | ||
6 | { | ||
7 | } | ||
8 | |||
9 | Gats::String::String( const String &s ) : | ||
10 | Bu::FString( s ) | ||
11 | { | ||
12 | } | ||
13 | |||
14 | Gats::String::String( const Bu::FString &s ) : | ||
15 | Bu::FString( s ) | ||
16 | { | ||
17 | } | ||
18 | |||
19 | Gats::String::~String() | ||
20 | { | ||
21 | } | ||
22 | |||
23 | void Gats::String::write( Bu::Stream &rOut ) const | ||
24 | { | ||
25 | rOut.write("s", 1 ); | ||
26 | uint32_t iSize = getSize(); | ||
27 | Gats::Integer::writePackedInt( rOut, iSize ); | ||
28 | rOut.write( getStr(), iSize ); | ||
29 | } | ||
30 | |||
31 | void Gats::String::read( Bu::Stream &rIn, char cType ) | ||
32 | { | ||
33 | uint32_t iSize; | ||
34 | Gats::Integer::readPackedInt( rIn, iSize ); | ||
35 | setSize( iSize ); | ||
36 | rIn.read( getStr(), iSize ); | ||
37 | } | ||
38 | |||