1#include "TypeDatabase.h"
4#include "../ComponentModel/Attributes.h"
10 template<
typename ClassType,
typename FieldType>
14 byteSize(sizeof(FieldType)),
17 if constexpr (std::is_array<FieldType>{}) {
20 }
else if constexpr (std::is_pointer<FieldType>{}) {
22 }
else if constexpr (std::is_enum<FieldType>{}) {
24 static_assert(
sizeof(FieldType) ==
sizeof(
int),
"Only int compatible enums supported.");
28 template<
typename ClassType,
typename FieldType>
34 template<
typename T,
typename U>
42 template<
typename T,
typename U>
50 template<
typename T,
typename U>
Field & add(T attribute)
Adds the given attribute.
FieldFlags fieldFlags
Flags.
size_t arrayDimensions
Dimensions.
Name name
Name of the field.
static FieldWrapper< Field, FieldType > create(const Name &name, FieldType ClassType::*field)
Creates a new field instance, returning a wrapper for type safe continuation style setup.
Field(const Name &name, FieldType ClassType::*field)
Initializes a new field instance with the given name and the given pointer to member data.
Manages all Type instances currently created in the system.
@ Array
Field is an array.
@ Pointer
Field is a pointer.
Contains all Cogs related functionality.
size_t memberOffset(FieldType ClassType::*ptr)
Find the offset of a pointer to member in a class or struct.
Adds default value information to an object.
Adds range information to an object.
Adds step size information to an object.
Convenience wrapper for adding attributes during field creation in a type safe manner.
FieldWrapper & setStep(U step)
Convenience method for setting the valid value step of the field.
FieldWrapper & setDefault(U value)
Convenience method for setting the default value of the field.
FieldWrapper & setRange(U min, U max)
Convenience method for setting the valid value range of the field.
Represents an unique name.