ufe 7.0
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
Ufe::Attribute Class Referenceabstract

Abstract base class for Attribute interface. More...

#include <attribute.h>

Inheritance diagram for Ufe::Attribute:
Collaboration diagram for Ufe::Attribute:

Public Types

typedef std::shared_ptr< AttributePtr
 
typedef std::string Type
 

Public Member Functions

 Attribute (const SceneItem::Ptr &)
 Constructor. More...
 
virtual ~Attribute ()
 
SceneItem::Ptr sceneItem () const
 
virtual bool hasValue () const =0
 
virtual std::string name () const =0
 
virtual std::string displayName () const
 
virtual std::string documentation () const =0
 
virtual Type type () const =0
 
virtual std::string string () const =0
 
virtual Value value () const =0
 
virtual UndoableCommand::Ptr setCmd (const Value &value)=0
 
 Attribute (const Attribute &)=delete
 
Attributeoperator= (const Attribute &)=delete
 
 Attribute (Attribute &&)=delete
 
Attributeoperator= (Attribute &&)=delete
 
bool operator== (const Attribute &rhs) const
 
bool operator!= (const Attribute &rhs) const
 
Metadata Access:
virtual Value getMetadata (const std::string &key) const =0
 
virtual bool setMetadata (const std::string &key, const Value &value)=0
 
virtual UndoableCommand::Ptr setMetadataCmd (const std::string &key, const Value &value)
 
virtual bool clearMetadata (const std::string &key)=0
 
virtual UndoableCommand::Ptr clearMetadataCmd (const std::string &key)
 
virtual bool hasMetadata (const std::string &key) const =0
 Returns true if metadata key has a non-empty value. More...
 

Static Public Attributes

Built-in attribute types:
static constexpr char kInvalid [] = "Invalid"
 
static constexpr char kBool [] = "Bool"
 
static constexpr char kInt [] = "Int"
 
static constexpr char kUInt [] = "UInt"
 
static constexpr char kFloat [] = "Float"
 
static constexpr char kDouble [] = "Double"
 
static constexpr char kString [] = "String"
 
static constexpr char kColorFloat3 [] = "ColorFloat3"
 
static constexpr char kColorFloat4 [] = "ColorFloat4"
 
static constexpr char kFilename [] = "Filename"
 
static constexpr char kEnumString [] = "EnumString"
 
static constexpr char kInt3 [] = "Int3"
 
static constexpr char kFloat2 [] = "Float2"
 
static constexpr char kFloat3 [] = "Float3"
 
static constexpr char kFloat4 [] = "Float4"
 
static constexpr char kDouble3 [] = "Double3"
 
static constexpr char kMatrix3d [] = "Matrix3d"
 
static constexpr char kMatrix4d [] = "Matrix4d"
 
static constexpr char kBoolArray [] = "BoolArray"
 
static constexpr char kIntArray [] = "IntArray"
 
static constexpr char kUIntArray [] = "UIntArray"
 
static constexpr char kFloatArray [] = "FloatArray"
 
static constexpr char kDoubleArray [] = "DoubleArray"
 
static constexpr char kStringArray [] = "StringArray"
 
static constexpr char kInt2Array [] = "Int2Array"
 
static constexpr char kFloat2Array [] = "Float2Array"
 
static constexpr char kDouble2Array [] = "Double2Array"
 
static constexpr char kInt3Array [] = "Int3Array"
 
static constexpr char kFloat3Array [] = "Float3Array"
 
static constexpr char kDouble3Array [] = "Double3Array"
 
static constexpr char kInt4Array [] = "Int4Array"
 
static constexpr char kFloat4Array [] = "Float4Array"
 
static constexpr char kDouble4Array [] = "Double4Array"
 
static constexpr char kColorFloat3Array [] = "ColorFloat3Array"
 
static constexpr char kColorFloat4Array [] = "ColorFloat4Array"
 
static constexpr char kMatrixDouble3Array [] = "MatrixDouble3Array"
 
static constexpr char kMatrixDouble4Array [] = "MatrixDouble4Array"
 
static constexpr char kGeneric [] = "Generic"
 
