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

JSON-compatible state value tree used by state hot reload. 更多...

#include <StateValue.h>

Public 类型

enum class  Kind {
  Null , Int , Float , Bool ,
  String , Array , Object
}
 Kind public API. 更多...
 

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

enum class eve::StateValue::Kind
strong

Kind public API.

枚举值
Null 
Int 
Float 
Bool 
String 
Array 
Object 

在文件 StateValue.h 第 23 行定义.

构造及析构函数说明

◆ StateValue()

eve::StateValue::StateValue ( )
default

Null value.

成员函数说明

◆ array()

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

◆ arraySize()

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

Element count; only valid on arrays.

在文件 StateValue.h 第 65 行定义.

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

◆ asBool()

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

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

在文件 StateValue.h 第 58 行定义.

◆ asDouble()

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

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

在文件 StateValue.h 第 56 行定义.

◆ asInt()

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

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

在文件 StateValue.h 第 54 行定义.

被这些函数引用 eve::dialogue::ConversationSaveMigrations::migrate().

◆ asString()

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

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

在文件 StateValue.h 第 60 行定义.

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

◆ at() [1/2]

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

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

在文件 StateValue.h 第 67 行定义.

引用了 at() , 以及 index.

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

◆ at() [2/2]

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

在文件 StateValue.h 第 68 行定义.

引用了 at() , 以及 index.

◆ boolean()

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

◆ find() [1/2]

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

在文件 StateValue.cpp 第 80 行定义.

引用了 key.

◆ find() [2/2]

◆ 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

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

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

在文件 StateValue.cpp 第 93 行定义.

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

被这些函数引用 get().

◆ integer()

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

◆ isArray()

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

◆ isBool()

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

◆ isFloat()

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

在文件 StateValue.h 第 47 行定义.

◆ isInt()

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

◆ isNull()

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

在文件 StateValue.h 第 45 行定义.

◆ isObject()

◆ isString()

◆ keys()

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

Member names in insertion order.

在文件 StateValue.cpp 第 86 行定义.

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

◆ kind()

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

The kind of the stored value.

在文件 StateValue.h 第 43 行定义.

◆ 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()

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

◆ number()

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

◆ object()

◆ operator!=()

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

在文件 StateValue.h 第 101 行定义.

◆ operator==()

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

在文件 StateValue.cpp 第 185 行定义.

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

◆ 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() , 以及 eve::dialogue::toDialogueStateValue().

◆ 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.cpp 第 121 行定义.

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

◆ string()


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