HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  /// Assignment operator.
36  STY_TargetType &operator=(const STY_TargetType &other);
37 
38  /// Target type comparison (since member points into the string table,
39  /// the pointer comparison is sufficient).
40  bool operator==(const STY_TargetType &other) const
41  { return myTargetType == other.myTargetType; }
42  bool operator!=(const STY_TargetType &other) const
43  { return !(*this == other); }
44 
45  /// Checks if this is a primitive target (the default).
46  bool isPrimitive() const;
47  /// Checks if this is a point target.
48  bool isPoint() const;
49  /// Checks if this is an object target.
50  bool isGeoObject() const;
51  /// Checks if this is a self target.
52  bool isSelf() const;
53 
54  /// Saves the target type to a JSON map for writing out a style sheet.
55  void saveStyleSheet(UT_JSONValueMap *map) const;
56 
57 private:
58  /// Target type name (pointer into shared table).
59  UT_StringHolder myTargetType;
60 };
61 
62 
63 #endif
64 
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