SUAPI-CppWrapper
C++WrapperforSketchUpCAPI
Public Member Functions
CW::AttributeDictionary Class Reference
+ Inheritance diagram for CW::AttributeDictionary:

Public Member Functions

 AttributeDictionary ()
 
 AttributeDictionary (std::string name)
 
 AttributeDictionary (SUAttributeDictionaryRef dict, bool attached=true)
 
 AttributeDictionary (const AttributeDictionary &other)
 
 ~AttributeDictionary ()
 
AttributeDictionaryoperator= (const AttributeDictionary &other)
 
SUAttributeDictionaryRef ref () const
 
 operator SUAttributeDictionaryRef () const
 
 operator SUAttributeDictionaryRef * ()
 
TypedValue get_attribute (const std::string &key, const TypedValue &default_value) const
 
TypedValue get_value (const std::string &key) const
 
bool set_attribute (const std::string &key, const TypedValue &value)
 
std::vector< std::string > get_keys () const
 
std::string get_name () const
 
bool operator! () const
 
- Public Member Functions inherited from CW::Entity
 Entity ()
 Constructor representing a null objject.
 
 Entity (SUEntityRef entity, bool attached=true)
 Creates a new Entity object. More...
 
 Entity (const Entity &other, SUEntityRef entity_ref=SU_INVALID)
 Copy constructor with an optional parameter for the entity reference. More...
 
 ~Entity ()
 Destructor. More...
 
Entityoperator= (const Entity &other)
 Copy assignment operator.
 
 operator SUEntityRef () const
 
 operator SUEntityRef * ()
 
SUEntityRef ref () const
 
bool attached () const
 Returns true if the entity is attached to another object.
 
void attached (bool attach)
 Method lets the object know that it has been attached to a model. This is important as it will let the object know that it does not need to "release" the object. More...
 
std::vector< AttributeDictionaryattribute_dictionaries () const
 Returns the AttributeDictionaries collection attached to the entity. More...
 
AttributeDictionary attribute_dictionary (const std::string &name) const
 Returns an attribute dictionary object with a given name that is attached to an Entity. More...
 
bool add_dictionary (AttributeDictionary &dict)
 Adds the AttributeDictionary to the Entity. More...
 
bool copy_attributes_from (const Entity &entity)
 Copies attributes from another Entity object to this one. More...
 
bool is_valid () const
 Checks if the entity is valid. More...
 
bool operator! () const
 Returns true if this entity is not valid. Alias of !is_valid().
 
int32_t entityID () const
 Retrieve a unique ID assigned to an entity. More...
 
TypedValue get_attribute (const std::string &dict_name, const std::string &key, const TypedValue &default_value=TypedValue()) const
 Retrieves the value of an attribute in the entity's attribute dictionary. More...
 
TypedValue get_attribute (const AttributeDictionary &dict, const std::string &key, const TypedValue &default_value=TypedValue()) const
 Retrieves the value of an attribute in the entity's attribute dictionary. More...
 
bool set_attribute (const std::string &dict_name, const std::string &key, const TypedValue &value)
 Sets the value of an attribute in the given AttributeDictionary object. More...
 
bool set_attribute (AttributeDictionary &dict, const std::string &key, const TypedValue &value)
 Sets the value of an attribute in the given AttributeDictionary object. More...
 
enum SURefType entity_type () const
 Returns the type of the entity. See enum SURefType.
 
Model model () const
 
Entities parent () const
 
int64_t persistent_id () const
 

Additional Inherited Members

- Protected Attributes inherited from CW::Entity
SUEntityRef m_entity
 The C SUEntityRef that this class wraps.
 
bool m_attached
 Indicates whether the Entity has been attached to a model.
 

Detailed Description

Definition at line 47 of file AttributeDictionary.hpp.

Constructor & Destructor Documentation

CW::AttributeDictionary::AttributeDictionary ( )

Constructor for null object.

Definition at line 75 of file AttributeDictionary.cpp.

CW::AttributeDictionary::AttributeDictionary ( std::string  name)

Constructor to create a new object.

Parameters
name- name of the dictionary to create.
Since
SketchUp 2018, API v6.0

Definition at line 80 of file AttributeDictionary.cpp.

CW::AttributeDictionary::AttributeDictionary ( SUAttributeDictionaryRef  dict,
bool  attached = true 
)

Constructor from existing SUAttributeDictionaryRef object

Parameters
dict- existing SUAttributeDictionaryRef object to wrap with this class.
attached- indicates whether the dictionary is attached to an entity or not.

Definition at line 85 of file AttributeDictionary.cpp.

CW::AttributeDictionary::AttributeDictionary ( const AttributeDictionary other)

Copy constructor

Definition at line 91 of file AttributeDictionary.cpp.

CW::AttributeDictionary::~AttributeDictionary ( )

Destructor

Since
SketchUp 2018, API v6.0

Definition at line 104 of file AttributeDictionary.cpp.

Member Function Documentation

TypedValue CW::AttributeDictionary::get_attribute ( const std::string &  key,
const TypedValue default_value 
) const

Returns the value of the attribute with the specified key.

Parameters
&key- the key of the attribute
&default_value- the default value to return if the attribute with the key does not exist.

Definition at line 143 of file AttributeDictionary.cpp.

std::vector< std::string > CW::AttributeDictionary::get_keys ( ) const

Returns a vector array of keys in the Attribute Dictionary.

Definition at line 172 of file AttributeDictionary.cpp.

std::string CW::AttributeDictionary::get_name ( ) const

Returns the name of the AttributeDictionary.

Definition at line 199 of file AttributeDictionary.cpp.

TypedValue CW::AttributeDictionary::get_value ( const std::string &  key) const

Alias of AttributeDictionary::get_attribute().

Returns
TypedValue object. If the attribute does not exist, a null TypedValue object will be returned.

Definition at line 195 of file AttributeDictionary.cpp.

bool CW::AttributeDictionary::operator! ( ) const

Returns true if this is a null object.

Definition at line 208 of file AttributeDictionary.cpp.

AttributeDictionary & CW::AttributeDictionary::operator= ( const AttributeDictionary other)

Copy assignment operator

Definition at line 119 of file AttributeDictionary.cpp.

SUAttributeDictionaryRef CW::AttributeDictionary::ref ( ) const

Cast to native object

Definition at line 133 of file AttributeDictionary.cpp.

bool CW::AttributeDictionary::set_attribute ( const std::string &  key,
const TypedValue value 
)

Sets the specified attribute's value.

Parameters
&key- the key of the attribute to set.
&value- the value to set.

Definition at line 159 of file AttributeDictionary.cpp.


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