diff options
Diffstat (limited to '')
-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 | |||