Source-highlight Library
regexhighlightrule.h
1 //
2 // Author: Lorenzo Bettini <http://www.lorenzobettini.it>, (C) 2004-2008
3 //
4 // Copyright: See COPYING file that comes with this distribution
5 //
6 
7 #ifndef REGEXHIGHLIGHTRULE_H_
8 #define REGEXHIGHLIGHTRULE_H_
9 
10 #include "highlightrule.h"
11 
12 #include <boost/regex.hpp>
13 
14 namespace srchilite {
15 
21  boost::regex regExp;
22 public:
26  RegexHighlightRule(const std::string &s);
27 
32  RegexHighlightRule(const std::string &name, const std::string &s);
33  virtual ~RegexHighlightRule();
34 
35  virtual bool tryToMatch(std::string::const_iterator start,
36  std::string::const_iterator end, HighlightToken &token,
37  const MatchingParameters &params);
38 
39  virtual const std::string toString() const;
40 
41  virtual void replaceReferences(const ReplacementList &rep);
42 
43  virtual HighlightRule *clone();
44 
45  void setRegExp(const std::string &s);
46 };
47 
48 }
49 
50 #endif /*REGEXHIGHLIGHTRULE_H_*/
Structure for passing parameters to the matching algorithm, for instance, "not beginning of line"...
Definition: matchingparameters.h:16
boost::regex regExp
the regular expression for the rule
Definition: regexhighlightrule.h:21
C++ class: doctemplate.h.
Definition: bufferedoutput.cpp:13
virtual HighlightRule * clone()
Definition: regexhighlightrule.cpp:87
An implementation of HighlightRule using Boost regex library.
Definition: regexhighlightrule.h:19
virtual bool tryToMatch(std::string::const_iterator start, std::string::const_iterator end, HighlightToken &token, const MatchingParameters &params)
Try to match this rule against the passed string.
Definition: regexhighlightrule.cpp:35
Base class for highlight rules.
Definition: highlightrule.h:27
std::vector< std::string > ReplacementList
the values for replacing references (it should contain 9 possibly empty elements, because 9 is usuall...
Definition: highlightstate.h:36
Token containing information for performing the highlight.
Definition: highlighttoken.h:33
virtual void replaceReferences(const ReplacementList &rep)
Performs replacement of references in this rule.
Definition: regexhighlightrule.cpp:83
RegexHighlightRule(const std::string &s)
Definition: regexhighlightrule.cpp:21