File indexing completed on 2024-04-06 11:56:20
0001 #ifndef GENERS_SEARCHSPECIFIER_HH_
0002 #define GENERS_SEARCHSPECIFIER_HH_
0003
0004 #include <string>
0005
0006 #include "Alignment/Geners/interface/Regex.hh"
0007
0008 namespace gs {
0009 class SearchSpecifier {
0010 public:
0011 inline SearchSpecifier(const char *exact) : tag_(exact ? exact : ""), useRegex_(false) {}
0012
0013 inline SearchSpecifier(const std::string &exact) : tag_(exact), useRegex_(false) {}
0014
0015 inline SearchSpecifier(const Regex ®ex) : regex_(regex), useRegex_(true) {}
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 inline SearchSpecifier(const std::string &expr, const bool useRegex)
0028 : tag_(expr), regex_(useRegex ? expr : std::string()), useRegex_(useRegex) {}
0029
0030 inline bool useRegex() const { return useRegex_; }
0031 inline const std::string &pattern() const { return tag_; }
0032
0033 bool matches(const std::string &sentence) const;
0034
0035 SearchSpecifier() = delete;
0036
0037 private:
0038 std::string tag_;
0039 Regex regex_;
0040 bool useRegex_;
0041 };
0042 }
0043
0044 #endif