Siena Fast Forwarding Documentation (v. 1.9.4)

siena::string_t::iterator Class Reference

iterator type for string_t. More...

#include <types.h>

List of all members.

Public Member Functions

 iterator (const iterator &i) throw ()
 constructs an iterator which is the copy of the given one.
bool operator< (const iterator &i) const throw ()
 comparison operator for string iterators
bool operator<= (const iterator &i) const throw ()
 comparison operator for string iterators
bool operator> (const iterator &i) const throw ()
 comparison operator for string iterators
bool operator>= (const iterator &i) const throw ()
 comparison operator for string iterators
bool operator== (const iterator &i) const throw ()
 equality operator for string iterators
bool operator!= (const iterator &i) const throw ()
 inequality operator for string iterators
iteratoroperator= (const iterator &i) throw ()
 assignment operator for string iterators
const char & operator* () const throw ()
 dereferencing operator for string iterators
const char & operator[] (int n) const throw ()
 dereferencing operator for string iterators
iteratoroperator+= (int n) throw ()
 in-place addition operator for string iterators
iterator operator+ (int n) const throw ()
 addition operator for string iterators
iteratoroperator++ () throw ()
 preincrement operator for string iterators
iterator operator++ (int) throw ()
 postincrement operator for string iterators
iteratoroperator-= (int n) throw ()
 in-place subtraction operator for string iterators
iterator operator- (int n) const throw ()
 subtraction operator for string iterators
int operator- (const iterator &i) const throw ()
 difference operator for string iterators
iteratoroperator-- () throw ()
 predecrement operator for string iterators
iterator operator-- (int) throw ()
 postdecrement operator for string iterators
int at_end () const throw ()
 return whether the iterator points to the end of the string.
int index () const throw ()
 get the relative position of the iterator in the string.
void set_index (int index) throw ()
 set the relative position of the iterator in the string.

Static Public Member Functions

static iterator begin (const string_t &s) throw ()
 constructs an iterator pointing to the beginning of the given string.
static iterator end (const string_t &s) throw ()
 constructs an iterator pointing past the end of the given string.

Detailed Description

iterator type for string_t.

an iterator behaves like a pointer, and as such it can be dereferenced, incremented, compared, etc. However, iterators are also specialized for strings and provide a few utility methods, for example to retrieve the distance between an iterator and the start of its corresponding string_t, or to determine whether the end of the string has been reached.

string_ts are immutable strings, so this type implements a const iterator.


Member Function Documentation

int siena::string_t::iterator::index (  )  const throw () [inline]

get the relative position of the iterator in the string.

returns how many characters the iterator is far from the beginning of the string.

References siena::string_t::begin.

Referenced by set_index().

bool siena::string_t::iterator::operator!= ( const iterator i  )  const throw () [inline]

inequality operator for string iterators

returns false iff the LHS iterator points at the same place as the RHS.

const char& siena::string_t::iterator::operator* (  )  const throw () [inline]

dereferencing operator for string iterators

returns a const lvalue for the character pointed to by the iterator.

int siena::string_t::iterator::operator- ( const iterator i  )  const throw () [inline]

difference operator for string iterators

returns this->index () - i.index () if the two iterators belong to the same string; the result is otherwise undefined.

bool siena::string_t::iterator::operator< ( const iterator i  )  const throw () [inline]

comparison operator for string iterators

returns true if the LHS iterator points earlier than RHS in the same string; the return value is undefined if the iterators do not belong to the same string.

bool siena::string_t::iterator::operator<= ( const iterator i  )  const throw () [inline]

comparison operator for string iterators

returns true if the LHS iterator points no later than RHS in the same string; the return value is undefined if the iterators do not belong to the same string.

bool siena::string_t::iterator::operator== ( const iterator i  )  const throw () [inline]

equality operator for string iterators

returns true iff the LHS iterator points at the same place as the RHS.

bool siena::string_t::iterator::operator> ( const iterator i  )  const throw () [inline]

comparison operator for string iterators

returns true if the LHS iterator points later than RHS in the same string; the return value is undefined if the iterators do not belong to the same string.

bool siena::string_t::iterator::operator>= ( const iterator i  )  const throw () [inline]

comparison operator for string iterators

returns true if the LHS iterator points earlier than RHS in the same string; the return value is undefined if the iterators do not belong to the same string.

const char& siena::string_t::iterator::operator[] ( int  n  )  const throw () [inline]

dereferencing operator for string iterators

returns a const lvalue for the character pointed to by the iterator *this + n.

void siena::string_t::iterator::set_index ( int  index  )  throw () [inline]

set the relative position of the iterator in the string.

moves the iterator index characters past the beginning of the string.

References siena::string_t::begin, and index().


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