#include <regexhighlightrule.h>
Inherits srchilite::HighlightRule.
Public Member Functions | |
RegexHighlightRule (const std::string &s) | |
RegexHighlightRule (const std::string &name, const std::string &s) | |
virtual bool | tryToMatch (std::string::const_iterator start, std::string::const_iterator end, HighlightToken &token, const MatchingParameters ¶ms) |
Try to match this rule against the passed string. | |
virtual const std::string | toString () const |
virtual void | replaceReferences (const ReplacementList &rep) |
Performs replacement of references in this rule. | |
virtual HighlightRule * | clone () |
void | setRegExp (const std::string &s) |
virtual bool | tryToMatch (const std::string &s, HighlightToken &token, const MatchingParameters ¶ms) |
Try to match this rule against the passed string (implemented by calling the pure virtual function tryToMatch below). | |
const HighlightStatePtr | getNextState () const |
void | setNextState (HighlightStatePtr _nextState) |
void | addElem (const std::string &name) |
Adds an element name to the list of this rule. | |
const ElemList & | getElemList () const |
int | getExitLevel () const |
void | setExitLevel (int l) |
bool | isNested () const |
void | setNested (bool n) |
bool | getNeedsReferenceReplacement () const |
void | setNeedsReferenceReplacement (bool b=true) |
bool | getHasSubexpressions () const |
void | setHasSubexpressions (bool b=true) |
std::string | getAdditionalInfo () const |
void | setAdditionalInfo (const std::string &info) |
Private Attributes | |
boost::regex | regExp |
the regular expression for the rule |
srchilite::RegexHighlightRule::RegexHighlightRule | ( | const std::string & | s | ) |
s | the string representing the regular expression |
srchilite::RegexHighlightRule::RegexHighlightRule | ( | const std::string & | name, | |
const std::string & | s | |||
) |
name | the element name represented by this rule | |
s | the string representing the regular expression |
void srchilite::HighlightRule::addElem | ( | const std::string & | name | ) | [inherited] |
Adds an element name to the list of this rule.
name | the name to add |
HighlightRule * srchilite::RegexHighlightRule::clone | ( | ) | [virtual] |
void srchilite::RegexHighlightRule::replaceReferences | ( | const ReplacementList & | rep | ) | [virtual] |
Performs replacement of references in this rule.
the | list of values for the replacement; the first element is the value for replacing the first dynamic back reference, and so on. (it should contain 9 possibly empty elements) |
Implements srchilite::HighlightRule.
bool srchilite::HighlightRule::tryToMatch | ( | const std::string & | s, | |
HighlightToken & | token, | |||
const MatchingParameters & | params | |||
) | [virtual, inherited] |
Try to match this rule against the passed string (implemented by calling the pure virtual function tryToMatch below).
The passed token is assumed to be reset (i.e., no existing matching information is stored in it when passing it to this method).
s | the string for trying to match the rule | |
token | where results will be inserted, if the rule matched | |
params | additional arguments for the matching |
bool srchilite::RegexHighlightRule::tryToMatch | ( | std::string::const_iterator | start, | |
std::string::const_iterator | end, | |||
HighlightToken & | token, | |||
const MatchingParameters & | params | |||
) | [virtual] |
Try to match this rule against the passed string.
start | the beginning of the string for trying to match the rule | |
end | the beginning of the string for trying to match the rule | |
token | where results will be inserted, if the rule matched | |
params | additional arguments for the matching |
Implements srchilite::HighlightRule.