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
147 bool matched =
false;
148 for (
auto&& entry : myPatternEntries)
150 if (entry->myAttribute != name || entry->myComponent != component)
153 if (matchEntry(*entry.get(),
value, inclusive))
155 if (!myHasExclusions)
157 matched = !entry->myIsExclusion;
164 inline bool matchEntry(
167 bool inclusive)
const
169 return compareNumeric(entry, value, inclusive);
172 inline bool matchEntry(
175 bool inclusive)
const
177 return compareNumeric(entry, value, inclusive);
180 inline bool matchEntry(
183 bool inclusive)
const
185 if (entry.myOperator == eOpEQ)
187 if (entry.myPattern.isValid())
188 return entry.myPattern.contains(value, inclusive);
192 if (entry.myOperator == eOpNE)
194 if (entry.myPattern.isValid())
195 return !entry.myPattern.contains(value, inclusive);
202 template <
typename T>
203 inline bool compareNumeric(
206 bool inclusive)
const
208 switch (entry.myOperator)
212 if (entry.myHasFloat)
213 return SYSalmostEqual(entry.myFloat, value);
214 if (entry.myHasInteger)
215 return entry.myInteger ==
value;
216 if (entry.myPattern.isValid())
217 return entry.myPattern.contains(value, inclusive);
223 if (entry.myHasFloat)
224 return !SYSalmostEqual(entry.myFloat, value);
225 if (entry.myHasInteger)
226 return entry.myInteger !=
value;
227 if (entry.myPattern.isValid())
228 return !entry.myPattern.contains(value, inclusive);
234 if (entry.myHasFloat)
235 return entry.myFloat <
value;
236 if (entry.myHasInteger)
237 return entry.myInteger <
value;
243 if (entry.myHasFloat)
244 return entry.myFloat <=
value;
245 if (entry.myHasInteger)
246 return entry.myInteger <=
value;
252 if (entry.myHasFloat)
253 return entry.myFloat >
value;
254 if (entry.myHasInteger)
255 return entry.myInteger >
value;
261 if (entry.myHasFloat)
262 return entry.myFloat >=
value;
263 if (entry.myHasInteger)
264 return entry.myInteger >=
value;
275 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