aboutsummaryrefslogtreecommitdiff
path: root/c++-qt/src/string.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--c++-qt/src/string.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/c++-qt/src/string.cpp b/c++-qt/src/string.cpp
new file mode 100644
index 0000000..0b9e4d8
--- /dev/null
+++ b/c++-qt/src/string.cpp
@@ -0,0 +1,58 @@
1#include "gats-qt/string.h"
2
3#include "gats-qt/integer.h"
4
5Gats::String::String()
6{
7}
8
9Gats::String::String( const char *s ) :
10 QByteArray( s )
11{
12}
13
14Gats::String::String( const char *s, long iLength ) :
15 QByteArray( s, iLength )
16{
17}
18
19Gats::String::String( long iLength ) :
20 QByteArray( iLength, '\0' )
21{
22}
23
24Gats::String::String( const String &s ) :
25 QByteArray( s )
26{
27}
28
29Gats::String::String( const QByteArray &s ) :
30 QByteArray( s )
31{
32}
33
34Gats::String::~String()
35{
36}
37
38void Gats::String::write( QIODevice &rOut ) const
39{
40 rOut.write("s", 1 );
41 uint32_t iSize = size();
42 Gats::Integer::writePackedInt( rOut, iSize );
43 rOut.write( constData(), iSize );
44}
45
46void Gats::String::read( QIODevice &rIn, char cType )
47{
48 uint32_t iSize;
49 Gats::Integer::readPackedInt( rIn, iSize );
50 fill( '\0', iSize );
51 rIn.read( data(), iSize );
52}
53/*
54Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::String &s )
55{
56 return f << "(str) \"" << dynamic_cast<const QByteArray &>(s) << "\"";
57}
58*/