HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
STY_ResultsFilter.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: STY_ResultsFilter.h ( STY Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __STY_ResultsFilter__
12 #define __STY_ResultsFilter__
13 
14 #include "STY_API.h"
15 #include <UT/UT_StringHolder.h>
16 #include <UT/UT_NonCopyable.h>
17 
18 class STY_Style;
19 
20 /// Filter that decides which results should be retrieved with
21 /// a call to getResults() in a styler.
22 /// Since virtually all calls to getResults() will want results from
23 /// a specific category, the constructor takes category mask for convenience.
24 /// Any custom filtering can be done by deriving from this class.
26 {
27 public:
28  /// Constructor, which for convenience takes a mask for accepted
29  /// override categories. The argument can be NULL for all categories.
30  STY_ResultsFilter(const char *category_mask = nullptr);
31  virtual ~STY_ResultsFilter();
32 
33  /// Returns true if the filter allows the overrides from the given category.
34  virtual bool acceptsCategory( const UT_StringHolder &category_name ) const;
35 
36  /// Returns true if the filter allows the overrides from style sheet entries
37  /// of lower precedence level than the given style entry.
38  /// Usually the overrides from all matching entries are allowed, but
39  /// sometimes an entery may block any further overrides, eg, if an style
40  /// contains 'material' override, andy lower level overrides for
41  /// 'materialParameters' need to be disregarded, since they were intended
42  /// for the old material.
43  virtual bool acceptsFurtherOverrides(const STY_Style &style)const;
44 
45 private:
46  /// Mask (pattern) for accepted override categories.
47  UT_StringHolder myCategoryMask;
48 };
49 
50 /// This predefined filter eliminates all results of lower precedence if
51 /// it detects a result setting the current material. This is because lower
52 /// precedence results are most likely directed at the lower precedence
53 /// material assignment, and so should only affect that material, not the
54 /// newly assigned material.
56 {
57 public:
59  // TODO: ask only for material and material parameter overrides
60  STY_ResultsFilter(nullptr)
61  {}
62 
63  virtual bool acceptsFurtherOverrides(const STY_Style &style) const;
64 };
65 
66 #endif
67 
virtual bool acceptsFurtherOverrides(const STY_Style &style) const
Represents a style sheet entry that contains a target and overrides.
Definition: STY_Style.h:28
#define STY_API
Definition: STY_API.h:10