Skip to content

Engine → Core → field_info.h

reflect::enum_info

Syntax

struct CONJURE_API enum_info

Variables

AccessNameTypeDefaultDescription
publicisFlagsboolfalse
publicisSignedboolfalse
publicnamestd::string{}
publictypetype_id{}
publicunderlyingSizeu324
publicvaluesstd::vector<std::pair<std::string, i64>>{}

Functions

Public

find_name

[[nodiscard]] const std::string *find_name(
    i64 value) const noexcept;

The name of the first enumerator with this exact value, or nullptr.

find_value

[[nodiscard]] std::optional<i64> find_value(
    std::string_view enumeratorName) const noexcept;

The enumerator value named name, or nullopt. Exact, case-sensitive match.

format_value

[[nodiscard]] std::optional<std::string> format_value(
    i64 value) const;

Text form of a value: the enumerator name when one matches exactly; for flags, the single-bit enumerator names joined with '|' ("" for zero without a zero enumerator). Returns nullopt when the value cannot be spelled with the known enumerators.

is_representable

[[nodiscard]] bool is_representable(
    i64 value) const noexcept;

True when value fits the underlying type (bit pattern for 64-bit unsigned). Always false when underlyingSize is not 1, 2, 4 or 8.

parse_value

[[nodiscard]] std::optional<i64> parse_value(
    std::string_view text) const;

Inverse of format_value(): an enumerator name, or for flags names separated by '|' (whitespace around names ignored, empty pieces ignored, "" is zero). Returns nullopt on any unknown name.

Operator Overloads

Public

operator==

[[nodiscard]] bool operator==(
    const enum_info &) const = default;