aboutsummaryrefslogtreecommitdiff
path: root/c++-qt/src/dictionary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c++-qt/src/dictionary.cpp')
-rw-r--r--c++-qt/src/dictionary.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/c++-qt/src/dictionary.cpp b/c++-qt/src/dictionary.cpp
index 10ec6c5..1d666ac 100644
--- a/c++-qt/src/dictionary.cpp
+++ b/c++-qt/src/dictionary.cpp
@@ -73,6 +73,52 @@ void Gats::Dictionary::read( QIODevice &rIn, char /*cType*/ )
73 } 73 }
74} 74}
75 75
76QString Gats::Dictionary::toString( int iIndent ) const
77{
78 if( count() == 0 )
79 return "{ }";
80 QString sRet("{");
81 iIndent++;
82 for( const_iterator i = begin(); i != end(); i++ )
83 {
84 if( i == begin() )
85 {
86 sRet += "\n";
87 }
88 else
89 {
90 sRet += ",\n";
91 }
92 for( int j = 0; j < iIndent; j++ ) sRet += " ";
93 sRet += '"';
94 for( QByteArray::const_iterator iS = i.key().begin();
95 iS != i.key().end(); iS++ )
96 {
97 switch( *iS )
98 {
99 case '\\':
100 sRet += "\\";
101 break;
102
103 case '\"':
104 sRet += "\\\"";
105 break;
106
107 default:
108 sRet += *iS;
109 break;
110 }
111 }
112 sRet += "\": ";
113 sRet += i.value()->toString( iIndent );
114 }
115 iIndent--;
116 sRet += "\n";
117 for( int j = 0; j < iIndent; j++ ) sRet += " ";
118 sRet += "}";
119 return sRet;
120}
121
76void Gats::Dictionary::insert( const QByteArray &sKey, char i ) 122void Gats::Dictionary::insert( const QByteArray &sKey, char i )
77{ 123{
78 ((QHash<QByteArray, Gats::Object *> *)this)->insert( 124 ((QHash<QByteArray, Gats::Object *> *)this)->insert(