Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
rviz::Config::MapIterator Class Reference

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
 

Detailed Description

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.

Definition at line 282 of file config.h.

Constructor & Destructor Documentation

rviz::Config::MapIterator::MapIterator ( )
private

Private constructor enforces that MapIterators are only made by their friend the Config class.

Definition at line 363 of file config.cpp.

Member Function Documentation

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.

Friends And Related Function Documentation

friend class Config
friend

Definition at line 310 of file config.h.

Member Data Documentation

QMap<QString, Config::NodePtr>::const_iterator rviz::Config::MapIterator::iterator_
private

Definition at line 308 of file config.h.

bool rviz::Config::MapIterator::iterator_valid_
private

Definition at line 309 of file config.h.

Config::NodePtr rviz::Config::MapIterator::node_
private

Definition at line 307 of file config.h.


The documentation for this class was generated from the following files:


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Wed Aug 28 2019 04:01:52