载入中...
搜索中...
未找到
IStateProvider.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Export.h"
4#include "common/StateValue.h"
5
6#include <string>
7
8namespace eve::caps {
9
12 Preserve,
13 Reset,
14};
15
29public:
30 static constexpr const char* capabilityName = "IStateProvider";
32 virtual ~IStateProvider() = default;
33
35 virtual const char* stateKind() const = 0;
36
38 virtual bool captureState(StateValue& out) = 0;
39
45 virtual bool restoreState(const StateValue& in, std::string* err = nullptr) = 0;
46
48 virtual bool resetToDefaults() = 0;
49
51 virtual StateReloadPolicy reloadPolicy() const { return StateReloadPolicy::Preserve; }
52};
53
54} // namespace eve::caps
#define EVENGINE_API_FOUNDATION_INLINE
仅供"只有内联成员"的类型使用的组宏:拥有者 dllexport,消费方不导入。
Definition Export.h:170
JSON-compatible state value tree used by state hot reload.
Definition StateValue.h:20
Runtime-state serialization for state hot reload.
virtual ~IStateProvider()=default
I state provider.
virtual bool resetToDefaults()=0
Reset this provider to its default state (restore fallback).
virtual StateReloadPolicy reloadPolicy() const
Whether live state is preserved or reset across code reload.
virtual bool captureState(StateValue &out)=0
Serialize current runtime state into out.
virtual const char * stateKind() const =0
Stable kind label, e.g. "dialogue" / "anim" / "rpg.casting".
virtual bool restoreState(const StateValue &in, std::string *err=nullptr)=0
Restore captured state onto the (possibly new) definitions.
StateReloadPolicy
Native-state behavior during a live script reload.