strusBase  0.17
Public Member Functions | List of all members
strus::RegexSubst Class Reference

Class to replace a regular expression by a string with sub-matches as substitute. More...

#include <regex.hpp>

Public Member Functions

 RegexSubst (const std::string &expression, const std::string &fmtstring, ErrorBufferInterface *errhnd_)
 Constructor. More...
 
 ~RegexSubst ()
 Destructor. More...
 
bool exec (std::string &out, const std::string &input) const
 Execute the replacement. More...
 
bool exec (std::string &out, const char *src, std::size_t srcsize) const
 Execute the replacement. More...
 
const char * error () const
 

Detailed Description

Class to replace a regular expression by a string with sub-matches as substitute.

Constructor & Destructor Documentation

strus::RegexSubst::RegexSubst ( const std::string &  expression,
const std::string &  fmtstring,
ErrorBufferInterface errhnd_ 
)

Constructor.

Parameters
[in]expressionregular expression string (POSIX)
[in]fmtstringformat string for output with '$0' ... '$9' as substitutes for the results
strus::RegexSubst::~RegexSubst ( )

Destructor.

Member Function Documentation

const char* strus::RegexSubst::error ( ) const
Parameters
[in]Getthe last error in the constructor
bool strus::RegexSubst::exec ( std::string &  out,
const std::string &  input 
) const

Execute the replacement.

Parameters
[out]outoutput string
[in]inputinput string
Returns
bool true on success, false on failure, error code or message is not provided
bool strus::RegexSubst::exec ( std::string &  out,
const char *  src,
std::size_t  srcsize 
) const

Execute the replacement.

Parameters
[out]outoutput string
[in]srcpointer to input string
[in]srcsizesizeof src in bytes
Returns
bool true on success, false on failure, error code or message is not provided

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