A const iterator class for accessing multiple values of an attribute. More...
#include <MessageAttributes.h>
Public Member Functions | |
AttributeIterator () | |
const std::string & | operator* () const |
const std::string * | operator-> () const |
const std::string & | key (void) const |
const AttributeIterator & | operator++ () |
AttributeIterator | operator++ (int) |
bool | hasMore () const |
Protected Member Functions | |
AttributeIterator (AttrConstIter begin, AttrConstIter end) | |
Protected Attributes | |
AttrConstIter | current_ |
AttrConstIter | end_ |
Friends | |
class | MessageAttributes |
A const iterator class for accessing multiple values of an attribute.
This is an iterator class that is used when accessing multiple values of an attribute. The getAll() method of the MessageAttributes class returns an AttributeIterator object that can be used to access the values of the attribute.
Typical usage is:
MessageAttributes attributes; ... for (AttributeIterator iterator=attributes.getAll("Foo:Bar"); iterator.hasMore(); ++iterator) std::cout << *iterator << std::endl;
Arc::AttributeIterator::AttributeIterator | ( | ) |
Default constructor.
The default constructor. Does nothing since all attributes are instances of well-behaving STL classes.
Arc::AttributeIterator::AttributeIterator | ( | AttrConstIter | begin, | |
AttrConstIter | end | |||
) | [protected] |
Protected constructor used by the MessageAttributes class.
This constructor is used to create an iterator for iteration over all values of an attribute. It is not supposed to be visible externally, but is only used from within the getAll() method of MessageAttributes class.
begin | A const_iterator pointing to the first matching key-value pair in the internal multimap of the MessageAttributes class. | |
end | A const_iterator pointing to the first key-value pair in the internal multimap of the MessageAttributes class where the key is larger than the key searched for. |
bool Arc::AttributeIterator::hasMore | ( | ) | const |
Predicate method for iteration termination.
This method determines whether there are more values for the iterator to refer to.
const std::string& Arc::AttributeIterator::key | ( | void | ) | const |
The key of attribute.
This method returns reference to key of attribute to which iterator refers.
const std::string& Arc::AttributeIterator::operator* | ( | ) | const |
The dereference operator.
This operator is used to access the current value referred to by the iterator.
AttributeIterator Arc::AttributeIterator::operator++ | ( | int | ) |
The postfix advance operator.
Advances the iterator to the next value. Works intuitively.
const AttributeIterator& Arc::AttributeIterator::operator++ | ( | ) |
The prefix advance operator.
Advances the iterator to the next value. Works intuitively.
const std::string* Arc::AttributeIterator::operator-> | ( | ) | const |
The arrow operator.
Used to call methods for value objects (strings) conveniently.
friend class MessageAttributes [friend] |
The MessageAttributes class is a friend.
The constructor that creates an AttributeIterator that is connected to the internal multimap of the MessageAttributes class should not be exposed to the outside, but it still needs to be accessible from the getAll() method of the MessageAttributes class. Therefore, that class is a friend.
AttrConstIter Arc::AttributeIterator::current_ [protected] |
A const_iterator pointing to the current key-value pair.
This iterator is the internal representation of the current value. It points to the corresponding key-value pair in the internal multimap of the MessageAttributes class.
AttrConstIter Arc::AttributeIterator::end_ [protected] |
A const_iterator pointing beyond the last key-value pair.
A const_iterator pointing to the first key-value pair in the internal multimap of the MessageAttributes class where the key is larger than the key searched for.