ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Common::StringTokenizer Class Reference

A simple non-optimized string tokenizer. More...

#include <tokenizer.h>

Collaboration diagram for Common::StringTokenizer:

List of all members.

Public Member Functions

 StringTokenizer (const String &str, const String &delimiters=" \t\r\n\f\v")
 Creates a StringTokenizer.
void reset ()
 Resets the tokenizer to its initial state.
bool empty () const
 Returns true if there are no more tokens left in the string, false otherwise.
String nextToken ()
 Returns the next token from the string (Or an empty string if there are no more tokens).

Private Attributes

const String _str
 The string to be tokenized.
const String _delimiters
 String containing all the delimiter characters.
uint _tokenBegin
 Latest found token's begin (Valid after a call to nextToken(), zero otherwise).
uint _tokenEnd
 Latest found token's end (Valid after a call to nextToken(), zero otherwise).

Detailed Description

A simple non-optimized string tokenizer.

Example of use: StringTokenizer("Now, this is a test!", " ,!") gives tokens "Now", "this", "is", "a" and "test" using nextToken().

Definition at line 37 of file tokenizer.h.


Constructor & Destructor Documentation

Common::StringTokenizer::StringTokenizer ( const String str,
const String delimiters = " \t\r\n\f\v" 
)

Creates a StringTokenizer.

Parameters:
str The string to be tokenized.
delimiters String containing all the delimiter characters (i.e. the characters to be ignored).
Note:
Uses space, horizontal tab, carriage return, newline, form feed and vertical tab as delimiters by default.

Definition at line 27 of file tokenizer.cpp.


Member Function Documentation

bool Common::StringTokenizer::empty (  )  const

Returns true if there are no more tokens left in the string, false otherwise.

Definition at line 35 of file tokenizer.cpp.

String Common::StringTokenizer::nextToken (  ) 

Returns the next token from the string (Or an empty string if there are no more tokens).

Definition at line 45 of file tokenizer.cpp.

void Common::StringTokenizer::reset (  ) 

Resets the tokenizer to its initial state.

Definition at line 31 of file tokenizer.cpp.


Member Data Documentation

String containing all the delimiter characters.

Definition at line 52 of file tokenizer.h.

The string to be tokenized.

Definition at line 51 of file tokenizer.h.

Latest found token's begin (Valid after a call to nextToken(), zero otherwise).

Definition at line 53 of file tokenizer.h.

Latest found token's end (Valid after a call to nextToken(), zero otherwise).

Definition at line 54 of file tokenizer.h.


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


Generated on Sat Nov 16 2019 05:02:53 for ResidualVM by doxygen 1.7.1
curved edge   curved edge