HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_AttributeRef Class Reference

#include <PDG_AttributeRef.h>

+ Inheritance diagram for PDG_AttributeRef:

Public Types

enum  Error {
  eErrorNone, eErrorUnspecified, eErrorNotFound, eErrorReadOnly,
  eErrorInternal, eErrorAttributesReadOnly, eErrorTypeConflict, eErrorTypeUpgrade,
  eErrorOverwrite, eErrorUninitialized, eErrorInvalidFlag
}
 

Public Member Functions

 PDG_AttributeRef (const UT_StringHolder &name, const PDG_AttributeOwner *owner, Error error=eErrorNone)
 
 operator bool () const
 Returns true if the handle is valid. More...
 
bool isValid () const
 Returns true if the handle is valid. More...
 
Error error () const
 Returns the error state of the handle. More...
 
const UT_StringHoldername () const
 Returns the name of the attribute referenced by this attrib ref. More...
 
const PDG_AttributeOwnerowner () const
 Returns the PDG_AttributeOwner that owns the underlying attribute. More...
 
bool validate (UT_WorkBuffer &buffer) const
 
bool validate (const PDG_Node *node, bool report_errors=true, bool as_warning=false) const
 

Static Public Member Functions

static bool attributeError (UT_WorkBuffer &buffer, Error error, const UT_StringHolder &attrib_name, const PDG_AttributeOwner *owner=nullptr)
 
static void attributeModified (const PDG_AttributeOwner *owner, PDG_AttributeType attrib_type, const UT_StringHolder &attrib_name)
 Emits events when the attribute is modified. More...
 

Protected Attributes

UT_StringHolder myName
 
const PDG_AttributeOwnermyOwner
 
Error myError
 

Detailed Description

Base class for attribute references

Definition at line 29 of file PDG_AttributeRef.h.

Member Enumeration Documentation

Enumeration of possible errors that could occur when attempting to to construct an attribute reference

Enumerator
eErrorNone 

No error was specified, i.e. the ref is valid.

eErrorUnspecified 

An unspecified error occured - the ref is invalid.

eErrorNotFound 

The requested attribute was not found - the ref is invalid.

eErrorReadOnly 

The requested attribute was a readonly when attempting to create a RW ref - the ref is invalid

eErrorInternal 

The requested attribute is internal, and therefore cannot be removed by user code

eErrorAttributesReadOnly 

The entire attribute map is read only.

eErrorTypeConflict 

The requested attribute type did not match the attribute - the ref is invalid

eErrorTypeUpgrade 

The requested attribute is static and was not upgraded to dynamic.

eErrorOverwrite 

The requested attribute already exists, but the API call was instruct to not overwrite existing values

eErrorUninitialized 

The ref is uninitialized and needs to be created at a later point.

eErrorInvalidFlag 

The attribute doesn't support a flag that was passed to a SetFlag call

Definition at line 34 of file PDG_AttributeRef.h.

Constructor & Destructor Documentation

PDG_AttributeRef::PDG_AttributeRef ( const UT_StringHolder name,
const PDG_AttributeOwner owner,
Error  error = eErrorNone 
)
inlineexplicit

Definition at line 76 of file PDG_AttributeRef.h.

Member Function Documentation

static bool PDG_AttributeRef::attributeError ( UT_WorkBuffer buffer,
Error  error,
const UT_StringHolder attrib_name,
const PDG_AttributeOwner owner = nullptr 
)
static

Writes an attribute error format message to the buffer, based on the supply error, attrib name and optional work item. Returns True if no error is detected, or false if an error occured.

static void PDG_AttributeRef::attributeModified ( const PDG_AttributeOwner owner,
PDG_AttributeType  attrib_type,
const UT_StringHolder attrib_name 
)
static

Emits events when the attribute is modified.

Error PDG_AttributeRef::error ( ) const
inline

Returns the error state of the handle.

Definition at line 98 of file PDG_AttributeRef.h.

bool PDG_AttributeRef::isValid ( ) const
inline

Returns true if the handle is valid.

Definition at line 92 of file PDG_AttributeRef.h.

const UT_StringHolder& PDG_AttributeRef::name ( void  ) const
inline

Returns the name of the attribute referenced by this attrib ref.

Definition at line 105 of file PDG_AttributeRef.h.

PDG_AttributeRef::operator bool ( ) const
inline

Returns true if the handle is valid.

Definition at line 86 of file PDG_AttributeRef.h.

const PDG_AttributeOwner* PDG_AttributeRef::owner ( ) const
inline

Returns the PDG_AttributeOwner that owns the underlying attribute.

Definition at line 112 of file PDG_AttributeRef.h.

bool PDG_AttributeRef::validate ( UT_WorkBuffer buffer) const

Returns false and Writes an attribute error message into the buffer if an error exists, or returns trues and does not modify the buffer if no error has been recorded.

bool PDG_AttributeRef::validate ( const PDG_Node node,
bool  report_errors = true,
bool  as_warning = false 
) const

Same as above, except the attribute error is reported on the specified node instead of returned as a buffer, if an error has occured. The method still returns true if no error has occured, and false if one has.

The report_errors argument is provided as a convenience, to make it possible to parametrically skip error reporting

Member Data Documentation

Error PDG_AttributeRef::myError
protected

Definition at line 150 of file PDG_AttributeRef.h.

UT_StringHolder PDG_AttributeRef::myName
protected

Definition at line 148 of file PDG_AttributeRef.h.

const PDG_AttributeOwner* PDG_AttributeRef::myOwner
protected

Definition at line 149 of file PDG_AttributeRef.h.


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