wibble::Splitter Class Reference

#include <regexp.h>

Collaboration diagram for wibble::Splitter:

Collaboration graph
[legend]

List of all members.


Detailed Description

Split a string using a regular expression to match the token separators.

This does a similar work to the split functions of perl, python and ruby.

Example code:

   utils::Splitter splitter("[ \t]*,[ \t]*", REG_EXTENDED);
   vector<string> split;
   std::copy(splitter.begin(myString), splitter.end(), back_inserter(split));

Public Member Functions

 Splitter (const std::string &re, int flags)
 Create a splitter that uses the given regular expression to find tokens.
const_iterator begin (const std::string &str)
 Split the string and iterate the resulting tokens.
const_iterator end ()

Classes

class  const_iterator
 Warning: the various iterators reuse the Regexps and therefore only one iteration of a Splitter can be done at a given time. More...

Constructor & Destructor Documentation

wibble::Splitter::Splitter ( const std::string &  re,
int  flags 
) [inline]

Create a splitter that uses the given regular expression to find tokens.


Member Function Documentation

const_iterator wibble::Splitter::begin ( const std::string &  str  )  [inline]

Split the string and iterate the resulting tokens.

References wibble::Regexp::re.

const_iterator wibble::Splitter::end (  )  [inline]

References wibble::Regexp::re.


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

Generated on Tue Mar 11 11:34:38 2008 for wibble by  doxygen 1.5.5