Public Member Functions | Private Attributes
Poco::TextIterator Class Reference

#include <TextIterator.h>

List of all members.

Public Member Functions

bool operator!= (const TextIterator &it) const
 Compares two iterators for equality.
int operator* () const
 Swaps the iterator with another one.
TextIteratoroperator++ ()
TextIterator operator++ (int)
 Prefix increment operator.
TextIteratoroperator= (const TextIterator &it)
 Copy constructor.
bool operator== (const TextIterator &it) const
 Postfix increment operator.
void swap (TextIterator &it)
 Assignment operator.
 TextIterator ()
 TextIterator (const std::string &str, const TextEncoding &encoding)
 Creates an uninitialized TextIterator.
 TextIterator (const std::string::const_iterator &begin, const std::string::const_iterator &end, const TextEncoding &encoding)
 TextIterator (const std::string &str)
 TextIterator (const std::string::const_iterator &end)
 Creates an end TextIterator for the given string.
 TextIterator (const TextIterator &it)
 Destroys the TextIterator.
 ~TextIterator ()
 Creates an end TextIterator.

Private Attributes

std::string::const_iterator _end
std::string::const_iterator _it
const TextEncoding_pEncoding
 Compares two iterators for inequality.

Detailed Description

An unidirectional iterator for iterating over characters in a string. The TextIterator uses a TextEncoding object to work with multi-byte character encodings like UTF-8. Characters are reported in Unicode.

Example: Count the number of UTF-8 characters in a string.

UTF8Encoding utf8Encoding; std::string utf8String("...."); TextIterator it(utf8String, utf8Encoding); TextIterator end(utf8String); int n = 0; while (it != end) { ++n; ++it; }

NOTE: When an UTF-16 encoding is used, surrogate pairs will be reported as two separate characters, due to restrictions of the TextEncoding class.

Definition at line 52 of file TextIterator.h.


Constructor & Destructor Documentation

Definition at line 45 of file TextIterator.cpp.

Poco::TextIterator::TextIterator ( const std::string &  str,
const TextEncoding encoding 
)

Creates an uninitialized TextIterator.

Definition at line 51 of file TextIterator.cpp.

Poco::TextIterator::TextIterator ( const std::string::const_iterator &  begin,
const std::string::const_iterator &  end,
const TextEncoding encoding 
)

Creates a TextIterator for the given string. The encoding object must not be deleted as long as the iterator is in use.

Definition at line 58 of file TextIterator.cpp.

Poco::TextIterator::TextIterator ( const std::string &  str)

Creates a TextIterator for the given range. The encoding object must not be deleted as long as the iterator is in use.

Definition at line 66 of file TextIterator.cpp.

Poco::TextIterator::TextIterator ( const std::string::const_iterator &  end)

Creates an end TextIterator for the given string.

Definition at line 74 of file TextIterator.cpp.

Creates an end TextIterator.

Definition at line 82 of file TextIterator.cpp.

Destroys the TextIterator.

Definition at line 87 of file TextIterator.cpp.


Member Function Documentation

bool Poco::TextIterator::operator!= ( const TextIterator it) const [inline]

Compares two iterators for equality.

Definition at line 136 of file TextIterator.h.

int Poco::TextIterator::operator* ( ) const

Swaps the iterator with another one.

Definition at line 115 of file TextIterator.cpp.

TextIterator & Poco::TextIterator::operator++ ( )

Returns the Unicode value of the current character. If there is no valid character at the current position, -1 is returned.

Definition at line 138 of file TextIterator.cpp.

TextIterator Poco::TextIterator::operator++ ( int  )

Prefix increment operator.

Definition at line 154 of file TextIterator.cpp.

TextIterator & Poco::TextIterator::operator= ( const TextIterator it)

Copy constructor.

Definition at line 95 of file TextIterator.cpp.

bool Poco::TextIterator::operator== ( const TextIterator it) const [inline]

Postfix increment operator.

Definition at line 130 of file TextIterator.h.

Assignment operator.

Definition at line 107 of file TextIterator.cpp.


Member Data Documentation

std::string::const_iterator Poco::TextIterator::_end [private]

Definition at line 123 of file TextIterator.h.

std::string::const_iterator Poco::TextIterator::_it [private]

Definition at line 122 of file TextIterator.h.

Compares two iterators for inequality.

Definition at line 121 of file TextIterator.h.


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


pluginlib
Author(s): Tully Foote and Eitan Marder-Eppstein
autogenerated on Sat Dec 28 2013 17:20:20