载入中...
搜索中...
未找到
IStateProvider.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Export.h"
4#include "common/Result.h"
5#include "common/StateValue.h"
6
7#include <string>
8
9namespace eve::caps {
10
13 Preserve,
14 Reset,
15};
16
30public:
31 static constexpr const char* capabilityName = "IStateProvider";
33 virtual ~IStateProvider() = default;
34
36 virtual const char* stateKind() const = 0;
37
44 [[nodiscard]] virtual Result<Value> capture() = 0;
45
54 [[nodiscard]] virtual Result<void> restore(const Value& in) = 0;
55
57 [[nodiscard]] virtual Result<void> resetToDefaults() = 0;
58
60 virtual StateReloadPolicy reloadPolicy() const { return StateReloadPolicy::Preserve; }
61};
62
63} // namespace eve::caps
#define EVENGINE_API_FOUNDATION_INLINE
仅供"只有内联成员"的类型使用的组宏:拥有者 dllexport,消费方不导入。
Definition Export.h:170
Move-only, checked operation results for the common layer.
Move-only operation result carrying either a value or Status.
Definition Result.h:176
The canonical owning dynamic value used by data-facing protocols.
Definition Value.h:31
Runtime-state serialization for state hot reload.
virtual Result< void > resetToDefaults()=0
Reset this provider to its default state (Reset reload policy).
virtual ~IStateProvider()=default
I state provider.
virtual Result< void > restore(const Value &in)=0
Restore captured state onto the (possibly new) definitions.
virtual StateReloadPolicy reloadPolicy() const
Whether live state is preserved or reset across code reload.
virtual const char * stateKind() const =0
Stable kind label, e.g. "dialogue" / "anim" / "rpg.casting".
virtual Result< Value > capture()=0
Capture an owning, canonical snapshot of this provider.
StateReloadPolicy
Native-state behavior during a live script reload.