MCPcopy Create free account
hub / github.com/crawl/crawl / text_pattern

Class text_pattern

crawl-ref/source/pattern.h:52–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50};
51
52class text_pattern : public base_pattern
53{
54public:
55 text_pattern(const string &s, bool icase = false)
56 : pattern(s), compiled_pattern(nullptr),
57 isvalid(true), ignore_case(icase)
58 {
59 }
60
61 text_pattern()
62 : pattern(), compiled_pattern(nullptr),
63 isvalid(false), ignore_case(false)
64 {
65 }
66
67 text_pattern(const text_pattern &tp)
68 : base_pattern(tp),
69 pattern(tp.pattern),
70 compiled_pattern(nullptr),
71 isvalid(tp.isvalid),
72 ignore_case(tp.ignore_case)
73 {
74 }
75
76 ~text_pattern();
77 const text_pattern &operator= (const text_pattern &tp);
78 const text_pattern &operator= (const string &spattern);
79 bool operator== (const text_pattern &tp) const;
80 bool compile() const;
81
82 bool empty() const { return !pattern.length(); }
83
84 bool valid() const override
85 {
86 return isvalid
87 && (compiled_pattern || (isvalid = compile()));
88 }
89
90 bool matches(const char *s, int length) const;
91
92 bool matches(const char *s) const
93 {
94 return matches(s, strlen(s));
95 }
96
97 bool matches(const string &s) const override
98 {
99 return matches(s.c_str(), s.length());
100 }
101
102 pattern_match match_location(const char *s, int length) const;
103
104 pattern_match match_location(const char *s) const
105 {
106 return match_location(s, strlen(s));
107 }
108
109 pattern_match match_location(const string &s) const override

Callers 5

add_feature_overrideMethod · 0.85
message_filterMethod · 0.85
_slot_mappingFunction · 0.85
_waypoint_searchMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected