Siena Fast Forwarding Documentation (v. 2.0.1)
Public Member Functions | List of all members
siena::TagSet::Iterator Class Referenceabstract

iterator for a tag set. More...

#include <tags.h>

Inheritance diagram for siena::TagSet::Iterator:
Inheritance graph
[legend]
Collaboration diagram for siena::TagSet::Iterator:
Collaboration graph
[legend]

Public Member Functions

virtual bool next ()=0
 moves this iterator to the next tag in the set. More...
 
virtual ~Iterator ()
 iterator destructor.
 
- Public Member Functions inherited from siena::Tag
virtual ~Tag ()
 virtual destructor.
 
virtual std::string to_string () const =0
 string value of this tag. More...
 
virtual std::string & to_string (std::string &) const =0
 string value of this tag. More...
 

Detailed Description

iterator for a tag set.

An iterator in a tag set represents a tag directly, in the sense that it is itself a tag reference, and it can also be switched to refer to the next tag in the set. The iteration order is implementation-dependent.

The following example shows how to iterate through a tag set:

#include <siena/tags.h>
//... implementation of the siena/tags objects
SimpleTagSet ts;
// ...
siena::TagSet::Iterator * i = ts.first();
if (i != 0) {
do {
std::cout << i->to_string() << std::endl;
} while(i->next());
delete(i);
}

Notice that iterators must be explicitly deallocated.

Examples:
simple_tags_types.cc, and simple_tags_types.h.

Member Function Documentation

virtual bool siena::TagSet::Iterator::next ( )
pure virtual

moves this iterator to the next tag in the set.

Returns
true if the element pointed to by this iterator before this call to next() is not the last tag in its tag set. In this case, after this call to next(), this iterator will point to the next tag.
false if the element pointed to by this iterator before this call to next() is either the the last tag in its tag set, or an invalid tag. In this case, after this call to next(), this iterator will point to an invalid tag.