Skip to content

Engine → Core

field_info.h

Field descriptions.

Structs

File Description
reflect::detail::std_array_traits
reflect::detail::std_array_traits<std::array<ElementType, N>>
reflect::enum_info A reflected enumeration: its enumerators by name and value plus the storage width.
reflect::field_attributes Editor hints attached to a field. Set through the CONJURE_FIELD designated-initialiser list.
reflect::field_info One reflected member of a struct.
reflect::reflect_traits<bool>
reflect::reflect_traits<f32>
reflect::reflect_traits<f64>
reflect::reflect_traits<i16>
reflect::reflect_traits<i32>
reflect::reflect_traits<i64>
reflect::reflect_traits<i8>
reflect::reflect_traits<math::mat4>
reflect::reflect_traits<math::quat>
reflect::reflect_traits<math::transform>
reflect::reflect_traits<math::vec2>
reflect::reflect_traits<math::vec3>
reflect::reflect_traits<math::vec4>
reflect::reflect_traits<std::string>
reflect::reflect_traits<string_id>
reflect::reflect_traits<T>
reflect::reflect_traits<u16>
reflect::reflect_traits<u32>
reflect::reflect_traits<u64>
reflect::reflect_traits<u8>
reflect::reflect_traits<uuid>
std::formatter<conjure::core::reflect::field_kind>

Enumerations

reflect::field_kind

enum class field_kind : u8 {
    BOOL,
    I8,
    I16,
    I32,
    I64,
    U8,
    U16,
    U32,
    U64,
    F32,
    F64,
    STRING,         // std::string
    STRING_ID,      // core::string_id
    UUID,           // core::uuid
    VEC2,
    VEC3,
    VEC4,
    QUAT,           // stored x, y, z, w
    MAT4,           // column-major, 16 floats
    TRANSFORM,      // math::transform
    ENUM,           // enum described with CONJURE_REFLECT_ENUM (field_info::enumType)
    STRUCT,         // nested reflected struct (field_info::structType)
    ARRAY,          // std::array<T, N> of any other kind
    ENTITY,         // handle owned by the ecs module (reflect_kind_override)
    ASSET_REF,      // handle owned by the assets module (reflect_kind_override)
    COUNT
};

What a field holds. ARRAY fields describe their element in field_info::elementKind.

reflect::field_unit

enum class field_unit : u8 {
    NONE,
    RADIANS,
    DEGREES
};

The unit a float field is stored in, as a display hint (field_attributes::unit). The value, its min, max and step and its JSON form stay in this unit; the editor's inspector shows a RADIANS field in degrees and converts what is typed back, and marks a DEGREES field as degrees. Only F32 and F64 fields (and arrays of them) may carry a unit other than NONE (validate_layout).

Type Aliases

reflect::detail::std_array_traits<std::array<ElementType, N>>::element_type

using element_type = ElementType;

Concepts

reflect::detail::distinct_platform_integer

template <typename T> concept distinct_platform_integer = (std::is_same_v<T, long> || std::is_same_v<T, unsigned long> || std::is_same_v<T, long long> || std::is_same_v<T, unsigned long long>) && !std::is_same_v<T, i32> && !std::is_same_v<T, u32> && !std::is_same_v<T, i64> && !std::is_same_v<T, u64>;

The platform integer types that are distinct from every fixed-width alias on the current target: long is 32 bits on Windows and 64 bits elsewhere, long long is i64 on Windows and macOS but not on Linux, usize is unsigned long on macOS and Linux. Members of these types reflect as the fixed-width kind of the same width and signedness so a struct with a usize or long member describes identically on every platform.

reflect::has_reflect_kind

template <typename T> concept has_reflect_kind = requires { { reflect_traits<std::remove_cvref_t<T>>::KIND } -> std::convertible_to<field_kind>; };

True when reflect_traits<T> provides a KIND (built-in kinds, reflected structs and enums).

reflect::reflectable

template <typename T> concept reflectable = has_kind_override<T> || has_reflect_kind<T> || (std_array<T> && (has_kind_override<typename detail::std_array_traits<std::remove_cvref_t<T>>::element_type> || has_reflect_kind<typename detail::std_array_traits<std::remove_cvref_t<T>>::element_type>));

True when T has a field kind: a kind override, a built-in or macro-described kind, or a std::array of such a type (arrays of arrays are not reflectable).

reflect::std_array

template <typename T> concept std_array = detail::std_array_traits<std::remove_cvref_t<T>>::IS_ARRAY;

True for std::array<T, N>.

Forward Declarations

reflect::type_info

struct type_info;

Constants

Name Type Value Description
reflect::detail::ALWAYS_FALSE template <typename T> inline constexpr bool false

Functions

Public

reflect::detail::platform_integer_kind

template <typename T> [[nodiscard]] consteval field_kind platform_integer_kind() noexcept;

reflect::detail::platform_integer_name

template <typename T> [[nodiscard]] consteval std::string_view platform_integer_name() noexcept;

reflect::is_custom_kind

[[nodiscard]] constexpr bool is_custom_kind(field_kind kind) noexcept;

True for the kinds supplied by other modules through reflect_kind_override.

reflect::is_fixed_size_kind

[[nodiscard]] constexpr bool is_fixed_size_kind(field_kind kind) noexcept;

True for the kinds whose size and alignment are fixed by the kind alone.

reflect::is_float_kind

[[nodiscard]] constexpr bool is_float_kind(field_kind kind) noexcept;

True for F32 and F64.

reflect::is_integer_kind

[[nodiscard]] constexpr bool is_integer_kind(field_kind kind) noexcept;

True for the integer kinds I8..U64.

reflect::is_valid_enum_size

[[nodiscard]] constexpr bool is_valid_enum_size(u32 underlyingSize) noexcept;

True for the storage widths an enumeration may have: 1, 2, 4 or 8 bytes. Every consumer of an enum_info (registration, layout validation, JSON conversion) rejects other widths.

reflect::kind_alignment

[[nodiscard]] constexpr u32 kind_alignment(field_kind kind) noexcept;

Natural alignment of a fixed-size kind; 0 for the kinds whose alignment depends on the field.

reflect::kind_of

template <typename T> [[nodiscard]] constexpr field_kind kind_of() noexcept;

The field kind of T, decided at compile time. Fails to compile with a message naming the problem when T is not reflectable.

reflect::kind_size

[[nodiscard]] constexpr u32 kind_size(field_kind kind) noexcept;

Size in bytes of a fixed-size kind; 0 for ENUM, STRUCT, ARRAY, ENTITY and ASSET_REF whose size depends on the field.

reflect::parse_field_kind

[[nodiscard]] CONJURE_API std::optional<field_kind> parse_field_kind(std::string_view name) noexcept;

Parses an enumerator name produced by to_string() (exact match). Returns nullopt otherwise.

reflect::to_string

[[nodiscard]] CONJURE_API std::string_view to_string(field_kind kind) noexcept;

Returns the stable upper-case enumerator name of a kind ("VEC3"); "UNKNOWN" for COUNT and out-of-range values.

[[nodiscard]] CONJURE_API std::string_view to_string(field_unit unit) noexcept;

The lower-case name of a unit, as the editor protocol sends it in a field's attributes: "none", "radians" or "degrees"; "unknown" for a value outside the enumeration.