xentara-plugin v1.2.1
The Xentara Plugin Framework
Loading...
Searching...
No Matches
xentara::model::GenericElement Class Referenceabstract

A generic element within a Xentara model. More...

#include <model/GenericElement.hpp>

Public Member Functions

virtual ~GenericElement ()=0
 Virtual destructor.
 
auto xentara_cat_string () const -> __opaque_type__
 This is a helper function that enables using this class with utils::string::cat()
 
auto attributeReadHandle (const Attribute &attribute) const noexcept -> data::ReadHandle
 Gets a read handle for a specific attribute.
 
auto attributeReadHandle (std::string_view name) const noexcept -> data::ReadHandle
 Gets a read handle for the attribute with a specific name.
 
auto attributeReadHandle (const Attribute::Role &role) const noexcept -> data::ReadHandle
 Gets a read handle for a specific attribute role.
 
auto attributeWriteHandle (const Attribute &attribute) noexcept -> data::WriteHandle
 Gets a write handle for a specific attribute.
 
auto attributeWriteHandle (std::string_view name) noexcept -> data::WriteHandle
 Gets a write handle for the attribute with a specific name.
 
auto attributeWriteHandle (const Attribute::Role &role) noexcept -> data::WriteHandle
 Gets a write handle for a specific attribute role.
 
auto name () const -> std::string
 Gets the name of the element.
 
auto primaryKey () const -> std::string
 Gets the primary key of the element.
 
auto subElementPrimaryKey (std::string_view subElementName) const -> std::string
 Gets the primary key of a sub element.
 
auto uuid () const -> utils::core::Uuid
 Gets the UUID of the element.
 
auto childElements () const -> std::vector< std::shared_ptr< GenericElement > >
 Returns a list of all the the element's children.
 

Detailed Description

A generic element within a Xentara model.

Constructor & Destructor Documentation

◆ ~GenericElement()

virtual xentara::model::GenericElement::~GenericElement ( )
pure virtual

Virtual destructor.

Member Function Documentation

◆ attributeReadHandle() [1/3]

auto xentara::model::GenericElement::attributeReadHandle ( const Attribute attribute) const -> data::ReadHandle
noexcept

Gets a read handle for a specific attribute.

Parameters
attributeThe desired attribute
Returns
Returns a read handle for the specified attribute. You can check whether the attribute is supported by the object by comparing the returned handle with data::ReadHandle::Error::Unknown.

◆ attributeReadHandle() [2/3]

auto xentara::model::GenericElement::attributeReadHandle ( const Attribute::Role role) const -> data::ReadHandle
noexcept

Gets a read handle for a specific attribute role.

Parameters
roleThe role of the desired attribute
Returns
Returns a read handle for the specified attribute. You can check whether an attribute with the given role was found by comparing the returned handle with data::ReadHandle::Error::Unknown.

◆ attributeReadHandle() [3/3]

auto xentara::model::GenericElement::attributeReadHandle ( std::string_view  name) const -> data::ReadHandle
noexcept

Gets a read handle for the attribute with a specific name.

Parameters
nameThe name of the desired attribute, in UTF-8 encoding
Returns
Returns a read handle for the specified attribute. You can check whether an attribute with the given name was found by comparing the returned handle with data::ReadHandle::Error::Unknown.

◆ attributeWriteHandle() [1/3]

auto xentara::model::GenericElement::attributeWriteHandle ( const Attribute attribute) -> data::WriteHandle
noexcept

Gets a write handle for a specific attribute.

Parameters
attributeThe desired attribute
Returns
Returns a write handle for the specified attribute. You can check whether the attribute is supported by the object by comparing the returned handle with data::WriteHandle::Error::Unknown.

◆ attributeWriteHandle() [2/3]

auto xentara::model::GenericElement::attributeWriteHandle ( const Attribute::Role role) -> data::WriteHandle
noexcept

Gets a write handle for a specific attribute role.

Parameters
roleThe role of the desired attribute
Returns
Returns a write handle for the specified attribute. You can check whether an attribute with the given role was found by comparing the returned handle with data::WriteHandle::Error::Unknown.

◆ attributeWriteHandle() [3/3]

auto xentara::model::GenericElement::attributeWriteHandle ( std::string_view  name) -> data::WriteHandle
noexcept

Gets a write handle for the attribute with a specific name.

Parameters
nameThe name of the desired attribute, in UTF-8 encoding
Returns
Returns a write handle for the specified attribute. You can check whether an attribute with the given name was found by comparing the returned handle with data::WriteHandle::Error::Unknown.

◆ childElements()

auto xentara::model::GenericElement::childElements ( ) const -> std::vector< std::shared_ptr< GenericElement > >

Returns a list of all the the element's children.

Note
The complete list of children is only known once the configuration of the element has been loaded.

◆ name()

auto xentara::model::GenericElement::name ( ) const -> std::string

Gets the name of the element.

Note
The name is only known once the configuration of the element has been loaded.
Returns
The name of the element, in UTF-8 encoding.

◆ primaryKey()

auto xentara::model::GenericElement::primaryKey ( ) const -> std::string

Gets the primary key of the element.

Note
The primary key is only fully known once the entire configuration has been loaded.
Returns
The primary key of the element, in UTF-8 encoding.

◆ subElementPrimaryKey()

auto xentara::model::GenericElement::subElementPrimaryKey ( std::string_view  subElementName) const -> std::string

Gets the primary key of a sub element.

Note
The primary key is only fully known once the entire configuration has been loaded.
Parameters
subElementNameThe name of the sub element, in UTF-8 encoding.
Returns
The full primary key of the sub element, in UTF-8 encoding.

◆ uuid()

auto xentara::model::GenericElement::uuid ( ) const -> utils::core::Uuid

Gets the UUID of the element.

Note
The UUID is only known once the configuration of the element has been loaded.

◆ xentara_cat_string()

auto xentara::model::GenericElement::xentara_cat_string ( ) const -> __opaque_type__

This is a helper function that enables using this class with utils::string::cat()

utils::string::cat() will insert the primary key of the element into the string.