Metadata Keys:
static constexpr char kLocked [] = "Locked"
 

Private Attributes

const SceneItem::Ptr fItem
 

Detailed Description

Abstract base class for Attribute interface.

This base class defines an interface for factory objects that runtimes implement to handle the various supported attribute types (such as bool, int, float, etc).

Definition at line 36 of file attribute.h.

Member Typedef Documentation

◆ Ptr

typedef std::shared_ptr<Attribute> Ufe::Attribute::Ptr

Definition at line 39 of file attribute.h.

◆ Type

typedef std::string Ufe::Attribute::Type

Definition at line 40 of file attribute.h.

Constructor & Destructor Documentation

◆ Attribute() [1/3]

Ufe::Attribute::Attribute ( const SceneItem::Ptr )

Constructor.

◆ ~Attribute()

virtual Ufe::Attribute::~Attribute ( )
virtual

◆ Attribute() [2/3]

Ufe::Attribute::Attribute ( const Attribute )
delete

No copy or move constructor/assignment.

◆ Attribute() [3/3]

Ufe::Attribute::Attribute ( Attribute &&  )
delete

No copy or move constructor/assignment.

Member Function Documentation

◆ clearMetadata()

virtual bool Ufe::Attribute::clearMetadata ( const std::string &  key)
pure virtual

Clear the metadata key's value.

Parameters
[in]keyThe metadata key to clear.
Returns
True if the metadata was cleared successfully, otherwise false.

◆ clearMetadataCmd()

virtual UndoableCommand::Ptr Ufe::Attribute::clearMetadataCmd ( const std::string &  key)
virtual

Return a command for undo / redo that clear the metadata. The returned command is not executed; it is up to the caller to call execute(). The default implementation stores undo/redo data in an AttributeInfo that allows reconstructing a stale Attribute. Executing the command will throw if reconstruction fails.

◆ displayName()

virtual std::string Ufe::Attribute::displayName ( ) const
virtual
Returns
The attributes nice display name. Calls name() by default.

◆ documentation()

virtual std::string Ufe::Attribute::documentation ( ) const
pure virtual
Returns
The attributes documentation string.

◆ getMetadata()

virtual Value Ufe::Attribute::getMetadata ( const std::string &  key) const
pure virtual

Get the value of the metadata named key.

Parameters
[in]keyThe metadata key to query.
Returns
The value of the metadata key. If the key does not exist an empty Value is returned.

◆ hasMetadata()

virtual bool Ufe::Attribute::hasMetadata ( const std::string &  key) const
pure virtual

Returns true if metadata key has a non-empty value.

◆ hasValue()

virtual bool Ufe::Attribute::hasValue ( ) const
pure virtual
Returns
true if this attribute has a value.

◆ name()

virtual std::string Ufe::Attribute::name ( ) const
pure virtual
Returns
The attributes name.

◆ operator!=()

bool Ufe::Attribute::operator!= ( const Attribute rhs) const

Unfortunately no compiler-generated default equality operators. Attribute names are only unique within a SceneItem, so an Attribute is equal if both the SceneItem (which matches path) and name match.

◆ operator=() [1/2]

Attribute & Ufe::Attribute::operator= ( Attribute &&  )
delete

No copy or move constructor/assignment.

◆ operator=() [2/2]

Attribute & Ufe::Attribute::operator= ( const Attribute )
delete

No copy or move constructor/assignment.

◆ operator==()

bool Ufe::Attribute::operator== ( const Attribute rhs) const

Unfortunately no compiler-generated default equality operators. Attribute names are only unique within a SceneItem, so an Attribute is equal if both the SceneItem (which matches path) and name match.

◆ sceneItem()

SceneItem::Ptr Ufe::Attribute::sceneItem ( ) const
Returns
The object's SceneItem.

◆ setCmd()

virtual UndoableCommand::Ptr Ufe::Attribute::setCmd ( const Value value)
pure virtual

Return a command for undo / redo that sets the attribute value. If the specified value is not of the correct type, a null pointer is returned. The returned command is not executed; it is up to the caller to call execute(). The default implementation stores undo/redo data in an AttributeInfo that allows reconstructing a stale Attribute. Executing the command will throw if reconstruction fails or leads to an incorrectly typed attribute.

