45 bool isNull()
const {
return kind_ == Kind::Null; }
46 bool isInt()
const {
return kind_ == Kind::Int; }
47 bool isFloat()
const {
return kind_ == Kind::Float; }
48 bool isBool()
const {
return kind_ == Kind::Bool; }
49 bool isString()
const {
return kind_ == Kind::String; }
50 bool isObject()
const {
return kind_ == Kind::Object; }
51 bool isArray()
const {
return kind_ == Kind::Array; }
54 int64_t
asInt()
const {
return i_; }
60 const std::string&
asString()
const {
return s_; }
76 std::vector<std::string> keys()
const;
82 const StateValue* get(
const std::string& dottedPath)
const;
83 StateValue* get(
const std::string& dottedPath);
91 bool setPath(
const std::string& dottedPath,
StateValue v);
98 bool mergeDefaults(
const StateValue& defaults);
106 Kind kind_ = Kind::Null;
111 std::vector<StateValue> arr_;
112 std::vector<std::pair<std::string, StateValue>> obj_;
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
JSON-compatible state value tree used by state hot reload.
static StateValue object()
Empty object.
Kind kind() const
The kind of the stored value.
bool operator!=(const StateValue &o) const
static StateValue array()
Empty array.
int64_t asInt() const
Integer payload; only valid when kind() == Kind::Int.
bool asBool() const
Boolean payload; only valid when kind() == Kind::Bool.
size_t arraySize() const
Element count; only valid on arrays.
double asDouble() const
Floating-point payload; only valid when kind() == Kind::Float.
const std::string & asString() const
String payload; only valid when kind() == Kind::String.
const StateValue & at(size_t index) const
static StateValue null()
Null value.
StateValue()=default
Null value.
StateValue & at(size_t index)
Indexed element (bounds-checked); only valid on arrays.
Build metadata (engine git commit, build time, third-party version).
enum EVENGINE_API_FOUNDATION Float
OT_FLOAT.
enum EVENGINE_API_FOUNDATION Bool
OT_BOOL.
enum EVENGINE_API_FOUNDATION String
OT_STRING.
enum EVENGINE_API_FOUNDATION Array
OT_ARRAY (editable via Runtime array APIs / ReflectedPropertyModel).