9 #ifndef __PDG_FILTER_PATTERN_H__
10 #define __PDG_FILTER_PATTERN_H__
54 bool inclusive)
const;
62 name, value, component, inclusive);
72 name, value, component, inclusive);
82 name, value, component, inclusive);
136 const EntryPtr& entry,
138 bool inclusive)
const;
140 template <
typename T>
141 inline bool matchPattern(
145 bool inclusive)
const
150 bool matched =
false;
151 for (
auto&& entry : myPatternEntries)
153 if (entry->myAttribute != name || entry->myComponent != component)
156 if (matchEntry(*entry.get(),
value, inclusive))
158 if (!myHasExclusions)
160 matched = !entry->myIsExclusion;
167 inline bool matchEntry(
170 bool inclusive)
const
172 return compareNumeric(entry, value, inclusive);
175 inline bool matchEntry(
178 bool inclusive)
const
180 return compareNumeric(entry, value, inclusive);
183 inline bool matchEntry(
186 bool inclusive)
const
188 if (entry.myOperator == eOpEQ)
190 if (entry.myPattern.isValid())
191 return entry.myPattern.contains(value, inclusive);
195 if (entry.myOperator == eOpNE)
197 if (entry.myPattern.isValid())
198 return !entry.myPattern.contains(value, inclusive);
205 template <
typename T>
206 inline bool compareNumeric(
209 bool inclusive)
const
211 switch (entry.myOperator)
215 if (entry.myHasFloat)
216 return SYSalmostEqual(entry.myFloat, value);
217 if (entry.myHasInteger)
218 return entry.myInteger ==
value;
219 if (entry.myPattern.isValid())
220 return entry.myPattern.contains(value, inclusive);
226 if (entry.myHasFloat)
227 return !SYSalmostEqual(entry.myFloat, value);
228 if (entry.myHasInteger)
229 return entry.myInteger !=
value;
230 if (entry.myPattern.isValid())
231 return !entry.myPattern.contains(value, inclusive);
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;
264 if (entry.myHasFloat)
265 return entry.myFloat >=
value;
266 if (entry.myHasInteger)
267 return entry.myInteger >=
value;
278 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.
GLint GLint GLsizei GLint GLenum GLenum type
GLuint const GLchar * name
LeafData & operator=(const LeafData &)=delete
bool match(const UT_StringHolder &name, const UT_StringHolder &value, int component, bool inclusive) const