JSON-compatible state value tree used by state hot reload. 更多...
#include <StateValue.h>
Public 类型 | |
| enum class | Kind { Null , Int , Float , Bool , String , Array , Object } |
Public 成员函数 | |
| StateValue ()=default | |
| Null value. | |
| Kind | kind () const |
| The kind of the stored value. | |
| bool | isNull () const |
| bool | isInt () const |
| bool | isFloat () const |
| bool | isBool () const |
| bool | isString () const |
| bool | isObject () const |
| bool | isArray () const |
| int64_t | asInt () const |
| Integer payload; only valid when kind() == Kind::Int. | |
| double | asDouble () const |
| Floating-point payload; only valid when kind() == Kind::Float. | |
| bool | asBool () const |
| Boolean payload; only valid when kind() == Kind::Bool. | |
| const std::string & | asString () const |
| String payload; only valid when kind() == Kind::String. | |
| void | pushBack (StateValue v) |
| Append an element; only valid on arrays. | |
| size_t | arraySize () const |
| Element count; only valid on arrays. | |
| StateValue & | at (size_t index) |
| Indexed element (bounds-checked); only valid on arrays. | |
| const StateValue & | at (size_t index) const |
| void | set (const std::string &key, StateValue v) |
Insert or replace key; only valid on objects. | |
| const StateValue * | find (const std::string &key) const |
Look up key; nullptr when absent. | |
| StateValue * | find (const std::string &key) |
| std::vector< std::string > | keys () const |
| Member names in insertion order. | |
| const StateValue * | get (const std::string &dottedPath) const |
| Navigate a dotted path ("a.b[2].c"). | |
| StateValue * | get (const std::string &dottedPath) |
| bool | setPath (const std::string &dottedPath, StateValue v) |
| Set a value at a dotted path, creating missing intermediate objects along the way. | |
| bool | mergeDefaults (const StateValue &defaults) |
Fill missing members from defaults; object members merge recursively, existing values are never overwritten. | |
| bool | operator== (const StateValue &o) const |
| bool | operator!= (const StateValue &o) const |
静态 Public 成员函数 | |
| static StateValue | null () |
| Null value. | |
| static StateValue | integer (int64_t v) |
| Integer value. | |
| static StateValue | number (double v) |
| Floating-point value. | |
| static StateValue | boolean (bool v) |
| Boolean value. | |
| static StateValue | string (std::string v) |
| String value. | |
| static StateValue | array () |
| Empty array. | |
| static StateValue | object () |
| Empty object. | |
详细描述
JSON-compatible state value tree used by state hot reload.
Engine modules (state providers) and script roots serialize their runtime state into this structure so a reload session can capture it before code changes and restore it afterwards. Scalars, arrays and objects map 1:1 to JSON; object members preserve insertion order.
在文件 StateValue.h 第 20 行定义.
成员枚举类型说明
◆ Kind
|
strong |
| 枚举值 | |
|---|---|
| Null | |
| Int | |
| Float | |
| Bool | |
| String | |
| Array | |
| Object | |
在文件 StateValue.h 第 22 行定义.
构造及析构函数说明
◆ StateValue()
|
default |
Null value.
成员函数说明
◆ array()
|
inlinestatic |
Empty array.
在文件 StateValue.h 第 37 行定义.
被这些函数引用 eve::card::captureCardState(), eve::rpg::captureRpgState() , 以及 eve::dialogue::Dialogue::captureState().
◆ arraySize()
|
inline |
Element count; only valid on arrays.
在文件 StateValue.h 第 64 行定义.
被这些函数引用 eve::card::restoreCardState() , 以及 eve::rpg::restoreRpgState().
◆ asBool()
|
inline |
Boolean payload; only valid when kind() == Kind::Bool.
在文件 StateValue.h 第 57 行定义.
◆ asDouble()
|
inline |
Floating-point payload; only valid when kind() == Kind::Float.
在文件 StateValue.h 第 55 行定义.
◆ asInt()
|
inline |
Integer payload; only valid when kind() == Kind::Int.
在文件 StateValue.h 第 53 行定义.
◆ asString()
|
inline |
String payload; only valid when kind() == Kind::String.
在文件 StateValue.h 第 59 行定义.
被这些函数引用 eve::card::restoreCardState(), eve::rpg::restoreRpgState(), eve::animation::AnimStateMachine::restoreState() , 以及 eve::dialogue::Dialogue::restoreState().
◆ at() [1/2]
|
inline |
Indexed element (bounds-checked); only valid on arrays.
在文件 StateValue.h 第 66 行定义.
引用了 at().
被这些函数引用 at(), at(), eve::card::restoreCardState(), eve::rpg::restoreRpgState() , 以及 eve::dialogue::Dialogue::restoreState().
◆ at() [2/2]
|
inline |
在文件 StateValue.h 第 67 行定义.
引用了 at().
◆ boolean()
|
static |
Boolean value.
在文件 StateValue.cpp 第 50 行定义.
被这些函数引用 eve::rpg::captureRpgState(), eve::animation::AnimStateMachine::captureState() , 以及 eve::dialogue::Dialogue::captureState().
◆ find() [1/2]
| StateValue * eve::StateValue::find | ( | const std::string & | key | ) |
在文件 StateValue.cpp 第 80 行定义.
◆ find() [2/2]
| const StateValue * eve::StateValue::find | ( | const std::string & | key | ) | const |
Look up key; nullptr when absent.
在文件 StateValue.cpp 第 74 行定义.
被这些函数引用 eve::dev::ReloadSession::commit(), get(), mergeDefaults(), eve::card::restoreCardState(), eve::rpg::restoreRpgState(), eve::animation::AnimStateMachine::restoreState(), eve::dialogue::Dialogue::restoreState(), eve::dev::Snapshot::restoreState() , 以及 setPath().
◆ get() [1/2]
| StateValue * eve::StateValue::get | ( | const std::string & | dottedPath | ) |
在文件 StateValue.cpp 第 117 行定义.
引用了 get().
◆ get() [2/2]
| const StateValue * eve::StateValue::get | ( | const std::string & | dottedPath | ) | const |
◆ integer()
|
static |
Integer value.
在文件 StateValue.cpp 第 38 行定义.
被这些函数引用 eve::dev::Snapshot::captureState() , 以及 eve::dialogue::Dialogue::captureState().
◆ isArray()
|
inline |
在文件 StateValue.h 第 50 行定义.
被这些函数引用 get(), eve::card::restoreCardState(), eve::rpg::restoreRpgState(), eve::dialogue::Dialogue::restoreState() , 以及 setPath().
◆ isBool()
|
inline |
在文件 StateValue.h 第 47 行定义.
被这些函数引用 eve::animation::AnimStateMachine::restoreState() , 以及 eve::dialogue::Dialogue::restoreState().
◆ isFloat()
|
inline |
在文件 StateValue.h 第 46 行定义.
◆ isInt()
|
inline |
在文件 StateValue.h 第 45 行定义.
◆ isNull()
|
inline |
在文件 StateValue.h 第 44 行定义.
◆ isObject()
|
inline |
◆ isString()
|
inline |
◆ keys()
| std::vector< std::string > eve::StateValue::keys | ( | ) | const |
Member names in insertion order.
在文件 StateValue.cpp 第 86 行定义.
被这些函数引用 eve::dev::ReloadSession::commit().
◆ kind()
|
inline |
The kind of the stored value.
在文件 StateValue.h 第 42 行定义.
◆ mergeDefaults()
| bool eve::StateValue::mergeDefaults | ( | const StateValue & | defaults | ) |
Fill missing members from defaults; object members merge recursively, existing values are never overwritten.
- 返回
- true when at least one member was added.
在文件 StateValue.cpp 第 170 行定义.
引用了 find(), isObject(), mergeDefaults() , 以及 set().
被这些函数引用 eve::dev::ReloadSession::commit() , 以及 mergeDefaults().
◆ null()
|
inlinestatic |
Null value.
在文件 StateValue.h 第 27 行定义.
被这些函数引用 eve::dev::ReloadSession::abort(), eve::dev::ReloadSession::begin() , 以及 eve::dev::ReloadSession::commit().
◆ number()
|
static |
Floating-point value.
在文件 StateValue.cpp 第 44 行定义.
被这些函数引用 eve::rpg::captureRpgState(), eve::animation::AnimStateMachine::captureState() , 以及 eve::dialogue::Dialogue::captureState().
◆ object()
|
inlinestatic |
Empty object.
在文件 StateValue.h 第 39 行定义.
被这些函数引用 eve::card::captureCardState(), eve::rpg::captureRpgState(), eve::dev::Snapshot::captureState(), eve::animation::AnimStateMachine::captureState(), eve::dialogue::Dialogue::captureState() , 以及 setPath().
◆ operator!=()
|
inline |
在文件 StateValue.h 第 100 行定义.
◆ operator==()
| bool eve::StateValue::operator== | ( | const StateValue & | o | ) | const |
◆ pushBack()
| void eve::StateValue::pushBack | ( | StateValue | v | ) |
Append an element; only valid on arrays.
在文件 StateValue.cpp 第 62 行定义.
引用了 v.
被这些函数引用 eve::card::captureCardState(), eve::rpg::captureRpgState() , 以及 eve::dialogue::Dialogue::captureState().
◆ set()
| void eve::StateValue::set | ( | const std::string & | key, |
| StateValue | v | ||
| ) |
Insert or replace key; only valid on objects.
在文件 StateValue.cpp 第 64 行定义.
引用了 v.
被这些函数引用 eve::card::captureCardState(), eve::rpg::captureRpgState(), eve::dev::Snapshot::captureState(), eve::animation::AnimStateMachine::captureState(), eve::dialogue::Dialogue::captureState(), mergeDefaults() , 以及 setPath().
◆ setPath()
| bool eve::StateValue::setPath | ( | const std::string & | dottedPath, |
| StateValue | v | ||
| ) |
Set a value at a dotted path, creating missing intermediate objects along the way.
- 返回
- false when an existing segment is the wrong type or an array index is out of bounds (arrays must be pre-sized via pushBack).
在文件 StateValue.cpp 第 121 行定义.
◆ string()
|
static |
String value.
在文件 StateValue.cpp 第 56 行定义.
被这些函数引用 eve::card::captureCardState(), eve::rpg::captureRpgState(), eve::animation::AnimStateMachine::captureState() , 以及 eve::dialogue::Dialogue::captureState().
该类的文档由以下文件生成:
- src/engine/common/StateValue.h
- src/engine/common/StateValue.cpp