diff options
Diffstat (limited to 'src/string.cpp')
-rw-r--r-- | src/string.cpp | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/src/string.cpp b/src/string.cpp deleted file mode 100644 index de66d5d..0000000 --- a/src/string.cpp +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | #include "gats/string.h" | ||
2 | |||
3 | #include "gats/integer.h" | ||
4 | |||
5 | #include <bu/formatter.h> | ||
6 | |||
7 | Gats::String::String() | ||
8 | { | ||
9 | } | ||
10 | |||
11 | Gats::String::String( const char *s ) : | ||
12 | Bu::String( s ) | ||
13 | { | ||
14 | } | ||
15 | |||
16 | Gats::String::String( const char *s, long iLength ) : | ||
17 | Bu::String( s, iLength ) | ||
18 | { | ||
19 | } | ||
20 | |||
21 | Gats::String::String( long iLength ) : | ||
22 | Bu::String( iLength ) | ||
23 | { | ||
24 | } | ||
25 | |||
26 | Gats::String::String( const String &s ) : | ||
27 | Bu::String( s ) | ||
28 | { | ||
29 | } | ||
30 | |||
31 | Gats::String::String( const Bu::String &s ) : | ||
32 | Bu::String( s ) | ||
33 | { | ||
34 | } | ||
35 | |||
36 | Gats::String::~String() | ||
37 | { | ||
38 | } | ||
39 | |||
40 | Gats::Object *Gats::String::clone() const | ||
41 | { | ||
42 | return new Gats::String( Bu::String::clone() ); | ||
43 | } | ||
44 | |||
45 | void Gats::String::write( Bu::Stream &rOut ) const | ||
46 | { | ||
47 | rOut.write("s", 1 ); | ||
48 | uint32_t iSize = getSize(); | ||
49 | Gats::Integer::writePackedInt( rOut, iSize ); | ||
50 | rOut.write( getStr(), iSize ); | ||
51 | } | ||
52 | |||
53 | void Gats::String::read( Bu::Stream &rIn, char cType ) | ||
54 | { | ||
55 | uint32_t iSize; | ||
56 | Gats::Integer::readPackedInt( rIn, iSize ); | ||
57 | setSize( iSize ); | ||
58 | rIn.read( getStr(), iSize ); | ||
59 | } | ||
60 | |||
61 | Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::String &s ) | ||
62 | { | ||
63 | for( Gats::String::const_iterator i = s.begin(); i; i++ ) | ||
64 | { | ||
65 | if( *i >= 127 || *i <= 31 ) | ||
66 | return f << "(binary str) " << s.getSize() << " bytes"; | ||
67 | } | ||
68 | return f << "(str) \"" << dynamic_cast<const Bu::String &>(s) << "\""; | ||
69 | } | ||
70 | |||