载入中...
搜索中...
未找到
Value.cpp
浏览该文件的文档.
29 return Result<std::string>::failure(Diagnostic::error(DiagnosticCode::ParseError, "expected a string field"));
33Result<std::string> readNonEmptyStringMember(const Value::Object& object, std::string_view name) {
44 return Result<int>::failure(Diagnostic::error(DiagnosticCode::TypeMismatch, "expected an Int64 value"));
46 return Result<int>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "integer exceeds int range"));
53 return Result<bool>::failure(Diagnostic::error(DiagnosticCode::TypeMismatch, "expected a Bool value"));
78 return Result<double>::failure(Diagnostic::error(DiagnosticCode::TypeMismatch, "expected Int64 or Double"));
88 return Result<float>::failure(Diagnostic::error(DiagnosticCode::TypeMismatch, "expected Integer or Double"));
104Result<json::UnsignedIntegerScan> scanUnsignedStringMember(const Value::Object& object, std::string_view name) {
131Value Value::object(std::initializer_list<Object::value_type> members) { return Value(Object(members)); }
144 Diagnostic::error(DiagnosticCode::ParseError, "JSON integer is outside the canonical Int64 range"));
172 return Result<Value>::failure(Diagnostic::error(DiagnosticCode::ParseError, "unsupported JSON value kind"));
299template __declspec(dllexport) const std::monostate* eve::Value::getIf<std::monostate>() const noexcept;
303template __declspec(dllexport) const std::int64_t* eve::Value::getIf<std::int64_t>() const noexcept;
307template __declspec(dllexport) const std::string* eve::Value::getIf<std::string>() const noexcept;
308template __declspec(dllexport) eve::Value::Array* eve::Value::getIf<eve::Value::Array>() noexcept;
309template __declspec(dllexport) const eve::Value::Array* eve::Value::getIf<eve::Value::Array>() const noexcept;
310template __declspec(dllexport) eve::Value::Object* eve::Value::getIf<eve::Value::Object>() noexcept;
311template __declspec(dllexport) const eve::Value::Object* eve::Value::getIf<eve::Value::Object>() const noexcept;
EVEngine assertion entry point, backed by zeroerr.
#define EV_ASSERT(cond,...)
Assert an internal engine invariant (state that must always hold).
Definition Assert.h:37
std::map< std::string, std::span< const std::uint8_t > > members
Definition UnityPackage.cpp:81
Owning, renderer-independent dynamic values.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
Result< std::string > toJson() const
Serialize this value as deterministic compact JSON.
Definition Value.cpp:187
const std::string & asString() const
Return the string payload; the caller must have checked the kind.
Definition Value.cpp:207
static Result< Value > fromJson(std::string_view json)
Parse one strict JSON value into an owning Value.
Definition Value.cpp:177
std::string typeName() const
Return the compatibility type name used by dialogue scripts.
Definition Value.cpp:270
std::vector< std::string > keys() const
Return object member names in deterministic order.
Definition Value.cpp:258
double asDouble() const
Return the Double payload; the caller must have checked the kind.
Definition Value.cpp:195
void set(const std::string &key, Value value)
Insert or replace an object member.
Definition Value.cpp:238
Value & operator=(const Value &other)
Replace this payload with a recursive copy.
std::int64_t asInt() const
Return the Int64 payload; the caller must have checked the kind.
Definition Value.cpp:189
@ String
@ Array
@ Object
@ Null
@ Bool
@ Double
@ Int64
std::string toString() const
Render a scalar using the former dialogue formatting rules.
Definition Value.cpp:283
bool operator==(const Value &) const
Compare two values recursively, including their numeric kinds.
Definition Value.cpp:126
bool asBool() const
Return the boolean payload; the caller must have checked the kind.
Definition Value.cpp:201
Value * find(const std::string &key) noexcept
Return an object member, or nullptr when absent.
Definition Value.cpp:244
static Document parse(const std::string &text, std::string *error=nullptr)
Parse.
Definition Json.cpp:623
std::variant< std::monostate, std::int64_t, double, std::string, bool > Value
Definition Database.h:27
void keys(const Value &value, std::initializer_list< const char * > names)
Definition OceanCodecInternal.h:8
Result< std::string > stringify(const eve::Value &value)
Serialize the canonical owning Value as deterministic compact JSON.
Definition Json.cpp:605
@ ParseError
@ Object
Result< float > readFiniteFloatValue(const Value &value)
Convert an Integer or Double to a finite Float after validating its source range.
Definition Value.cpp:81
Result< bool > readBoolValue(const Value &value)
Read a Bool without coercing integers, strings or other kinds.
Definition Value.cpp:50
Result< int > readIntValue(const Value &value)
Read an Int64 value as a range-checked native int without numeric coercion.
Definition Value.cpp:41
Result< json::UnsignedIntegerScan > scanUnsignedStringMember(const Value::Object &object, std::string_view name)
Scan a required nonempty decimal-string field using from_chars semantics.
Definition Value.cpp:104
Result< std::string > readStringMember(const Value::Object &object, std::string_view name)
Read a required string field, including an empty string, as an owning value.
Definition Value.cpp:25
Result< json::UnsignedIntegerScan > scanUnsignedStringValue(const Value &value)
Scan an unsigned decimal prefix from a required nonempty String value.
Definition Value.cpp:96
Result< std::string > readNonEmptyStringMember(const Value::Object &object, std::string_view name)
Read a required nonempty string field as an independent owning value.
Definition Value.cpp:33
Result< std::int64_t > readInt64Value(const Value &value)
Read an Int64 without narrowing or numeric coercion.
Definition Value.cpp:57
Result< std::uint32_t > readUInt32Value(const Value &value)
Read an Int64 as a range-checked UInt32 without numeric coercion.
Definition Value.cpp:65
Result< double > readNumericDoubleValue(const Value &value)
Read an Int64 or Double as a double without imposing a finite-value policy.
Definition Value.cpp:74
enum EVENGINE_API_FOUNDATION Array
OT_ARRAY (editable via Runtime array APIs / ReflectedPropertyModel).
Definition Runtime.h:120
Definition Container.h:602