Iterator class for looping over all entries in a Map type Config Node. More...
#include <config.h>
Public Member Functions | |
void | advance () |
Advance iterator to next entry. More... | |
Config | currentChild () |
Return a Config reference to the current map entry. More... | |
QString | currentKey () |
Return the name of the current map entry. More... | |
bool | isValid () |
Return true if the iterator currently points to a valid entry, false if not. More... | |
void | start () |
Resets the iterator to the start of the map. More... | |
Private Member Functions | |
MapIterator () | |
Private constructor enforces that MapIterators are only made by their friend the Config class. More... | |
Private Attributes | |
QMap< QString, Config::NodePtr >::const_iterator | iterator_ |
bool | iterator_valid_ |
Config::NodePtr | node_ |
Friends | |
class | Config |
Iterator class for looping over all entries in a Map type Config Node.
Typical usage:
Config config; display->save( config ); // Write display's data into config. for( Config::MapIterator iter = config.mapIterator(); iter.isValid(); iter.advance() ) { QString key = iter.currentKey(); Config child = iter.currentChild(); printf( "key %s has value %s.\n", qPrintable( key ), qPrintable( child.getValue().toString() )); }
Maps are stored in alphabetical order of their keys, and MapIterator uses this same order.
|
private |
Private constructor enforces that MapIterators are only made by their friend the Config class.
Definition at line 363 of file config.cpp.
void rviz::Config::MapIterator::advance | ( | ) |
Advance iterator to next entry.
Definition at line 367 of file config.cpp.
Config rviz::Config::MapIterator::currentChild | ( | ) |
Return a Config reference to the current map entry.
Definition at line 423 of file config.cpp.
QString rviz::Config::MapIterator::currentKey | ( | ) |
Return the name of the current map entry.
Definition at line 413 of file config.cpp.
bool rviz::Config::MapIterator::isValid | ( | ) |
Return true if the iterator currently points to a valid entry, false if not.
This is how you tell if your loop over entries is at the end.
Definition at line 385 of file config.cpp.
void rviz::Config::MapIterator::start | ( | ) |
Resets the iterator to the start of the map.
Definition at line 402 of file config.cpp.
|
private |
|
private |