Source-highlight Library
|
00001 /* 00002 * regexranges.h 00003 * 00004 * Created on: Apr 11, 2009 00005 * Author: Lorenzo Bettini <http://www.lorenzobettini.it>, (C) 2008 00006 * Copyright: See COPYING file that comes with this distribution 00007 */ 00008 00009 #ifndef REGEXRANGES_H_ 00010 #define REGEXRANGES_H_ 00011 00012 #include <string> 00013 #include <list> 00014 #include <boost/regex.hpp> 00015 00016 namespace srchilite { 00017 00022 class RegexRanges { 00023 public: 00024 RegexRanges(); 00025 ~RegexRanges(); 00026 00027 typedef std::list<boost::regex> RegexRangesType; 00028 00036 bool addRegexRange(const std::string &s); 00037 00041 void clear() { 00042 ranges.clear(); 00043 } 00044 00051 const boost::regex *matches(const std::string &line); 00052 00057 bool isInRange(const std::string &line); 00058 00064 void reset() { 00065 currentRegex = 0; 00066 } 00067 00068 private: 00070 RegexRangesType ranges; 00071 00079 const boost::regex *currentRegex; 00080 }; 00081 00082 } 00083 00084 #endif /* REGEXRANGES_H_ */