CppGraph Application Framework©
Copyright © 2004-202x Geoff Goldberg
Public Member Functions | Friends | List of all members
cppgraph::property Struct Referencefinal

A property is a light-weight container for a non-node type, and is a leaf node in the graph. More...

#include <property.h>

Inheritance diagram for cppgraph::property:
Inheritance graph
[legend]

Public Member Functions

property_handle create_clone () const
 Returns a handle to a copy of this property. More...
 
template<typename T , typename = enable_if_is_property< T >>
T const * data (error_action_enum error_action_type) const
 Returns a const pointer to this property's data. More...
 
template<typename T , typename = enable_if_is_property< T >>
T * data (error_action_enum error_action_type)
 Returns a pointer to this property's data. More...
 
property_id_t get_id () const
 Returns this property's ID. More...
 
property_type_enum get_type () const
 Returns the property_type_enum of the underlying type. More...
 
bool operator!= (property const &property) const
 Returns true if a specified property's type or data value do not match those of this property. More...
 
template<typename T , typename = enable_if_is_property< T >>
propertyoperator= (T value) noexcept
 Assignment from an instance of a supported type. More...
 
propertyoperator= (property property)
 Assignment from another Value. More...
 
bool operator== (property const &property) const
 Returns true if a specified property's type and data value match those of this property. More...
 
utf8_string to_string () const
 Returns a string representation of this property. More...
 

Friends

std::ostream & operator<< (std::ostream &stream, property_handle const &h_property)
 Serializes a property handle, as a CML member, to an output stream. More...
 
std::ostream & operator<< (std::ostream &stream, property const &property)
 Serializes a property, as a CML member, to an output stream. More...
 

Detailed Description

A property is a light-weight container for a non-node type, and is a leaf node in the graph.

A property provides the means for storing unrelated types in homogeneous property containers.

Class Diagram

property.png

Member Function Documentation

◆ create_clone()

property_handle cppgraph::property::create_clone ( ) const

Returns a handle to a copy of this property.

Returns
A handle to a copy of this property.

◆ data() [1/2]

template<typename T , typename U >
T const * cppgraph::property::data ( error_action_enum  error_action_type) const
inline

Returns a const pointer to this property's data.

Template Parameters
TA property type.
Parameters
error_action_typeSpecifies whether or not to assert if T is not the type of this property.
Returns
A const pointer to this property's data or nullptr if T is not the type of this property.
Exceptions
exceptionT is not the type of this property AND 'error_action_type == error_action_enum::e_assert`

◆ data() [2/2]

template<typename T , typename >
T * cppgraph::property::data ( error_action_enum  error_action_type)

Returns a pointer to this property's data.

Template Parameters
TA property type.
Parameters
error_action_typeSpecifies whether or not to assert if T is not the type of this property.
Returns
A pointer to this property's data or nullptr if T is not the type of this property.
Exceptions
exceptionT is not the type of this property AND 'error_action_type == error_action_enum::e_assert`

◆ get_id()

property_id_t cppgraph::property::get_id ( ) const

Returns this property's ID.

Returns
This property's ID, a guid.

◆ get_type()

property_type_enum cppgraph::property::get_type ( ) const

Returns the property_type_enum of the underlying type.

Returns
The type of this property's data.

◆ operator!=()

bool cppgraph::property::operator!= ( property const &  property) const

Returns true if a specified property's type or data value do not match those of this property.

Parameters
propertyproperty whose data and type to compare with those of this property.
Returns
true if a specified property's type or data value do not match those of this property.

◆ operator=() [1/2]

template<typename T , typename U >
property & cppgraph::property::operator= ( value)
inlinenoexcept

Assignment from an instance of a supported type.

Template Parameters
TOne of the supported property types. See property_types. A compile error results if T is not one of the supported types.
Parameters
valueA value to assign to this property.
Returns
A reference to this node.

◆ operator=() [2/2]

property & cppgraph::property::operator= ( property  property)

Assignment from another Value.

Performs a deep copy.

Parameters
propertyA property to copy. This property's current data is destroyed. A copy of the specified property's data type is created on the heap using the copy constructor of its data type.
Returns
A reference to this node.

◆ operator==()

bool cppgraph::property::operator== ( property const &  property) const

Returns true if a specified property's type and data value match those of this property.

Parameters
propertyproperty whose data and type to compare with those of this property.
Returns
true if a specified property's type and data value match those of this property.

◆ to_string()

utf8_string cppgraph::property::to_string ( ) const

Returns a string representation of this property.

Returns
A string representation of this property.

Friends And Related Function Documentation

◆ operator<< [1/2]

std::ostream& operator<< ( std::ostream &  stream,
property_handle const &  h_property 
)
friend

Serializes a property handle, as a CML member, to an output stream.

Parameters
streamOutput stream to which to send the formatted data.
h_propertyThis handle, its property, and the property's type and value are written to stream.
Returns
A reference to stream.
Exceptions
exceptionh_property is nullptr.

◆ operator<< [2/2]

std::ostream& operator<< ( std::ostream &  stream,
property const &  property 
)
friend

Serializes a property, as a CML member, to an output stream.

Parameters
streamOutput stream to which to send the formatted data.
propertyThis property, its type, and its value are written to stream.
Returns
A reference to stream.

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