Skip to content

Engine → Scripting → script_class_registry.h

script_class_registry

Syntax

class CONJURE_API script_class_registry

Constructors

AccessSignatureDescription
publicscript_class_registry();
publicscript_class_registry( script_class_registry &&) noexcept = default;

Important

Copy constructor and assignment has been deleted.

Destructors

AccessSignatureDescription
public~script_class_registry();

Variables

AccessNameTypeDefaultDescription
privatemActivetable{}
privatemStagingtable{}
privatemStagingOpenboolfalse

Functions

Public

begin_staging

void begin_staging();

Empties the staging half and opens it for stage_class/stage_field.

classes

[[nodiscard]] std::span<const script_class_info> classes() const noexcept;

Active classes in registration order.

clear

void clear();

Empties both halves.

commit_staging

void commit_staging();

Sorts every staged class' fields, makes the staging half active and closes staging. Requires an open staging (begin_staging); otherwise asserts and leaves the active table untouched.

discard_staging

void discard_staging();

Drops the staging half; the active schema is untouched.

find

[[nodiscard]] const script_class_info *find(
    u64 classHash) const noexcept;

The active class with this hash, or nullptr.

[[nodiscard]] const script_class_info *find(
    std::string_view fullName) const noexcept;

The active class with this full name, or nullptr.

find_staged

[[nodiscard]] const script_class_info *find_staged(
    u64 classHash) const noexcept;

The staged class with this hash, or nullptr.

index_of

[[nodiscard]] u32 index_of(
    u64 classHash) const noexcept;

Dense index of an active class (the order of classes()), or UINT32_MAX.

is_staging_open

[[nodiscard]] bool is_staging_open() const noexcept;

size

[[nodiscard]] usize size() const noexcept;

stage_class

[[nodiscard]] core::result<void> stage_class(
    script_class_info info);

Adds a class to the staging half. ALREADY_EXISTS for a hash already staged, INVALID_STATE when no staging is open.

stage_field

[[nodiscard]] core::result<void> stage_field(
    u64 classHash,
    script_field_info field);

Adds a field to a staged class. CLASS_NOT_FOUND, ALREADY_EXISTS for a duplicate field hash.

staged_classes

[[nodiscard]] std::span<const script_class_info> staged_classes() const noexcept;

Private

find_in

[[nodiscard]] static const script_class_info *find_in(
    const table &source,
    u64 classHash) noexcept;

Operator Overloads

Public

operator=

script_class_registry &operator=(
    script_class_registry &&) noexcept = default;