ufe  2.0
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
attribute.h
Go to the documentation of this file.
1 #line 1 "S:/jenkins/workspace/ufe-full-windows/ufe/include/attribute.h"
2 #ifndef _ufe_attribute
3 #define _ufe_attribute
4 
5 // =======================================================================
6 // Copyright 2019 Autodesk, Inc. All rights reserved.
7 //
8 // This computer source code and related instructions and comments are the
9 // unpublished confidential and proprietary information of Autodesk, Inc.
10 // and are protected under applicable copyright and trade secret law. They
11 // may not be disclosed to, copied or used by any third party without the
12 // prior written consent of Autodesk, Inc.
13 // =======================================================================
14 
15 #include "common/ufeExport.h"
16 #include "sceneItem.h"
17 #include "observer.h"
18 #include "types.h"
19 #include "undoableCommand.h" // For UndoableCommand::Ptr
20 
21 #include <memory>
22 #include <vector>
23 #include <string>
24 
26 
37 {
38 public:
39  typedef std::shared_ptr<Attribute> Ptr;
40  typedef std::string Type;
41 
43 
44  static constexpr char kInvalid[] = "Invalid";
45  static constexpr char kBool[] = "Bool";
46  static constexpr char kInt[] = "Int";
47  static constexpr char kFloat[] = "Float";
48  static constexpr char kDouble[] = "Double";
49  static constexpr char kString[] = "String";
50  static constexpr char kColorFloat3[] = "ColorFloat3";
51  static constexpr char kEnumString[] = "EnumString";
52  static constexpr char kInt3[] = "Int3";
53  static constexpr char kFloat3[] = "Float3";
54  static constexpr char kDouble3[] = "Double3";
55  static constexpr char kGeneric[] = "Generic";
57 
59  Attribute(const SceneItem::Ptr&);
60  virtual ~Attribute();
61 
63  Attribute(const Attribute&) = delete;
65  Attribute& operator=(const Attribute&) = delete;
66  Attribute(Attribute&&) = delete;
67  Attribute& operator=(Attribute&&) = delete;
69 
71  SceneItem::Ptr sceneItem() const;
72 
74  virtual bool hasValue() const = 0;
75 
77  virtual std::string name() const = 0;
78 
80  virtual std::string documentation() const = 0;
81 
83  virtual Type type() const = 0;
84 
86  virtual std::string string() const = 0;
87 
88 private:
90 
91 }; // end class Attribute
92 
95 {
96 public:
97  typedef std::shared_ptr<AttributeGeneric> Ptr;
98 
100 
101  // Ufe::Attribute overrides
102  Type type() const final;
103 
105  virtual std::string nativeType() const = 0;
106 };
107 
110  public Attribute,
111  public std::enable_shared_from_this<AttributeEnumString>
112 {
113 public:
114  typedef std::shared_ptr<AttributeEnumString> Ptr;
115  typedef std::vector< std::string > EnumValues;
116 
117  using Attribute::Attribute;
118 
119  // Ufe::Attribute overrides
120  Type type() const final;
121 
123  virtual std::string get() const = 0;
124 
126  virtual void set(const std::string& value) = 0;
127 
131  virtual UndoableCommand::Ptr setCmd(const std::string& value);
132 
134  virtual EnumValues getEnumValues() const = 0;
135 };
136 
138 template<typename T>
140  public Attribute,
141  public std::enable_shared_from_this<TypedAttribute<T>>
142 {
143 public:
144  typedef std::shared_ptr<TypedAttribute<T>> Ptr;
145 
146  using Attribute::Attribute;
147 
148  // Ufe::Attribute overrides
149  Type type() const final;
150 
152  virtual T get() const = 0;
153 
155  virtual void set(const T& value) = 0;
156 
158  virtual UndoableCommand::Ptr setCmd(const T& value);
159 };
160 
164 
168 
172 
176 
180 
184 
188 
192 
196 
197 } // end namespace
198 
199 #endif /* _ufe_attribute */
std::shared_ptr< Attribute > Ptr
Definition: attribute.h:39
Typed attribute template for creating a specialized type.
Definition: attribute.h:139
Attribute(const SceneItem::Ptr &)
Constructor.
Attribute which has a list of strings as enumerated values.
Definition: attribute.h:109
std::string string(const Path &path)
Definition of macros for symbol visibility.
Definition: path.h:178
std::shared_ptr< AttributeEnumString > Ptr
Definition: attribute.h:114
const SceneItem::Ptr fItem
Definition: attribute.h:89
std::shared_ptr< TypedAttribute< T > > Ptr
Definition: attribute.h:144
std::shared_ptr< AttributeGeneric > Ptr
Definition: attribute.h:97
#define UFE_NS_DEF
Definition: ufe.h:35
Typed vector template for creating a specialized vector.
Definition: types.h:24
virtual Type type() const =0
Abstract base class for undoable commands.
Abstract base class for Attribute interface.
Definition: attribute.h:36
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:40
std::vector< std::string > EnumValues
Definition: attribute.h:115
const Ptr & get()
std::string Type
Definition: attribute.h:40
Generic attribute which doesn&#39;t match any defined type.
Definition: attribute.h:94
#define UFE_SDK_DECL
Definition: ufeExport.h:36