wibble  1.1
Classes | Public Member Functions | List of all members
wibble::Splitter Class Reference

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

#include <regexp.h>

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...
 

Public Member Functions

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

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));

Constructor & Destructor Documentation

◆ Splitter()

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

◆ begin()

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

Split the string and iterate the resulting tokens.

References wibble::Regexp::re.

Referenced by wibble::net::http::Params::parse_multipart(), and wibble::net::http::Request::read_method().

◆ end()

const_iterator wibble::Splitter::end ( )
inline

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