载入中...
搜索中...
未找到
Value.cpp
浏览该文件的文档.
24 Diagnostic::error(DiagnosticCode::ParseError, "JSON integer is outside the canonical Int64 range"));
52 return Result<Value>::failure(Diagnostic::error(DiagnosticCode::ParseError, "unsupported JSON value kind"));
#define EV_ASSERT(cond,...)
Assert an internal engine invariant (state that must always hold).
Definition Assert.h:37
Owning, renderer-independent dynamic values.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
Result< std::string > toJson() const
Serialize this value as deterministic compact JSON.
Definition Value.cpp:67
const std::string & asString() const
Return the string payload; the caller must have checked the kind.
Definition Value.cpp:87
static Result< Value > fromJson(std::string_view json)
Parse one strict JSON value into an owning Value.
Definition Value.cpp:57
std::string typeName() const
Return the compatibility type name used by dialogue scripts.
Definition Value.cpp:150
std::vector< std::string > keys() const
Return object member names in deterministic order.
Definition Value.cpp:138
double asDouble() const
Return the Double payload; the caller must have checked the kind.
Definition Value.cpp:75
void set(const std::string &key, Value value)
Insert or replace an object member.
Definition Value.cpp:118
std::int64_t asInt() const
Return the Int64 payload; the caller must have checked the kind.
Definition Value.cpp:69
@ String
@ Array
@ Object
@ Null
@ Bool
@ Double
@ Int64
std::string toString() const
Render a scalar using the former dialogue formatting rules.
Definition Value.cpp:163
bool asBool() const
Return the boolean payload; the caller must have checked the kind.
Definition Value.cpp:81
Value * find(const std::string &key) noexcept
Return an object member, or nullptr when absent.
Definition Value.cpp:124
static Document parse(const std::string &text, std::string *error=nullptr)
Parse.
Definition Json.cpp:581
std::variant< std::monostate, std::int64_t, double, std::string, bool > Value
Definition Database.h:26
Result< std::string > stringify(const eve::Value &value)
Serialize the canonical owning Value as deterministic compact JSON.
Definition Json.cpp:563
@ ParseError