aboutsummaryrefslogtreecommitdiff
path: root/src/string.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/string.cpp')
-rw-r--r--src/string.cpp70
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
7Gats::String::String()
8{
9}
10
11Gats::String::String( const char *s ) :
12 Bu::String( s )
13{
14}
15
16Gats::String::String( const char *s, long iLength ) :
17 Bu::String( s, iLength )
18{
19}
20
21Gats::String::String( long iLength ) :
22 Bu::String( iLength )
23{
24}
25
26Gats::String::String( const String &s ) :
27 Bu::String( s )
28{
29}
30
31Gats::String::String( const Bu::String &s ) :
32 Bu::String( s )
33{
34}
35
36Gats::String::~String()
37{
38}
39
40Gats::Object *Gats::String::clone() const
41{
42 return new Gats::String( Bu::String::clone() );
43}
44
45void 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
53void 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
61Bu::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