Cogs.Core
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 T * get () 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.

Definition at line 129 of file Attributes.h.

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.

Definition at line 155 of file Attributes.h.

◆ 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.

Definition at line 139 of file Attributes.h.

◆ 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.

Definition at line 172 of file Attributes.h.


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