HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UN_GraphConfig.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: UN_GraphContext.h ( UN Library, C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __UN_GraphConfig_h__
13 #define __UN_GraphConfig_h__
14 
15 #include "UN_API.h"
16 #include <UT/UT_StringHolder.h>
17 
18 
19 // ============================================================================
20 /// The graph configuration class.
21 /// It contains info about specific aspects of a graph, eg,
22 /// whether nodes require alphanumeric and/or unique names.
24 {
25 public:
26  /// Set the flag to ensure the graph item names (such as node or
27  /// sticky note names) are both alphanumeric and also unique
28  /// among their siblings in the subnet.
29  /// These two options are usually set in tandem, for pattern matching
30  /// in scripts and for identifying nodes using paths.
32  {
35  }
36 
37  /// @{ A flag that ensures all graph items (nodes, sticky notes, etc)
38  /// have an alphanumeric name.
40  { return myForceValidGraphItemNames; }
41  void setForceValidGraphItemNames( bool flag )
42  { myForceValidGraphItemNames = flag; }
43  /// @}
44 
45  /// @{ A set of additional characters that are legal in node names.
47  { return myGraphItemNameSafeChars; }
49  const UT_StringRef &safe_chars )
50  { myGraphItemNameSafeChars = safe_chars; }
51  /// @}
52 
53  /// @{ A flag that ensures all the nodes have names that are unique among
54  /// their siblings within a subnet.
56  { return myForceUniqueGraphItemNames; }
57  void setForceUniqueGraphItemNames( bool flag )
58  { myForceUniqueGraphItemNames = flag; }
59  /// @}
60 
61  /// @{ A flag that indicates whether the graph should use the node types
62  /// registered with the UN manager. Setting this flag to true
63  /// validates the node type name when creating a new node.
64  bool usesRegistryNodeTypes() const
65  { return myUsesRegistryNodeTypes; }
66  void useRegistryNodeTypes( bool flag )
67  { myUsesRegistryNodeTypes = flag; }
68  /// @}
69 
70  /// @{ A flag that ensures all the ports have an alphanumeric name.
72  { return myForceValidPortNames; }
73  void setForceValidPortNames( bool flag )
74  { myForceValidPortNames = flag; }
75  /// @}
76 
77  /// @{ A flag that ensures an alphanumeric node type names.
78  /// This is useful for future-proofing namespacing, versioning, etc.
80  { return myForceValidPortTypeNames; }
81  void setForceValidPortTypeNames( bool flag )
82  { myForceValidPortTypeNames = flag; }
83  /// @}
84 
85 private:
86  /// Ensure that graph item names (nodes, sticky notes) are alphanumeric.
87  bool myForceValidGraphItemNames = false;
88 
89  /// Ensure that graph item names (nodes, sticky notes) are unique
90  /// among the siblings within a subnet.
91  bool myForceUniqueGraphItemNames = false;
92 
93  /// Uses node types found in the registry for node initialization,
94  /// and acquiring its aspects (eg, input/outputs, parameters, etc).
95  bool myUsesRegistryNodeTypes = false;
96 
97  /// Ensure that port names are alphanumerci.
98  bool myForceValidPortNames = false;
99 
100  /// Ensure that port type names are alphanumeric.
101  bool myForceValidPortTypeNames = false;
102 
103  /// Extra characters that are legal in the graph item names (nodes, etc),
104  /// in addition to the standard C-var style alphanumerics.
105  UT_StringHolder myGraphItemNameSafeChars;
106 };
107 
108 
109 #endif
110 
void setForceValidPortNames(bool flag)
A flag that ensures all the ports have an alphanumeric name.
const UT_StringHolder & graphItemNameSafeChars() const
A set of additional characters that are legal in node names.
bool usesRegistryNodeTypes() const
bool shouldForceValidGraphItemNames() const
void setForceUniqueGraphItemNames(bool flag)
void setForceValidUniqueGraphItemNames(bool flag)
bool shouldForceUniqueGraphItemNames() const
void setGraphItemNameSafeChars(const UT_StringRef &safe_chars)
A set of additional characters that are legal in node names.
void setForceValidPortTypeNames(bool flag)
void useRegistryNodeTypes(bool flag)
void setForceValidGraphItemNames(bool flag)
bool shouldForceValidPortNames() const
A flag that ensures all the ports have an alphanumeric name.
bool shouldForceValidPortTypeNames() const