type_info.h
| File Path | engine/include/conjure/core/reflect/type_info.h |
| API ↗ | Reflection |
Struct descriptions.
Structs
| File | Description |
|---|---|
reflect::type_info |
Layout and fields of a reflected struct. |
Concepts
reflect::reflected_enum
template <typename T> concept reflected_enum = has_reflect_kind<T> && requires { requires reflect_traits<std::remove_cvref_t<T>>::KIND == field_kind::ENUM; { reflect_traits<std::remove_cvref_t<T>>::describe() } -> std::same_as<enum_info>; };
True for enumerations described with CONJURE_REFLECT_ENUM / CONJURE_REFLECT_FLAGS.
reflect::reflected_struct
template <typename T> concept reflected_struct = has_reflect_kind<T> && requires { requires reflect_traits<std::remove_cvref_t<T>>::KIND == field_kind::STRUCT; { reflect_traits<std::remove_cvref_t<T>>::describe() } -> std::same_as<type_info>; };
True for structs described with CONJURE_REFLECT_STRUCT.
Functions
Public
reflect::build_type_info
reflect::build_type_info[[nodiscard]] CONJURE_API result<type_info> build_type_info( std::string name, u32 size, u32 alignment, std::span<const field_info> fields );Builds and validates a description at runtime (dynamic C# components). The type id is derived from the name, isTriviallyCopyable from the fields. Fails with INVALID_ARGUMENT when the layout is inconsistent (see validate_layout).
reflect::describe_enum
reflect::describe_enumtemplate <reflected_enum T> [[nodiscard]] enum_info describe_enum();A fresh description of a macro-reflected enumeration, without registering it.
reflect::describe_struct
reflect::describe_structtemplate <reflected_struct T> [[nodiscard]] type_info describe_struct();A fresh description of a macro-reflected struct, without registering it. Nested struct and enum fields still point at the registered descriptions of their types.
reflect::validate_layout
reflect::validate_layoutChecks a description for internal consistency: non-empty names usable in field paths, every field inside the struct, no overlapping fields, natural alignment of every field (and no field stricter than the type's own alignment), a size that matches the kind (fixed kinds, enums, nested structs and arrays), struct/enum pointers present where the kind needs them, field ids matching the pointed-to description, enum widths of 1, 2, 4 or 8 bytes, and a unit attribute (field_unit) other than NONE only on F32 and F64 fields and arrays of them. Fails with INVALID_ARGUMENT naming the offending field.