diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-10-16 16:09:02 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-10-16 16:09:02 +0000 |
commit | bf53de3dfa4db68627f2935e6b2144835604df3a (patch) | |
tree | e5e50c0b0e7df827dcdc8a162f1ff5fb61ac3277 /src/tafgroup.cpp | |
parent | 96b07a22f5392f5d7f821f5743deb3d64bd94e89 (diff) | |
download | libbu++-bf53de3dfa4db68627f2935e6b2144835604df3a.tar.gz libbu++-bf53de3dfa4db68627f2935e6b2144835604df3a.tar.bz2 libbu++-bf53de3dfa4db68627f2935e6b2144835604df3a.tar.xz libbu++-bf53de3dfa4db68627f2935e6b2144835604df3a.zip |
Finally added the substream class, and added getByPath (for properties) and
getChildByPath (for groups) to the TafGroup class.
Diffstat (limited to 'src/tafgroup.cpp')
-rw-r--r-- | src/tafgroup.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/tafgroup.cpp b/src/tafgroup.cpp index 1837bd8..9440912 100644 --- a/src/tafgroup.cpp +++ b/src/tafgroup.cpp | |||
@@ -162,3 +162,40 @@ const Bu::FString &Bu::TafGroup::getProperty( const Bu::FString &sName, | |||
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | const Bu::TafGroup *Bu::TafGroup::getChildByPath( | ||
166 | const Bu::FString &sPath ) const | ||
167 | { | ||
168 | return getChildByPath( sPath.split('/') ); | ||
169 | } | ||
170 | |||
171 | const Bu::TafGroup *Bu::TafGroup::getChildByPath( Bu::StrList lPath ) const | ||
172 | { | ||
173 | const Bu::TafGroup *cur = this; | ||
174 | |||
175 | for( Bu::StrList::const_iterator i = lPath.begin(); i; i++ ) | ||
176 | { | ||
177 | cur = cur->getChild( *i ); | ||
178 | } | ||
179 | |||
180 | return cur; | ||
181 | } | ||
182 | |||
183 | const Bu::FString &Bu::TafGroup::getByPath( const Bu::FString &sPath ) const | ||
184 | { | ||
185 | return getByPath( sPath.split('/') ); | ||
186 | } | ||
187 | |||
188 | const Bu::FString &Bu::TafGroup::getByPath( Bu::StrList lPath ) const | ||
189 | { | ||
190 | const Bu::TafGroup *cur = this; | ||
191 | |||
192 | for( Bu::StrList::const_iterator i = lPath.begin(); i; i++ ) | ||
193 | { | ||
194 | if( !(i+1) ) | ||
195 | break; | ||
196 | cur = cur->getChild( *i ); | ||
197 | } | ||
198 | |||
199 | return cur->getProperty( lPath.last() ); | ||
200 | } | ||
201 | |||