mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-11-30 13:07:19 +01:00
Minor updates to the JSON module.
This commit is contained in:
@@ -26,6 +26,13 @@ namespace SqMod {
|
||||
#define SQJSON_VERSION_MINOR 0
|
||||
#define SQJSON_VERSION_PATCH 1
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Forward declarations.
|
||||
*/
|
||||
class JValue;
|
||||
class JArray;
|
||||
class JObject;
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Implements RAII to free the strings obtained from dumps even after exceptions.
|
||||
*/
|
||||
@@ -56,11 +63,20 @@ struct CStrGuard
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Forward declarations.
|
||||
* Class that represents an error occurred while parsing JSON data.
|
||||
*/
|
||||
class JValue;
|
||||
class JArray;
|
||||
class JObject;
|
||||
struct JError
|
||||
{
|
||||
public:
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
json_error_t mErr; // The managed error instance.
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Default constructor.
|
||||
*/
|
||||
JError();
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Retrieve the string representation of JSON value type.
|
||||
@@ -75,6 +91,11 @@ inline CSStr JSONTypeStr(json_t * ptr)
|
||||
return (ptr == nullptr) ? _SC("unknown") : JSONTypeToStr(json_typeof(ptr));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Convert a script value from the stack to a JSON object.
|
||||
*/
|
||||
Object SqFromJSON(HSQUIRRELVM vm, json_t * jval);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Convert a script value from the stack to a JSON object.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user