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 Member Functions

 PDG_AttributeRef (const UT_StringHolder &name, const PDG_AttributeOwner *owner, PDG_AttributeError error=PDG_AttributeError::eNone)
 
 operator bool () const
 Returns true if the handle is valid. More...
 
bool isValid () const
 Returns true if the handle is valid. More...
 
PDG_AttributeError 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, PDG_AttributeError 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
 
PDG_AttributeError myError
 

Detailed Description

Base class for attribute references

Definition at line 33 of file PDG_AttributeRef.h.

Constructor & Destructor Documentation

PDG_AttributeRef::PDG_AttributeRef ( const UT_StringHolder name,
const PDG_AttributeOwner owner,
PDG_AttributeError  error = PDG_AttributeError::eNone 
)
inlineexplicit

Definition at line 36 of file PDG_AttributeRef.h.

Member Function Documentation

static bool PDG_AttributeRef::attributeError ( UT_WorkBuffer buffer,
PDG_AttributeError  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.

PDG_AttributeError PDG_AttributeRef::error ( ) const
inline

Returns the error state of the handle.

Definition at line 55 of file PDG_AttributeRef.h.

bool PDG_AttributeRef::isValid ( ) const
inline

Returns true if the handle is valid.

Definition at line 51 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 60 of file PDG_AttributeRef.h.

PDG_AttributeRef::operator bool ( ) const
inline

Returns true if the handle is valid.

Definition at line 47 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 64 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

PDG_AttributeError PDG_AttributeRef::myError
protected

Definition at line 102 of file PDG_AttributeRef.h.

UT_StringHolder PDG_AttributeRef::myName
protected

Definition at line 100 of file PDG_AttributeRef.h.

const PDG_AttributeOwner* PDG_AttributeRef::myOwner
protected

Definition at line 101 of file PDG_AttributeRef.h.


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