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 288 of file config.h.

Constructor & Destructor Documentation

◆ MapIterator()

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

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

Definition at line 375 of file config.cpp.

Member Function Documentation

◆ advance()

void rviz::Config::MapIterator::advance ( )

Advance iterator to next entry.

Definition at line 379 of file config.cpp.

◆ currentChild()

Config rviz::Config::MapIterator::currentChild ( )

Return a Config reference to the current map entry.

Definition at line 435 of file config.cpp.

◆ currentKey()

QString rviz::Config::MapIterator::currentKey ( )

Return the name of the current map entry.

Definition at line 425 of file config.cpp.

◆ isValid()

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 397 of file config.cpp.

◆ start()

void rviz::Config::MapIterator::start ( )

Resets the iterator to the start of the map.

Definition at line 414 of file config.cpp.

Friends And Related Function Documentation

◆ Config

friend class Config
friend

Definition at line 316 of file config.h.

Member Data Documentation

◆ iterator_

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

Definition at line 314 of file config.h.

◆ iterator_valid_

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

Definition at line 315 of file config.h.

◆ node_

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

Definition at line 313 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 Sat May 27 2023 02:06:25