Arc::AttributeIterator Class Reference

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 AttributeIteratoroperator++ ()
AttributeIterator operator++ (int)
bool hasMore () const

Protected Member Functions

 AttributeIterator (AttrConstIter begin, AttrConstIter end)

Protected Attributes

AttrConstIter current_
AttrConstIter end_

Friends

class MessageAttributes

Detailed Description

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;

Constructor & Destructor Documentation

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.

Parameters:
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.

Member Function Documentation

bool Arc::AttributeIterator::hasMore (  )  const

Predicate method for iteration termination.

This method determines whether there are more values for the iterator to refer to.

Returns:
Returns true if there are more values, otherwise false.
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.

Returns:
A (constant reference to a) string representation of the current value.
AttributeIterator Arc::AttributeIterator::operator++ ( int   ) 

The postfix advance operator.

Advances the iterator to the next value. Works intuitively.

Returns:
An iterator referring to the value referred to by this iterator before the advance.
const AttributeIterator& Arc::AttributeIterator::operator++ (  ) 

The prefix advance operator.

Advances the iterator to the next value. Works intuitively.

Returns:
A const reference to this iterator.
const std::string* Arc::AttributeIterator::operator-> (  )  const

The arrow operator.

Used to call methods for value objects (strings) conveniently.


Friends And Related Function Documentation

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.


Field Documentation

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.

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.


The documentation for this class was generated from the following file:
Generated on Wed Jun 27 11:54:24 2012 for Hosting Environment (Daemon) by  doxygen 1.6.3