aboutsummaryrefslogtreecommitdiff
path: root/c++-qt/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-04-06 15:24:11 +0000
committerMike Buland <eichlan@xagasoft.com>2012-04-06 15:24:11 +0000
commitf55b26080c85ea0432a468aa793886d019e1e8c2 (patch)
treeeb49ba8244536f5394fe18bae68e07303c6e3d18 /c++-qt/src
parent52bac339b6267aa9aaa3e2e0d02c2a62e47f83e4 (diff)
downloadlibgats-f55b26080c85ea0432a468aa793886d019e1e8c2.tar.gz
libgats-f55b26080c85ea0432a468aa793886d019e1e8c2.tar.bz2
libgats-f55b26080c85ea0432a468aa793886d019e1e8c2.tar.xz
libgats-f55b26080c85ea0432a468aa793886d019e1e8c2.zip
The Qt API now supports cloning.
Diffstat (limited to 'c++-qt/src')
-rw-r--r--c++-qt/src/boolean.cpp5
-rw-r--r--c++-qt/src/boolean.h2
-rw-r--r--c++-qt/src/dictionary.cpp14
-rw-r--r--c++-qt/src/dictionary.h2
-rw-r--r--c++-qt/src/float.cpp5
-rw-r--r--c++-qt/src/float.h2
-rw-r--r--c++-qt/src/integer.cpp5
-rw-r--r--c++-qt/src/integer.h2
-rw-r--r--c++-qt/src/list.cpp12
-rw-r--r--c++-qt/src/list.h2
-rw-r--r--c++-qt/src/object.h2
-rw-r--r--c++-qt/src/string.cpp7
-rw-r--r--c++-qt/src/string.h2
-rw-r--r--c++-qt/src/version.h3
14 files changed, 62 insertions, 3 deletions
diff --git a/c++-qt/src/boolean.cpp b/c++-qt/src/boolean.cpp
index 9610f50..3973607 100644
--- a/c++-qt/src/boolean.cpp
+++ b/c++-qt/src/boolean.cpp
@@ -16,6 +16,11 @@ Gats::Boolean::~Boolean()
16{ 16{
17} 17}
18 18
19Gats::Object *Gats::Boolean::clone() const
20{
21 return new Gats::Boolean( bVal );
22}
23
19void Gats::Boolean::write( QIODevice &rOut ) const 24void Gats::Boolean::write( QIODevice &rOut ) const
20{ 25{
21 if( bVal ) 26 if( bVal )
diff --git a/c++-qt/src/boolean.h b/c++-qt/src/boolean.h
index 4eec690..d707e4d 100644
--- a/c++-qt/src/boolean.h
+++ b/c++-qt/src/boolean.h
@@ -15,6 +15,8 @@ namespace Gats
15 Boolean( bool bVal ); 15 Boolean( bool bVal );
16 virtual ~Boolean(); 16 virtual ~Boolean();
17 17
18 virtual Object *clone() const;
19
18 virtual Type getType() const { return typeBoolean; } 20 virtual Type getType() const { return typeBoolean; }
19 bool getValue() const { return bVal; } 21 bool getValue() const { return bVal; }
20 void setValue( bool b ) { bVal = b; } 22 void setValue( bool b ) { bVal = b; }
diff --git a/c++-qt/src/dictionary.cpp b/c++-qt/src/dictionary.cpp
index ad4759a..edcbdb1 100644
--- a/c++-qt/src/dictionary.cpp
+++ b/c++-qt/src/dictionary.cpp
@@ -18,6 +18,20 @@ Gats::Dictionary::~Dictionary()
18 } 18 }
19} 19}
20 20
21Gats::Object *Gats::Dictionary::clone() const
22{
23 Gats::Dictionary *pClone = new Gats::Dictionary;
24
25 for( const_iterator i = begin(); i != end(); i++ )
26 {
27 QByteArray bKey = i.key();
28 bKey.detach();
29 pClone->insert( bKey, (*i)->clone() );
30 }
31
32 return pClone;
33}
34
21void Gats::Dictionary::write( QIODevice &rOut ) const 35void Gats::Dictionary::write( QIODevice &rOut ) const
22{ 36{
23 rOut.write("d", 1 ); 37 rOut.write("d", 1 );
diff --git a/c++-qt/src/dictionary.h b/c++-qt/src/dictionary.h
index 6db94b2..7f95cf1 100644
--- a/c++-qt/src/dictionary.h
+++ b/c++-qt/src/dictionary.h
@@ -17,6 +17,8 @@ namespace Gats
17 Dictionary(); 17 Dictionary();
18 virtual ~Dictionary(); 18 virtual ~Dictionary();
19 19
20 virtual Object *clone() const;
21
20 virtual Type getType() const { return typeDictionary; } 22 virtual Type getType() const { return typeDictionary; }
21 virtual void write( QIODevice &rOut ) const; 23 virtual void write( QIODevice &rOut ) const;
22 virtual void read( QIODevice &rIn, char cType ); 24 virtual void read( QIODevice &rIn, char cType );
diff --git a/c++-qt/src/float.cpp b/c++-qt/src/float.cpp
index a82edec..fedecf3 100644
--- a/c++-qt/src/float.cpp
+++ b/c++-qt/src/float.cpp
@@ -17,6 +17,11 @@ Gats::Float::~Float()
17{ 17{
18} 18}
19 19
20Gats::Object *Gats::Float::clone() const
21{
22 return new Gats::Float( fVal );
23}
24
20void Gats::Float::write( QIODevice &rOut ) const 25void Gats::Float::write( QIODevice &rOut ) const
21{ 26{
22 if( fVal == 0.0 ) 27 if( fVal == 0.0 )
diff --git a/c++-qt/src/float.h b/c++-qt/src/float.h
index 74225aa..93bfe18 100644
--- a/c++-qt/src/float.h
+++ b/c++-qt/src/float.h
@@ -13,6 +13,8 @@ namespace Gats
13 Float( double f ); 13 Float( double f );
14 virtual ~Float(); 14 virtual ~Float();
15 15
16 virtual Object *clone() const;
17
16 virtual Type getType() const { return typeFloat; } 18 virtual Type getType() const { return typeFloat; }
17 double getValue() const { return fVal; } 19 double getValue() const { return fVal; }
18 20
diff --git a/c++-qt/src/integer.cpp b/c++-qt/src/integer.cpp
index bb6da80..82727f3 100644
--- a/c++-qt/src/integer.cpp
+++ b/c++-qt/src/integer.cpp
@@ -14,6 +14,11 @@ Gats::Integer::~Integer()
14{ 14{
15} 15}
16 16
17Gats::Object *Gats::Integer::clone() const
18{
19 return new Gats::Integer( iVal );
20}
21
17void Gats::Integer::write( QIODevice &rOut ) const 22void Gats::Integer::write( QIODevice &rOut ) const
18{ 23{
19 rOut.write("i", 1 ); 24 rOut.write("i", 1 );
diff --git a/c++-qt/src/integer.h b/c++-qt/src/integer.h
index 8695a12..2dbae94 100644
--- a/c++-qt/src/integer.h
+++ b/c++-qt/src/integer.h
@@ -17,6 +17,8 @@ namespace Gats
17 Integer( int64_t iVal ); 17 Integer( int64_t iVal );
18 virtual ~Integer(); 18 virtual ~Integer();
19 19
20 virtual Object *clone() const;
21
20 virtual Type getType() const { return typeInteger; } 22 virtual Type getType() const { return typeInteger; }
21 int64_t getValue() const { return iVal; } 23 int64_t getValue() const { return iVal; }
22 24
diff --git a/c++-qt/src/list.cpp b/c++-qt/src/list.cpp
index 59e1770..8a648e9 100644
--- a/c++-qt/src/list.cpp
+++ b/c++-qt/src/list.cpp
@@ -18,6 +18,18 @@ Gats::List::~List()
18 } 18 }
19} 19}
20 20
21Gats::Object *Gats::List::clone() const
22{
23 Gats::List *pClone = new Gats::List;
24
25 for( const_iterator i = begin(); i != end(); i++ )
26 {
27 pClone->append( (*i)->clone() );
28 }
29
30 return pClone;
31}
32
21void Gats::List::write( QIODevice &rOut ) const 33void Gats::List::write( QIODevice &rOut ) const
22{ 34{
23 rOut.write("l", 1 ); 35 rOut.write("l", 1 );
diff --git a/c++-qt/src/list.h b/c++-qt/src/list.h
index f712fa5..6e5ac56 100644
--- a/c++-qt/src/list.h
+++ b/c++-qt/src/list.h
@@ -15,6 +15,8 @@ namespace Gats
15 List(); 15 List();
16 virtual ~List(); 16 virtual ~List();
17 17
18 virtual Object *clone() const;
19
18 virtual Type getType() const { return typeList; } 20 virtual Type getType() const { return typeList; }
19 21
20 virtual void write( QIODevice &rOut ) const; 22 virtual void write( QIODevice &rOut ) const;
diff --git a/c++-qt/src/object.h b/c++-qt/src/object.h
index 0c08d41..10501e4 100644
--- a/c++-qt/src/object.h
+++ b/c++-qt/src/object.h
@@ -28,6 +28,8 @@ namespace Gats
28 Object(); 28 Object();
29 virtual ~Object(); 29 virtual ~Object();
30 30
31 virtual Object *clone() const=0;
32
31 virtual Type getType() const =0; 33 virtual Type getType() const =0;
32 34
33 virtual void write( QIODevice &rOut ) const=0; 35 virtual void write( QIODevice &rOut ) const=0;
diff --git a/c++-qt/src/string.cpp b/c++-qt/src/string.cpp
index 0b9e4d8..ef23829 100644
--- a/c++-qt/src/string.cpp
+++ b/c++-qt/src/string.cpp
@@ -35,6 +35,13 @@ Gats::String::~String()
35{ 35{
36} 36}
37 37
38Gats::Object *Gats::String::clone() const
39{
40 QByteArray baClone = *this;
41 baClone.detach();
42 return new Gats::String( baClone );
43}
44
38void Gats::String::write( QIODevice &rOut ) const 45void Gats::String::write( QIODevice &rOut ) const
39{ 46{
40 rOut.write("s", 1 ); 47 rOut.write("s", 1 );
diff --git a/c++-qt/src/string.h b/c++-qt/src/string.h
index 2acd946..9bf6ce3 100644
--- a/c++-qt/src/string.h
+++ b/c++-qt/src/string.h
@@ -18,6 +18,8 @@ namespace Gats
18 String( const QByteArray &s ); 18 String( const QByteArray &s );
19 virtual ~String(); 19 virtual ~String();
20 20
21 virtual Object *clone() const;
22
21 virtual Type getType() const { return typeString; } 23 virtual Type getType() const { return typeString; }
22 24
23 virtual void write( QIODevice &rOut ) const; 25 virtual void write( QIODevice &rOut ) const;
diff --git a/c++-qt/src/version.h b/c++-qt/src/version.h
deleted file mode 100644
index 544dd00..0000000
--- a/c++-qt/src/version.h
+++ /dev/null
@@ -1,3 +0,0 @@
1#ifndef LIBGATS_VC_ID
2#define LIBGATS_VC_ID "68:71"
3#endif