载入中...
搜索中...
未找到

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.
 
StateValueat (size_t index)
 Indexed element (bounds-checked); only valid on arrays.
 
const StateValueat (size_t index) const
 
void set (const std::string &key, StateValue v)
 Insert or replace key; only valid on objects.
 
const StateValuefind (const std::string &key) const
 Look up key; nullptr when absent.
 
StateValuefind (const std::string &key)
 
std::vector< std::string > keys () const
 Member names in insertion order.
 
const StateValueget (const std::string &dottedPath) const
 Navigate a dotted path ("a.b[2].c").
 
StateValueget (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.h20 行定义.

成员枚举类型说明

◆ Kind

enum class eve::StateValue::Kind
strong
枚举值
Null 
Int 
Float 
Bool 
String 
Array 
Object 

在文件 StateValue.h22 行定义.

构造及析构函数说明

◆ StateValue()

eve::StateValue::StateValue ( )
default

Null value.

成员函数说明

◆ array()

static StateValue eve::StateValue::array ( )
inlinestatic

Empty array.

在文件 StateValue.h37 行定义.

被这些函数引用 eve::card::captureCardState(), eve::rpg::captureRpgState() , 以及 eve::dialogue::Dialogue::captureState().

◆ arraySize()

size_t eve::StateValue::arraySize ( ) const
inline

Element count; only valid on arrays.

在文件 StateValue.h64 行定义.

被这些函数引用 eve::card::restoreCardState() , 以及 eve::rpg::restoreRpgState().

◆ asBool()

bool eve::StateValue::asBool ( ) const
inline

Boolean payload; only valid when kind() == Kind::Bool.

在文件 StateValue.h57 行定义.

被这些函数引用 eve::animation::AnimStateMachine::restoreState().

◆ asDouble()

double eve::StateValue::asDouble ( ) const
inline

Floating-point payload; only valid when kind() == Kind::Float.

在文件 StateValue.h55 行定义.

◆ asInt()

int64_t eve::StateValue::asInt ( ) const
inline

Integer payload; only valid when kind() == Kind::Int.

在文件 StateValue.h53 行定义.

◆ asString()

const std::string & eve::StateValue::asString ( ) const
inline

◆ at() [1/2]

StateValue & eve::StateValue::at ( size_t  index)
inline

Indexed element (bounds-checked); only valid on arrays.

在文件 StateValue.h66 行定义.

引用了 at().

被这些函数引用 at(), at(), eve::card::restoreCardState(), eve::rpg::restoreRpgState() , 以及 eve::dialogue::Dialogue::restoreState().

◆ at() [2/2]

const StateValue & eve::StateValue::at ( size_t  index) const
inline

在文件 StateValue.h67 行定义.

引用了 at().

◆ boolean()

StateValue eve::StateValue::boolean ( bool  v)
static

Boolean value.

在文件 StateValue.cpp50 行定义.

引用了 Bool , 以及 v.

被这些函数引用 eve::rpg::captureRpgState(), eve::animation::AnimStateMachine::captureState() , 以及 eve::dialogue::Dialogue::captureState().

◆ find() [1/2]

StateValue * eve::StateValue::find ( const std::string &  key)

在文件 StateValue.cpp80 行定义.

◆ find() [2/2]

◆ get() [1/2]

StateValue * eve::StateValue::get ( const std::string &  dottedPath)

在文件 StateValue.cpp117 行定义.

引用了 get().

◆ get() [2/2]

const StateValue * eve::StateValue::get ( const std::string &  dottedPath) const

Navigate a dotted path ("a.b[2].c").

返回
nullptr when any segment is missing or the wrong type.

在文件 StateValue.cpp93 行定义.

引用了 find(), idx , 以及 isArray().

被这些函数引用 get().

◆ integer()

StateValue eve::StateValue::integer ( int64_t  v)
static

Integer value.

在文件 StateValue.cpp38 行定义.

引用了 Int , 以及 v.

被这些函数引用 eve::dev::Snapshot::captureState() , 以及 eve::dialogue::Dialogue::captureState().

◆ isArray()

bool eve::StateValue::isArray ( ) const
inline

◆ isBool()

bool eve::StateValue::isBool ( ) const
inline

◆ isFloat()

bool eve::StateValue::isFloat ( ) const
inline

在文件 StateValue.h46 行定义.

◆ isInt()

bool eve::StateValue::isInt ( ) const
inline

在文件 StateValue.h45 行定义.

被这些函数引用 eve::dialogue::Dialogue::restoreState().

◆ isNull()

bool eve::StateValue::isNull ( ) const
inline

在文件 StateValue.h44 行定义.

◆ isObject()

◆ isString()

bool eve::StateValue::isString ( ) const
inline

◆ keys()

std::vector< std::string > eve::StateValue::keys ( ) const

Member names in insertion order.

在文件 StateValue.cpp86 行定义.

被这些函数引用 eve::dev::ReloadSession::commit().

◆ kind()

Kind eve::StateValue::kind ( ) const
inline

The kind of the stored value.

在文件 StateValue.h42 行定义.

◆ 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.cpp170 行定义.

引用了 find(), isObject(), mergeDefaults() , 以及 set().

被这些函数引用 eve::dev::ReloadSession::commit() , 以及 mergeDefaults().

◆ null()

static StateValue eve::StateValue::null ( )
inlinestatic

Null value.

在文件 StateValue.h27 行定义.

被这些函数引用 eve::dev::ReloadSession::abort(), eve::dev::ReloadSession::begin() , 以及 eve::dev::ReloadSession::commit().

◆ number()

StateValue eve::StateValue::number ( double  v)
static

Floating-point value.

在文件 StateValue.cpp44 行定义.

引用了 Float , 以及 v.

被这些函数引用 eve::rpg::captureRpgState(), eve::animation::AnimStateMachine::captureState() , 以及 eve::dialogue::Dialogue::captureState().

◆ object()

◆ operator!=()

bool eve::StateValue::operator!= ( const StateValue o) const
inline

在文件 StateValue.h100 行定义.

◆ operator==()

bool eve::StateValue::operator== ( const StateValue o) const

在文件 StateValue.cpp185 行定义.

引用了 Array, Bool, Float, Int, Null, Object , 以及 String.

◆ pushBack()

void eve::StateValue::pushBack ( StateValue  v)

Append an element; only valid on arrays.

在文件 StateValue.cpp62 行定义.

引用了 v.

被这些函数引用 eve::card::captureCardState(), eve::rpg::captureRpgState() , 以及 eve::dialogue::Dialogue::captureState().

◆ set()

void eve::StateValue::set ( const std::string &  key,
StateValue  v 
)

◆ 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.cpp121 行定义.

引用了 find(), isArray(), isObject(), object(), set() , 以及 v.

◆ string()

StateValue eve::StateValue::string ( std::string  v)
static

该类的文档由以下文件生成: