activemq::util::StringTokenizer Class Reference

#include <StringTokenizer.h>

List of all members.

Public Member Functions

 StringTokenizer (const std::string &str, const std::string &delim=" \t\n\r\f", bool returnDelims=false)
virtual ~StringTokenizer (void)
virtual int countTokens (void) const
virtual bool hasMoreTokens (void) const
virtual std::string nextToken (void) throw ( exceptions::NoSuchElementException )
virtual std::string nextToken (const std::string &delim) throw ( exceptions::NoSuchElementException )
virtual unsigned int toArray (std::vector< std::string > &array)
virtual void reset (const std::string &str="", const std::string &delim="", bool returnDelims=false)

Private Attributes

std::string str
std::string delim
std::string::size_type pos
bool returnDelims


Constructor & Destructor Documentation

StringTokenizer::StringTokenizer const std::string &  str,
const std::string &  delim = " \t\n\r\f",
bool  returnDelims = false
 

Constructs a string tokenizer for the specified string. All characters in the delim argument are the delimiters for separating tokens.

If the returnDelims flag is true, then the delimiter characters are also returned as tokens. Each delimiter is returned as a string of length one. If the flag is false, the delimiter characters are skipped and only serve as separators between tokens.

Note that if delim is "", this constructor does not throw an exception. However, trying to invoke other methods on the resulting StringTokenizer may result in an Exception.

Parameters:
string to tokenize
String containing the delimiters
boolean indicating if the delimiters are returned as tokens

StringTokenizer::~StringTokenizer void   )  [virtual]
 


Member Function Documentation

int StringTokenizer::countTokens void   )  const [virtual]
 

Calculates the number of times that this tokenizer's nextToken method can be called before it generates an exception. The current position is not advanced.

Returns:
Count of remaining tokens

bool StringTokenizer::hasMoreTokens void   )  const [virtual]
 

Tests if there are more tokens available from this tokenizer's string.

Returns:
true if there are more tokens remaining

std::string StringTokenizer::nextToken const std::string &  delim  )  throw ( exceptions::NoSuchElementException ) [virtual]
 

Returns the next token in this string tokenizer's string. First, the set of characters considered to be delimiters by this StringTokenizer object is changed to be the characters in the string delim. Then the next token in the string after the current position is returned. The current position is advanced beyond the recognized token. The new delimiter set remains the default after this call.

Parameters:
string containing the new set of delimiters
Returns:
next string in the token list
Exceptions:
NoSuchElementException 

std::string StringTokenizer::nextToken void   )  throw ( exceptions::NoSuchElementException ) [virtual]
 

Returns the next token from this string tokenizer.

Returns:
string value of next token NoSuchElementException

void StringTokenizer::reset const std::string &  str = "",
const std::string &  delim = "",
bool  returnDelims = false
[virtual]
 

Resets the Tokenizer's position in the String to the Beginning calls to countToken and nextToken now start back at the beginning. This allows this object to be reused, the caller need not create a new instance every time a String needs tokenizing. If set the string param will reset the string that this Tokenizer is working on. If set to "" no change is made. If set the delim param will reset the string that this Tokenizer is using to tokenizer the string. If set to "", no change is made If set the return Delims will set if this Tokenizer will return delimiters as tokens. Defaults to false.

Parameters:
New String to tokenize or "", defaults to ""
New Delimiter String to use or "", defaults to ""
Should the Tokenizer return delimiters as Tokens, default false

unsigned int StringTokenizer::toArray std::vector< std::string > &  array  )  [virtual]
 

Grab all remaining tokens in the String and return them in the vector that is passed in by reference.

Parameters:
vector to place token strings in
Returns:
number of string placed into the vector


Member Data Documentation

std::string activemq::util::StringTokenizer::delim [private]
 

std::string::size_type activemq::util::StringTokenizer::pos [private]
 

bool activemq::util::StringTokenizer::returnDelims [private]
 

std::string activemq::util::StringTokenizer::str [private]
 


The documentation for this class was generated from the following files:
Generated on Thu Aug 3 18:03:33 2006 for activemq-cpp by  doxygen 1.4.5