Cogs.Foundation
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Cogs::Reflection::Attributes Struct Reference

Attribute storage for structures. More...

#include <Attributes.h>

Public Member Functions

template<typename T >
void add (T &attribute)
 Add the given attribute to the attribute storage.
 
template<typename T >
Fieldadd (Field &field, T &attribute)
 Add the given attribute to the attribute storage, with the given field as continuation parameter.
 
template<typename T >
const Tget () const
 Retrieve an attribute of the given type from storage, if present.
 

Detailed Description

Attribute storage for structures.

Provides facilities for adding and retrieving attributes from a structure.

Member Function Documentation

◆ add() [1/2]

template<typename T >
Field & Cogs::Reflection::Attributes::add ( Field field,
T attribute 
)
inline

Add the given attribute to the attribute storage, with the given field as continuation parameter.

Template Parameters
TType of the attribute to register, derived from the attribute parameter.
Parameters
fieldReference to the field the attribute is being added to.
attributeReference to an attribute to add.
Returns
Reference to the provided field, for continuation style setup.

◆ add() [2/2]

template<typename T >
void Cogs::Reflection::Attributes::add ( T attribute)
inline

Add the given attribute to the attribute storage.

Template Parameters
TType of the attribute to register, derived from the attribute parameter.
Parameters
attributeReference to an attribute to add.

◆ get()

template<typename T >
const T * Cogs::Reflection::Attributes::get ( ) const
inline

Retrieve an attribute of the given type from storage, if present.

Template Parameters
TType of the attribute to retrieve. The type must be properly registered with the type system.
Returns
A pointer to the attribute, if found, nullptr if no attribute of the given type is present.

References Cogs::T.


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