Implemented in Ufe::AttributeGeneric, Ufe::AttributeFilename, Ufe::AttributeEnumString, and Ufe::TypedAttribute< T >.

◆ setMetadata()

virtual bool Ufe::Attribute::setMetadata ( const std::string &  key,
const Value value 
)
pure virtual

Set the metadata key's value to value.

Parameters
[in]keyThe metadata key to set.
[in]valueThe value to set.
Returns
True if the metadata was set successfully, otherwise false.

◆ setMetadataCmd()

virtual UndoableCommand::Ptr Ufe::Attribute::setMetadataCmd ( const std::string &  key,
const Value value 
)
virtual

Return a command for undo / redo that sets the metadata key's value to value. The returned command is not executed; it is up to the caller to call execute(). The default implementation stores undo/redo data in an AttributeInfo that allows reconstructing a stale Attribute. Executing the command will throw if reconstruction fails.

◆ string()

virtual std::string Ufe::Attribute::string ( ) const
pure virtual
Returns
The string representation of the attribute value.

◆ type()

virtual Type Ufe::Attribute::type ( ) const
pure virtual

◆ value()

virtual Value Ufe::Attribute::value ( ) const
pure virtual
Returns
The attribute value wrapped in a Value variant for generic access.

Implemented in Ufe::AttributeGeneric, Ufe::AttributeFilename, Ufe::AttributeEnumString, and Ufe::TypedAttribute< T >.

Member Data Documentation

◆ fItem

const SceneItem::Ptr Ufe::Attribute::fItem
private

Definition at line 202 of file attribute.h.

◆ kBool

constexpr char Ufe::Attribute::kBool[] = "Bool"
staticconstexpr

Definition at line 45 of file attribute.h.

◆ kBoolArray

constexpr char Ufe::Attribute::kBoolArray[] = "BoolArray"
staticconstexpr

Definition at line 62 of file attribute.h.

◆ kColorFloat3

constexpr char Ufe::Attribute::kColorFloat3[] = "ColorFloat3"
staticconstexpr

Definition at line 51 of file attribute.h.

◆ kColorFloat3Array

constexpr char Ufe::Attribute::kColorFloat3Array[] = "ColorFloat3Array"
staticconstexpr

Definition at line 77 of file attribute.h.

◆ kColorFloat4

constexpr char Ufe::Attribute::kColorFloat4[] = "ColorFloat4"
staticconstexpr

Definition at line 52 of file attribute.h.

◆ kColorFloat4Array

constexpr char Ufe::Attribute::kColorFloat4Array[] = "ColorFloat4Array"
staticconstexpr

Definition at line 78 of file attribute.h.

◆ kDouble

constexpr char Ufe::Attribute::kDouble[] = "Double"
staticconstexpr

Definition at line 49 of file attribute.h.

◆ kDouble2Array

constexpr char Ufe::Attribute::kDouble2Array[] = "Double2Array"
staticconstexpr

Definition at line 70 of file attribute.h.

◆ kDouble3

constexpr char Ufe::Attribute::kDouble3[] = "Double3"
staticconstexpr

Definition at line 59 of file attribute.h.

◆ kDouble3Array

constexpr char Ufe::Attribute::kDouble3Array[] = "Double3Array"
staticconstexpr

Definition at line 73 of file attribute.h.

◆ kDouble4Array

constexpr char Ufe::Attribute::kDouble4Array[] = "Double4Array"
staticconstexpr

Definition at line 76 of file attribute.h.

◆ kDoubleArray

constexpr char Ufe::Attribute::kDoubleArray[] = "DoubleArray"
staticconstexpr

Definition at line 66 of file attribute.h.

◆ kEnumString

constexpr char Ufe::Attribute::kEnumString[] = "EnumString"
staticconstexpr

Definition at line 54 of file attribute.h.

◆ kFilename

constexpr char Ufe::Attribute::kFilename[] = "Filename"
staticconstexpr

Definition at line 53 of file attribute.h.

◆ kFloat

constexpr char Ufe::Attribute::kFloat[] = "Float"
staticconstexpr

