An attribute containing metadata or describing behavior of a structure.
More...
#include <Attributes.h>
|
| Attribute (TypeId type) |
| Constructs an attribute instance with the given type.
|
|
| Attribute (TypeId type, TypeId genericType, bool runtime=true) |
| Constructs a generic attribute instance with the given type and generic type parameter.
|
|
template<typename T > |
T & | get (size_t index=0) |
| Get the stored value of the given type, with an optional index.
|
|
template<typename T > |
const T & | get (size_t index=0) const |
| See non-const get() implementation.
|
|
An attribute containing metadata or describing behavior of a structure.
Attributes can be used to store arbitrary metadata on a structure. The base attribute class is designed to offer data storage and type information for derived attributes.
Derived types shall not have local storage.
- See also
- Attributes
◆ Attribute() [1/2]
Cogs::Reflection::Attribute::Attribute |
( |
TypeId |
type | ) |
|
|
inlineprotected |
Constructs an attribute instance with the given type.
- Parameters
-
type | Type id of the derived attribute type. |
◆ Attribute() [2/2]
Cogs::Reflection::Attribute::Attribute |
( |
TypeId |
type, |
|
|
TypeId |
genericType, |
|
|
bool |
runtime = true |
|
) |
| |
|
inlineprotected |
Constructs a generic attribute instance with the given type and generic type parameter.
- Parameters
-
type | Type id of the derived attribute type. |
genericType | Type id of the derived attributes template value type. |
runtime | bool True if the attribute can be used for runtime information, false if code-generation. |
◆ get() [1/2]
T & Cogs::Reflection::Attribute::get |
( |
size_t |
index = 0 | ) |
|
|
inlineprotected |
Get the stored value of the given type, with an optional index.
If an index is given, the storage is assumed to contain an array of values of type T, and the index is used to look up the nth value.
- Template Parameters
-
Type | of the value to retrieve. |
- Parameters
-
index | Optional array index of the value to retrieve. |
- Returns
- A reference to the stored value.
References Cogs::T.
◆ get() [2/2]
const T & Cogs::Reflection::Attribute::get |
( |
size_t |
index = 0 | ) |
const |
|
inlineprotected |
◆ getGenericType()
TypeId Cogs::Reflection::Attribute::getGenericType |
( |
| ) |
const |
|
inline |
Gets an optional generic type parameter when the derived attribute class is a template.
◆ getType()
TypeId Cogs::Reflection::Attribute::getType |
( |
| ) |
const |
|
inline |
Get the type of the derived attribute class.
◆ isRuntime()
bool Cogs::Reflection::Attribute::isRuntime |
( |
| ) |
const |
|
inline |
Gets value of the runtime attribute flag.
The documentation for this struct was generated from the following file: