HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
STY_TargetType.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_TargetType.h ( STY Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __STY_TargetType__
12 #define __STY_TargetType__
13 
14 #include "STY_API.h"
15 #include <UT/UT_StringHolder.h>
16 
17 class UT_JSONValueMap;
18 
23 
24 // ===========================================================================
25 /// The target type used for identification general type of the targets.
26 /// Specified by the style target and used for matching by styled objects.
27 /// Uses shared string for both efficient storage an comparison (ptr comp).
29 {
30 public:
31  /// The style target is really a string wrapped by this class.
33  explicit STY_TargetType(const char *target_type);
34 
35  /// Target type comparison (since member points into the string table,
36  /// the pointer comparison is sufficient).
37  bool operator==(const STY_TargetType &other) const
38  { return myTargetType == other.myTargetType; }
39  bool operator!=(const STY_TargetType &other) const
40  { return !(*this == other); }
41 
42  /// Checks if this is a primitive target (the default).
43  bool isPrimitive() const;
44  /// Checks if this is a point target.
45  bool isPoint() const;
46  /// Checks if this is an object target.
47  bool isGeoObject() const;
48  /// Checks if this is a self target.
49  bool isSelf() const;
50 
51  /// Saves the target type to a JSON map for writing out a style sheet.
52  void saveStyleSheet(UT_JSONValueMap *map) const;
53 
54 private:
55  /// Target type name (pointer into shared table).
56  UT_StringHolder myTargetType;
57 };
58 
59 
60 #endif
61 
bool operator!=(const STY_TargetType &other) const
UT_JSONValueMap stores a map/dictionary of UT_JSONValue objects.
STY_API const UT_StringHolder STY_TARGETTYPE_GEOOBJECT
STY_API const UT_StringHolder STY_TARGETTYPE_POINT
STY_API const UT_StringHolder STY_TARGETTYPE_PRIMITIVE
#define STY_API
Definition: STY_API.h:10
STY_API const UT_StringHolder STY_TARGETTYPE_SELF
bool operator==(const STY_TargetType &other) const