Source-highlight Library
srchilite::RegexRanges Class Reference

Stores possible separators implemented as regular expressions and provides functionalities to search for such occurrences in lines. More...

#include <regexranges.h>

Collaboration diagram for srchilite::RegexRanges:

Public Types

typedef std::list< boost::regex > RegexRangesType
 

Public Member Functions

bool addRegexRange (const std::string &s)
 Adds a regular expression range, specified by the passed string. More...
 
void clear ()
 Removes all the added expressions.
 
const boost::regex * matches (const std::string &line)
 Checks whether one of the stored regular expression can be found in the passed string line. More...
 
bool isInRange (const std::string &line)
 
void reset ()
 The next isInRange search will start from the first element of the list. More...
 

Private Attributes

RegexRangesType ranges
 the actual collection of regular expressions for ranges
 
const boost::regex * currentRegex
 if set, it represents the matched regular expression up to now. More...
 

Detailed Description

Stores possible separators implemented as regular expressions and provides functionalities to search for such occurrences in lines.

Member Function Documentation

bool srchilite::RegexRanges::addRegexRange ( const std::string &  s)

Adds a regular expression range, specified by the passed string.

Parameters
sthe string representation of the regular expression
Returns
true if the passed string is a valid regular expression, false otherwise
bool srchilite::RegexRanges::isInRange ( const std::string &  line)
Parameters
linethe line to inspect
Returns
whether the passed line is in range
const boost::regex * srchilite::RegexRanges::matches ( const std::string &  line)

Checks whether one of the stored regular expression can be found in the passed string line.

Parameters
line
Returns
the matched regular expression or 0 if none was found
void srchilite::RegexRanges::reset ( )
inline

The next isInRange search will start from the first element of the list.

This should be called before searching for lines of a file, that we started to process.

Member Data Documentation

const boost::regex* srchilite::RegexRanges::currentRegex
private

if set, it represents the matched regular expression up to now.

This is used internally: if we're searching for a range, the first time we find a matching expression, we found the beginning of the range. The end of the range will be found when we match again the previously matched expression.


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