Xapian::Utf8Iterator Class Reference

#include <unicode.h>

List of all members.

Public Types

typedef std::input_iterator_tag iterator_category
 We implement the semantics of an STL input_iterator.
typedef unsigned value_type
typedef size_t difference_type
typedef const unsigned * pointer
typedef const unsigned & reference

Public Member Functions

const char * raw () const
size_t left () const
void assign (const char *p_, size_t len)
void assign (const std::string &s)
 Utf8Iterator (const char *p_)
 Utf8Iterator (const char *p_, size_t len)
 Utf8Iterator (const std::string &s)
 Utf8Iterator ()
unsigned operator * () const
Utf8Iterator operator++ (int)
Utf8Iteratoroperator++ ()
bool operator== (const Utf8Iterator &other) const
bool operator!= (const Utf8Iterator &other) const


Detailed Description

An iterator which returns Unicode character values from a UTF-8 encoded string.


Member Typedef Documentation

typedef std::input_iterator_tag Xapian::Utf8Iterator::iterator_category

We implement the semantics of an STL input_iterator.


Constructor & Destructor Documentation

Xapian::Utf8Iterator::Utf8Iterator ( const char *  p_  )  [explicit]

Create an iterator given a pointer to a null terminated string.

The iterator will return characters from the start of the string when next called. The string is not copied into the iterator, so it must remain valid while the iteration is in progress.

Parameters:
p A pointer to the start of the null terminated string to read.

Xapian::Utf8Iterator::Utf8Iterator ( const char *  p_,
size_t  len 
) [inline]

Create an iterator given a pointer and a length.

The iterator will return characters from the start of the string when next called. The string is not copied into the iterator, so it must remain valid while the iteration is in progress.

Parameters:
p A pointer to the start of the string to read.
len The length of the string to read.

Xapian::Utf8Iterator::Utf8Iterator ( const std::string &  s  )  [inline]

Create an iterator given a string.

The iterator will return characters from the start of the string when next called. The string is not copied into the iterator, so it must remain valid while the iteration is in progress.

Parameters:
s The string to read. Must not be modified while the iteration is in progress.

Xapian::Utf8Iterator::Utf8Iterator (  )  [inline]

Create an iterator which is at the end of its iteration.

This can be compared to another iterator to check if the other iterator has reached its end.


Member Function Documentation

const char* Xapian::Utf8Iterator::raw (  )  const [inline]

Return the raw const char * pointer for the current position.

size_t Xapian::Utf8Iterator::left (  )  const [inline]

Return the number of bytes left in the iterator's buffer.

void Xapian::Utf8Iterator::assign ( const char *  p_,
size_t  len 
) [inline]

Assign a new string to the iterator.

The iterator will forget the string it was iterating through, and return characters from the start of the new string when next called. The string is not copied into the iterator, so it must remain valid while the iteration is in progress.

Parameters:
p A pointer to the start of the string to read.
len The length of the string to read.

void Xapian::Utf8Iterator::assign ( const std::string &  s  )  [inline]

Assign a new string to the iterator.

The iterator will forget the string it was iterating through, and return characters from the start of the new string when next called. The string is not copied into the iterator, so it must remain valid while the iteration is in progress.

Parameters:
s The string to read. Must not be modified while the iteration is in progress.

unsigned Xapian::Utf8Iterator::operator * (  )  const

Get the current Unicode character value pointed to by the iterator.

Returns unsigned(-1) if the iterator has reached the end of its buffer.

Utf8Iterator Xapian::Utf8Iterator::operator++ ( int   )  [inline]

Move forward to the next Unicode character.

Returns:
An iterator pointing to the position before the move.

Utf8Iterator& Xapian::Utf8Iterator::operator++ (  )  [inline]

Move forward to the next Unicode character.

Returns:
A reference to this object.

bool Xapian::Utf8Iterator::operator== ( const Utf8Iterator other  )  const [inline]

Test two Utf8Iterators for equality.

Returns:
true iff the iterators point to the same position.

bool Xapian::Utf8Iterator::operator!= ( const Utf8Iterator other  )  const [inline]

Test two Utf8Iterators for inequality.

Returns:
true iff the iterators do not point to the same position.


The documentation for this class was generated from the following file:
Documentation for Xapian (version 1.1.1).
Generated on 10 Jun 2009 by Doxygen 1.5.2.