ucommon  7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc..
  Fossies Dox: ucommon-7.0.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Loading...
Searching...
No Matches
ost::StringTokenizer::iterator Class Reference

The input forward iterator for tokens. More...

#include <tokenizer.h>

Collaboration diagram for ost::StringTokenizer::iterator:
[legend]

Public Member Functions

 iterator ()
 
virtual ~iterator ()
 
 iterator (const iterator &i)
 copy constructor. More...
 
iteratoroperator= (const iterator &i)
 assignment operator. More...
 
iteratoroperator++ () THROWS(NoSuchElementException)
 shifts this iterator to the next token in the string. More...
 
const char * operator* () THROWS(NoSuchElementException)
 returns the immutable string this iterator points to or '0' if no token is available (i.e. More...
 
char nextDelimiter () const
 returns the next delimiter after the current token or '\0', if there are no following delimiters. More...
 
bool operator== (const iterator &other) const
 compares to other iterator. More...
 
bool operator!= (const iterator &other) const
 compares to other iterator. More...
 

Private Member Functions

 iterator (const StringTokenizer &tok, const char *end)
 
 iterator (const StringTokenizer &tok)
 

Private Attributes

const StringTokenizermyTok
 
const char * start
 
const char * tokEnd
 
const char * endp
 
char * token
 

Friends

class StringTokenizer
 

Detailed Description

The input forward iterator for tokens.

Author
Henner Zeller

Definition at line 129 of file tokenizer.h.

Constructor & Destructor Documentation

◆ iterator() [1/4]

ost::StringTokenizer::iterator::iterator ( const StringTokenizer tok,
const char *  end 
)
inlineprivate

Definition at line 139 of file tokenizer.h.

◆ iterator() [2/4]

ost::StringTokenizer::iterator::iterator ( const StringTokenizer tok)
inlineprivate

Definition at line 142 of file tokenizer.h.

References ucommon::str().

Here is the call graph for this function:

◆ iterator() [3/4]

ost::StringTokenizer::iterator::iterator ( )
inline

Definition at line 148 of file tokenizer.h.

◆ ~iterator()

virtual ost::StringTokenizer::iterator::~iterator ( )
inlinevirtual

Definition at line 151 of file tokenizer.h.

◆ iterator() [4/4]

ost::StringTokenizer::iterator::iterator ( const iterator i)
inline

copy constructor.

Definition at line 158 of file tokenizer.h.

Member Function Documentation

◆ nextDelimiter()

char ost::StringTokenizer::iterator::nextDelimiter ( ) const
inline

returns the next delimiter after the current token or '\0', if there are no following delimiters.

It returns the very next delimiter (even if skipAllDelim=true).

Definition at line 196 of file tokenizer.h.

◆ operator!=()

bool ost::StringTokenizer::iterator::operator!= ( const iterator other) const
inline

compares to other iterator.

Usually used to compare against the end() iterator.

Definition at line 212 of file tokenizer.h.

References endp.

◆ operator*()

const char * ost::StringTokenizer::iterator::operator* ( )

returns the immutable string this iterator points to or '0' if no token is available (i.e.

i == end()). Do not store pointers to this token, since it is invalidated for each iteration. If you need the token, copy it (e.g. with strdup());

Definition at line 109 of file tokenizer.cpp.

References ost::newString(), ost::StringTokenizer::SPACE, and THROW.

Here is the call graph for this function:

◆ operator++()

StringTokenizer::iterator & ost::StringTokenizer::iterator::operator++ ( )

shifts this iterator to the next token in the string.

Definition at line 73 of file tokenizer.cpp.

References ost::StringTokenizer::delim, endp, ost::StringTokenizer::itEnd, myTok, ost::StringTokenizer::skipAll, start, THROW, token, and tokEnd.

◆ operator=()

iterator & ost::StringTokenizer::iterator::operator= ( const iterator i)
inline

assignment operator.

Definition at line 166 of file tokenizer.h.

References endp, myTok, start, and tokEnd.

◆ operator==()

bool ost::StringTokenizer::iterator::operator== ( const iterator other) const
inline

compares to other iterator.

Usually used to compare against the end() iterator.

Definition at line 204 of file tokenizer.h.

References endp.

Friends And Related Function Documentation

◆ StringTokenizer

friend class StringTokenizer
friend

Definition at line 130 of file tokenizer.h.

Member Data Documentation

◆ endp

const char* ost::StringTokenizer::iterator::endp
private

Definition at line 135 of file tokenizer.h.

Referenced by operator!=(), operator++(), operator=(), and operator==().

◆ myTok

const StringTokenizer* ost::StringTokenizer::iterator::myTok
private

Definition at line 132 of file tokenizer.h.

Referenced by operator++(), and operator=().

◆ start

const char* ost::StringTokenizer::iterator::start
private

Definition at line 133 of file tokenizer.h.

Referenced by operator++(), and operator=().

◆ token

char* ost::StringTokenizer::iterator::token
private

Definition at line 136 of file tokenizer.h.

Referenced by operator++().

◆ tokEnd

const char* ost::StringTokenizer::iterator::tokEnd
private

Definition at line 134 of file tokenizer.h.

Referenced by operator++(), and operator=().


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