iterator type for string_t.
More...
#include <types.h>
Public Member Functions | |
| iterator (const iterator &i) | |
| constructs an iterator which is the copy of the given one. | |
| bool | operator< (const iterator &i) const |
| comparison operator for string iterators More... | |
| bool | operator<= (const iterator &i) const |
| comparison operator for string iterators More... | |
| bool | operator> (const iterator &i) const |
| comparison operator for string iterators More... | |
| bool | operator>= (const iterator &i) const |
| comparison operator for string iterators More... | |
| bool | operator== (const iterator &i) const |
| equality operator for string iterators More... | |
| bool | operator!= (const iterator &i) const |
| inequality operator for string iterators More... | |
| iterator & | operator= (const iterator &i) |
| assignment operator for string iterators | |
| const char & | operator* () const |
| dereferencing operator for string iterators More... | |
| const char & | operator[] (int n) const |
| dereferencing operator for string iterators More... | |
| iterator & | operator+= (int n) |
| in-place addition operator for string iterators | |
| iterator | operator+ (int n) const |
| addition operator for string iterators | |
| iterator & | operator++ () |
| preincrement operator for string iterators | |
| iterator | operator++ (int) |
| postincrement operator for string iterators | |
| iterator & | operator-= (int n) |
| in-place subtraction operator for string iterators | |
| iterator | operator- (int n) const |
| subtraction operator for string iterators | |
| int | operator- (const iterator &i) const |
| difference operator for string iterators More... | |
| iterator & | operator-- () |
| predecrement operator for string iterators | |
| iterator | operator-- (int) |
| postdecrement operator for string iterators | |
| int | at_end () const |
| return whether the iterator points to the end of the string. | |
| int | index () const |
| get the relative position of the iterator in the string. More... | |
| void | set_index (int index) |
| set the relative position of the iterator in the string. More... | |
Static Public Member Functions | |
| static iterator | begin (const string_t &s) |
| constructs an iterator pointing to the beginning of the given string. | |
| static iterator | end (const string_t &s) |
| constructs an iterator pointing past the end of the given string. | |
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.
|
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().
|
inline |
inequality operator for string iterators
returns false iff the LHS iterator points at the same place as the RHS.
|
inline |
dereferencing operator for string iterators
returns a const lvalue for the character pointed to by the iterator.
|
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.
|
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.
|
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.
|
inline |
equality operator for string iterators
returns true iff the LHS iterator points at the same place as the RHS.
|
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.
|
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.
|
inline |
dereferencing operator for string iterators
returns a const lvalue for the character pointed to by the iterator *this + n.
|
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().