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. | |
Config | currentChild () |
Return a Config reference to the current map entry. | |
QString | currentKey () |
Return the name of the current map entry. | |
bool | isValid () |
Return true if the iterator currently points to a valid entry, false if not. | |
void | start () |
Resets the iterator to the start of the map. | |
Private Member Functions | |
MapIterator () | |
Private constructor enforces that MapIterators are only made by their friend the Config class. | |
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.
rviz::Config::MapIterator::MapIterator | ( | ) | [private] |
Private constructor enforces that MapIterators are only made by their friend the Config class.
Definition at line 352 of file config.cpp.
void rviz::Config::MapIterator::advance | ( | ) |
Advance iterator to next entry.
Definition at line 356 of file config.cpp.
Return a Config reference to the current map entry.
Definition at line 412 of file config.cpp.
QString rviz::Config::MapIterator::currentKey | ( | ) |
Return the name of the current map entry.
Definition at line 402 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 374 of file config.cpp.
void rviz::Config::MapIterator::start | ( | ) |
Resets the iterator to the start of the map.
Definition at line 391 of file config.cpp.
QMap<QString, Config::NodePtr>::const_iterator rviz::Config::MapIterator::iterator_ [private] |
bool rviz::Config::MapIterator::iterator_valid_ [private] |