Definition at line 48 of file attribute.h.

◆ kFloat2

constexpr char Ufe::Attribute::kFloat2[] = "Float2"
staticconstexpr

Definition at line 56 of file attribute.h.

◆ kFloat2Array

constexpr char Ufe::Attribute::kFloat2Array[] = "Float2Array"
staticconstexpr

Definition at line 69 of file attribute.h.

◆ kFloat3

constexpr char Ufe::Attribute::kFloat3[] = "Float3"
staticconstexpr

Definition at line 57 of file attribute.h.

◆ kFloat3Array

constexpr char Ufe::Attribute::kFloat3Array[] = "Float3Array"
staticconstexpr

Definition at line 72 of file attribute.h.

◆ kFloat4

constexpr char Ufe::Attribute::kFloat4[] = "Float4"
staticconstexpr

Definition at line 58 of file attribute.h.

◆ kFloat4Array

constexpr char Ufe::Attribute::kFloat4Array[] = "Float4Array"
staticconstexpr

Definition at line 75 of file attribute.h.

◆ kFloatArray

constexpr char Ufe::Attribute::kFloatArray[] = "FloatArray"
staticconstexpr

Definition at line 65 of file attribute.h.

◆ kGeneric

constexpr char Ufe::Attribute::kGeneric[] = "Generic"
staticconstexpr

Definition at line 81 of file attribute.h.

◆ kInt

constexpr char Ufe::Attribute::kInt[] = "Int"
staticconstexpr

Definition at line 46 of file attribute.h.

◆ kInt2Array

constexpr char Ufe::Attribute::kInt2Array[] = "Int2Array"
staticconstexpr

Definition at line 68 of file attribute.h.

◆ kInt3

constexpr char Ufe::Attribute::kInt3[] = "Int3"
staticconstexpr

Definition at line 55 of file attribute.h.

◆ kInt3Array

constexpr char Ufe::Attribute::kInt3Array[] = "Int3Array"
staticconstexpr

Definition at line 71 of file attribute.h.

◆ kInt4Array

constexpr char Ufe::Attribute::kInt4Array[] = "Int4Array"
staticconstexpr

Definition at line 74 of file attribute.h.

◆ kIntArray

constexpr char Ufe::Attribute::kIntArray[] = "IntArray"
staticconstexpr

Definition at line 63 of file attribute.h.

◆ kInvalid

constexpr char Ufe::Attribute::kInvalid[] = "Invalid"
staticconstexpr

Definition at line 44 of file attribute.h.

◆ kLocked

constexpr char Ufe::Attribute::kLocked[] = "Locked"
staticconstexpr

Metadata key: Locked, value type = bool
A locked attribute value cannot be changed.

Definition at line 145 of file attribute.h.

◆ kMatrix3d

constexpr char Ufe::Attribute::kMatrix3d[] = "Matrix3d"
staticconstexpr

Definition at line 60 of file attribute.h.

◆ kMatrix4d

constexpr char Ufe::Attribute::kMatrix4d[] = "Matrix4d"
staticconstexpr

Definition at line 61 of file attribute.h.

◆ kMatrixDouble3Array

constexpr char Ufe::Attribute::kMatrixDouble3Array[] = "MatrixDouble3Array"
staticconstexpr

Definition at line 79 of file attribute.h.

◆ kMatrixDouble4Array

constexpr char Ufe::Attribute::kMatrixDouble4Array[] = "MatrixDouble4Array"
staticconstexpr

Definition at line 80 of file attribute.h.

◆ kString

constexpr char Ufe::Attribute::kString[] = "String"
staticconstexpr

Definition at line 50 of file attribute.h.

◆ kStringArray

constexpr char Ufe::Attribute::kStringArray[] = "StringArray"
staticconstexpr

Definition at line 67 of file attribute.h.

◆ kUInt

constexpr char Ufe::Attribute::kUInt[] = "UInt"
staticconstexpr

Definition at line 47 of file attribute.h.

◆ kUIntArray

constexpr char Ufe::Attribute::kUIntArray[] = "UIntArray"
staticconstexpr

Definition at line 64 of file attribute.h.


The documentation for this class was generated from the following file: