From d534a56d95bca7bdd812be024d9eacba4734e2b7 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 9 Nov 2012 17:20:11 +0000 Subject: Many changes: tabconv'd the C++ code, added a license, BSD, and docs. --- c++-libbu++/src/gatscon/gatstotree.cpp | 115 +++++++++++++++++---------------- 1 file changed, 61 insertions(+), 54 deletions(-) (limited to 'c++-libbu++/src/gatscon/gatstotree.cpp') diff --git a/c++-libbu++/src/gatscon/gatstotree.cpp b/c++-libbu++/src/gatscon/gatstotree.cpp index e388d5e..192b395 100644 --- a/c++-libbu++/src/gatscon/gatstotree.cpp +++ b/c++-libbu++/src/gatscon/gatstotree.cpp @@ -1,3 +1,10 @@ +/* + * Copyright (C) 2007-2012 Xagasoft, All rights reserved. + * + * This file is part of the libgats library and is released under the + * terms of the license contained in the file LICENSE. + */ + #include "gatstotree.h" #include @@ -6,86 +13,86 @@ void gatsToTree( QTreeWidgetItem *p, Gats::Object *pObj ) { - switch( pObj->getType() ) - { - case Gats::typeInteger: - gatsToTree( p, dynamic_cast( pObj ) ); - break; - - case Gats::typeString: - gatsToTree( p, dynamic_cast( pObj ) ); - break; - - case Gats::typeFloat: - gatsToTree( p, dynamic_cast( pObj ) ); - break; - - case Gats::typeBoolean: - gatsToTree( p, dynamic_cast( pObj ) ); - break; - - case Gats::typeList: - gatsToTree( p, dynamic_cast( pObj ) ); - break; - - case Gats::typeDictionary: - gatsToTree( p, dynamic_cast( pObj ) ); - break; - - case Gats::typeNull: - gatsToTree( p, dynamic_cast( pObj ) ); - break; - } + switch( pObj->getType() ) + { + case Gats::typeInteger: + gatsToTree( p, dynamic_cast( pObj ) ); + break; + + case Gats::typeString: + gatsToTree( p, dynamic_cast( pObj ) ); + break; + + case Gats::typeFloat: + gatsToTree( p, dynamic_cast( pObj ) ); + break; + + case Gats::typeBoolean: + gatsToTree( p, dynamic_cast( pObj ) ); + break; + + case Gats::typeList: + gatsToTree( p, dynamic_cast( pObj ) ); + break; + + case Gats::typeDictionary: + gatsToTree( p, dynamic_cast( pObj ) ); + break; + + case Gats::typeNull: + gatsToTree( p, dynamic_cast( pObj ) ); + break; + } } void gatsToTree( QTreeWidgetItem *p, Gats::Integer *pObj ) { - p->setText( 1, "int"); - p->setText( 2, QString("%1").arg( pObj->getValue() ) ); + p->setText( 1, "int"); + p->setText( 2, QString("%1").arg( pObj->getValue() ) ); } void gatsToTree( QTreeWidgetItem *p, Gats::String *pObj ) { - p->setText( 1, "str"); - p->setText( 2, QString("%1").arg( pObj->getStr() ) ); + p->setText( 1, "str"); + p->setText( 2, QString("%1").arg( pObj->getStr() ) ); } void gatsToTree( QTreeWidgetItem *p, Gats::Float *pObj ) { - p->setText( 1, "float"); - p->setText( 2, QString("%1").arg( pObj->getValue() ) ); + p->setText( 1, "float"); + p->setText( 2, QString("%1").arg( pObj->getValue() ) ); } void gatsToTree( QTreeWidgetItem *p, Gats::Boolean *pObj ) { - p->setText( 1, "bool"); - p->setText( 2, pObj->getValue()?"true":"false" ); + p->setText( 1, "bool"); + p->setText( 2, pObj->getValue()?"true":"false" ); } void gatsToTree( QTreeWidgetItem *p, Gats::List *pObj ) { - p->setText( 1, "list"); - int j = 0; - for( Gats::List::iterator i = pObj->begin(); i; i++ ) - { - QTreeWidgetItem *pIt = new QTreeWidgetItem( p ); - pIt->setText( 0, QString("%1").arg( j++ ) ); - gatsToTree( pIt, *i ); - } + p->setText( 1, "list"); + int j = 0; + for( Gats::List::iterator i = pObj->begin(); i; i++ ) + { + QTreeWidgetItem *pIt = new QTreeWidgetItem( p ); + pIt->setText( 0, QString("%1").arg( j++ ) ); + gatsToTree( pIt, *i ); + } } void gatsToTree( QTreeWidgetItem *p, Gats::Dictionary *pObj ) { - p->setText( 1, "dict"); - for( Gats::Dictionary::iterator i = pObj->begin(); i; i++ ) - { - QTreeWidgetItem *pIt = new QTreeWidgetItem( p ); - pIt->setText( 0, QString( i.getKey().getStr() ) ); - gatsToTree( pIt, *i ); - } + p->setText( 1, "dict"); + for( Gats::Dictionary::iterator i = pObj->begin(); i; i++ ) + { + QTreeWidgetItem *pIt = new QTreeWidgetItem( p ); + pIt->setText( 0, QString( i.getKey().getStr() ) ); + gatsToTree( pIt, *i ); + } } void gatsToTree( QTreeWidgetItem *p, Gats::Null *pObj ) { - p->setText( 1, "null"); + p->setText( 1, "null"); } -- cgit v1.2.3