9 #ifndef __PDG_FILTER_PATTERN_H__
10 #define __PDG_FILTER_PATTERN_H__
48 bool inclusive)
const;
56 name, value, component, inclusive);
66 name, value, component, inclusive);
76 name, value, component, inclusive);
130 const EntryPtr& entry,
132 bool inclusive)
const;
134 template <
typename T>
135 inline bool matchPattern(
139 bool inclusive)
const
141 bool matched =
false;
142 for (
auto&& entry : myPatternEntries)
144 if (entry->myAttribute != name || entry->myComponent != component)
147 if (matchEntry(*entry.get(),
value, inclusive))
149 if (!myHasExclusions)
151 matched = !entry->myIsExclusion;
158 inline bool matchEntry(
161 bool inclusive)
const
163 return compareNumeric(entry, value, inclusive);
166 inline bool matchEntry(
169 bool inclusive)
const
171 return compareNumeric(entry, value, inclusive);
174 inline bool matchEntry(
177 bool inclusive)
const
179 if (entry.myOperator == eOpEQ)
181 if (entry.myPattern.isValid())
182 return entry.myPattern.contains(value, inclusive);
186 if (entry.myOperator == eOpNE)
188 if (entry.myPattern.isValid())
189 return !entry.myPattern.contains(value, inclusive);
196 template <
typename T>
197 inline bool compareNumeric(
200 bool inclusive)
const
202 switch (entry.myOperator)
206 if (entry.myHasFloat)
207 return SYSalmostEqual(entry.myFloat, value);
208 if (entry.myHasInteger)
209 return entry.myInteger ==
value;
210 if (entry.myPattern.isValid())
211 return entry.myPattern.contains(value, inclusive);
217 if (entry.myHasFloat)
218 return !SYSalmostEqual(entry.myFloat, value);
219 if (entry.myHasInteger)
220 return entry.myInteger !=
value;
221 if (entry.myPattern.isValid())
222 return !entry.myPattern.contains(value, inclusive);
228 if (entry.myHasFloat)
229 return entry.myFloat <
value;
230 if (entry.myHasInteger)
231 return entry.myInteger <
value;
237 if (entry.myHasFloat)
238 return entry.myFloat <=
value;
239 if (entry.myHasInteger)
240 return entry.myInteger <=
value;
246 if (entry.myHasFloat)
247 return entry.myFloat >
value;
248 if (entry.myHasInteger)
249 return entry.myInteger >
value;
255 if (entry.myHasFloat)
256 return entry.myFloat >=
value;
257 if (entry.myHasInteger)
258 return entry.myInteger >=
value;
269 bool myHasExclusions;
bool match(const UT_StringHolder &name, exint value, int component, bool inclusive) const
PDG_AttributeIntrinsic
Enumeration of types of attribute that can be queried from work items.
GLsizei const GLfloat * value
void reset(const UT_StringHolder &pattern)
Resets the pattern.
**But if you need a result
bool match(const UT_StringHolder &name, fpreal value, int component, bool inclusive) const
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
GLuint const GLchar * name
bool match(const UT_StringHolder &name, const UT_StringHolder &value, int component, bool inclusive) const