Source-highlight Library
|
00001 // 00002 // Author: Lorenzo Bettini <http://www.lorenzobettini.it>, (C) 2004-2008 00003 // 00004 // Copyright: See COPYING file that comes with this distribution 00005 // 00006 00007 #ifndef REGEXHIGHLIGHTRULE_H_ 00008 #define REGEXHIGHLIGHTRULE_H_ 00009 00010 #include "highlightrule.h" 00011 00012 #include <boost/regex.hpp> 00013 00014 namespace srchilite { 00015 00019 class RegexHighlightRule : public HighlightRule { 00021 boost::regex regExp; 00022 public: 00026 RegexHighlightRule(const std::string &s); 00027 00032 RegexHighlightRule(const std::string &name, const std::string &s); 00033 virtual ~RegexHighlightRule(); 00034 00035 virtual bool tryToMatch(std::string::const_iterator start, 00036 std::string::const_iterator end, HighlightToken &token, 00037 const MatchingParameters ¶ms); 00038 00039 virtual const std::string toString() const; 00040 00041 virtual void replaceReferences(const ReplacementList &rep); 00042 00043 virtual HighlightRule *clone(); 00044 00045 void setRegExp(const std::string &s); 00046 }; 00047 00048 } 00049 00050 #endif /*REGEXHIGHLIGHTRULE_H_*/