aboutsummaryrefslogtreecommitdiff
path: root/src/gatscon/treetogats.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-11-09 16:25:22 +0000
committerMike Buland <eichlan@xagasoft.com>2012-11-09 16:25:22 +0000
commit74dd68ad611d15abf16a65c36a7cfd3f4492930a (patch)
tree843fed9ba6bb03253a01314afc3b1dfbb2dfd26c /src/gatscon/treetogats.cpp
parentd9b407475ae3ebe434b29d9eabdd7d4416e17881 (diff)
downloadlibgats-74dd68ad611d15abf16a65c36a7cfd3f4492930a.tar.gz
libgats-74dd68ad611d15abf16a65c36a7cfd3f4492930a.tar.bz2
libgats-74dd68ad611d15abf16a65c36a7cfd3f4492930a.tar.xz
libgats-74dd68ad611d15abf16a65c36a7cfd3f4492930a.zip
Made the repo less libbu++-centric.
Diffstat (limited to 'src/gatscon/treetogats.cpp')
-rw-r--r--src/gatscon/treetogats.cpp52
1 files changed, 0 insertions, 52 deletions
diff --git a/src/gatscon/treetogats.cpp b/src/gatscon/treetogats.cpp
deleted file mode 100644
index a1571d1..0000000
--- a/src/gatscon/treetogats.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
1#include "treetogats.h"
2
3#include <QTreeWidgetItem>
4
5#include <gats/types.h>
6
7Gats::Object *treeToGats( QTreeWidgetItem *pRoot )
8{
9 QString sType = pRoot->text( 1 );
10 QByteArray baDat = pRoot->text( 2 ).toAscii();
11 if( sType == "int" )
12 {
13 return new Gats::Integer( strtoll( baDat.constData(), NULL, 10 ) );
14 }
15 else if( sType == "str" )
16 {
17 return new Gats::String( baDat.constData(), baDat.size() );
18 }
19 else if( sType == "float" )
20 {
21 return new Gats::Float( strtod( baDat.constData(), NULL ) );
22 }
23 else if( sType == "bool" )
24 {
25 return new Gats::Boolean( baDat == "true" );
26 }
27 else if( sType == "list" )
28 {
29 Gats::List *pRet = new Gats::List();
30 for( int j = 0; j < pRoot->childCount(); j++ )
31 {
32 pRet->append( treeToGats( pRoot->child( j ) ) );
33 }
34 return pRet;
35 }
36 else if( sType == "dict" )
37 {
38 Gats::Dictionary *pRet = new Gats::Dictionary();
39 for( int j = 0; j < pRoot->childCount(); j++ )
40 {
41 QTreeWidgetItem *pChild = pRoot->child( j );
42 pRet->insert(
43 pChild->text( 0 ).toAscii().constData(),
44 treeToGats( pChild )
45 );
46 }
47 return pRet;
48 }
49
50 throw Bu::ExceptionBase("Unhandled type found.");
51}
52