@amxts/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +162 -0
- package/README.ru.md +162 -0
- package/amxmodx/base/include/amxconst.inc +594 -0
- package/amxmodx/base/include/amxmisc.inc +902 -0
- package/amxmodx/base/include/amxmodx.inc +3447 -0
- package/amxmodx/base/include/amxmodx_version.inc +20 -0
- package/amxmodx/base/include/cellarray.inc +525 -0
- package/amxmodx/base/include/cellstack.inc +166 -0
- package/amxmodx/base/include/celltrie.inc +412 -0
- package/amxmodx/base/include/core.inc +202 -0
- package/amxmodx/base/include/csstats.inc +298 -0
- package/amxmodx/base/include/csstats_const.inc +29 -0
- package/amxmodx/base/include/cstrike.inc +1287 -0
- package/amxmodx/base/include/cstrike_const.inc +521 -0
- package/amxmodx/base/include/csx.inc +259 -0
- package/amxmodx/base/include/cvars.inc +547 -0
- package/amxmodx/base/include/datapack.inc +161 -0
- package/amxmodx/base/include/dbi.inc +154 -0
- package/amxmodx/base/include/dodconst.inc +152 -0
- package/amxmodx/base/include/dodfun.inc +152 -0
- package/amxmodx/base/include/dodstats.inc +69 -0
- package/amxmodx/base/include/dodx.inc +161 -0
- package/amxmodx/base/include/engine.inc +1343 -0
- package/amxmodx/base/include/engine_const.inc +310 -0
- package/amxmodx/base/include/engine_stocks.inc +248 -0
- package/amxmodx/base/include/esf.inc +70 -0
- package/amxmodx/base/include/esf_const.inc +74 -0
- package/amxmodx/base/include/fakemeta.inc +1127 -0
- package/amxmodx/base/include/fakemeta_const.inc +793 -0
- package/amxmodx/base/include/fakemeta_stocks.inc +395 -0
- package/amxmodx/base/include/fakemeta_util.inc +882 -0
- package/amxmodx/base/include/file.inc +666 -0
- package/amxmodx/base/include/float.inc +422 -0
- package/amxmodx/base/include/fun.inc +333 -0
- package/amxmodx/base/include/gameconfig.inc +93 -0
- package/amxmodx/base/include/geoip.inc +264 -0
- package/amxmodx/base/include/ham_const.inc +4352 -0
- package/amxmodx/base/include/hamsandwich.inc +439 -0
- package/amxmodx/base/include/hlsdk_const.inc +808 -0
- package/amxmodx/base/include/json.inc +777 -0
- package/amxmodx/base/include/lang.inc +119 -0
- package/amxmodx/base/include/message_const.inc +1130 -0
- package/amxmodx/base/include/message_stocks.inc +161 -0
- package/amxmodx/base/include/messages.inc +604 -0
- package/amxmodx/base/include/newmenus.inc +387 -0
- package/amxmodx/base/include/ns.inc +754 -0
- package/amxmodx/base/include/ns_const.inc +196 -0
- package/amxmodx/base/include/nvault.inc +154 -0
- package/amxmodx/base/include/regex.inc +348 -0
- package/amxmodx/base/include/sockets.inc +183 -0
- package/amxmodx/base/include/sorting.inc +107 -0
- package/amxmodx/base/include/sqlx.inc +582 -0
- package/amxmodx/base/include/string.inc +786 -0
- package/amxmodx/base/include/string_const.inc +156 -0
- package/amxmodx/base/include/string_stocks.inc +325 -0
- package/amxmodx/base/include/textparse_ini.inc +214 -0
- package/amxmodx/base/include/textparse_smc.inc +261 -0
- package/amxmodx/base/include/tfcconst.inc +84 -0
- package/amxmodx/base/include/tfcstats.inc +62 -0
- package/amxmodx/base/include/tfcx.inc +148 -0
- package/amxmodx/base/include/time.inc +118 -0
- package/amxmodx/base/include/tsconst.inc +154 -0
- package/amxmodx/base/include/tsfun.inc +198 -0
- package/amxmodx/base/include/tsstats.inc +65 -0
- package/amxmodx/base/include/tsx.inc +88 -0
- package/amxmodx/base/include/vault.inc +60 -0
- package/amxmodx/base/include/vector.inc +131 -0
- package/amxmodx/base/include/xs.inc +1570 -0
- package/as/amxts.d.ts +153 -0
- package/as/constants.ts +4730 -0
- package/as/effects.ts +1449 -0
- package/as/entities.ts +5482 -0
- package/as/events.ts +3054 -0
- package/as/facade.ts +4639 -0
- package/as/flags.ts +299 -0
- package/as/fs.ts +287 -0
- package/as/hooks.ts +18536 -0
- package/as/kit.ts +25 -0
- package/as/lib/check.ts +86 -0
- package/as/modules/http.ts +184 -0
- package/as/natives.ts +11845 -0
- package/as/os.ts +30 -0
- package/as/promise.ts +1392 -0
- package/as/promise.types.d.ts +82 -0
- package/as/remote.ts +288 -0
- package/as/tsconfig.json +22 -0
- package/as/vector.ts +65 -0
- package/bin/amxts.mjs +10 -0
- package/includes/menu_core.inc +355 -0
- package/includes/order.txt +54 -0
- package/includes/sources.json +27 -0
- package/includes/universal_config.inc +355 -0
- package/lint/oxlint-plugin.mjs +77 -0
- package/node_modules/assemblyscript/LICENSE +201 -0
- package/node_modules/assemblyscript/NOTICE +93 -0
- package/node_modules/assemblyscript/package.json +63 -0
- package/node_modules/assemblyscript/std/README.md +6 -0
- package/node_modules/assemblyscript/std/assembly/array.ts +526 -0
- package/node_modules/assemblyscript/std/assembly/arraybuffer.ts +77 -0
- package/node_modules/assemblyscript/std/assembly/atomics.ts +127 -0
- package/node_modules/assemblyscript/std/assembly/bindings/asyncify.ts +16 -0
- package/node_modules/assemblyscript/std/assembly/bindings/dom.ts +291 -0
- package/node_modules/assemblyscript/std/assembly/bindings/node.ts +6 -0
- package/node_modules/assemblyscript/std/assembly/builtins.ts +2631 -0
- package/node_modules/assemblyscript/std/assembly/compat.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/console.ts +42 -0
- package/node_modules/assemblyscript/std/assembly/crypto.ts +9 -0
- package/node_modules/assemblyscript/std/assembly/dataview.ts +181 -0
- package/node_modules/assemblyscript/std/assembly/date.ts +373 -0
- package/node_modules/assemblyscript/std/assembly/diagnostics.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/error.ts +44 -0
- package/node_modules/assemblyscript/std/assembly/function.ts +38 -0
- package/node_modules/assemblyscript/std/assembly/index.d.ts +2822 -0
- package/node_modules/assemblyscript/std/assembly/iterator.ts +35 -0
- package/node_modules/assemblyscript/std/assembly/map.ts +260 -0
- package/node_modules/assemblyscript/std/assembly/math.ts +3289 -0
- package/node_modules/assemblyscript/std/assembly/memory.ts +123 -0
- package/node_modules/assemblyscript/std/assembly/number.ts +388 -0
- package/node_modules/assemblyscript/std/assembly/object.ts +36 -0
- package/node_modules/assemblyscript/std/assembly/performance.ts +9 -0
- package/node_modules/assemblyscript/std/assembly/polyfills.ts +27 -0
- package/node_modules/assemblyscript/std/assembly/process.ts +50 -0
- package/node_modules/assemblyscript/std/assembly/reference.ts +48 -0
- package/node_modules/assemblyscript/std/assembly/regexp.ts +12 -0
- package/node_modules/assemblyscript/std/assembly/rt/README.md +83 -0
- package/node_modules/assemblyscript/std/assembly/rt/common.ts +81 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-incremental.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-minimal.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-stub.ts +1 -0
- package/node_modules/assemblyscript/std/assembly/rt/index.d.ts +37 -0
- package/node_modules/assemblyscript/std/assembly/rt/itcms.ts +419 -0
- package/node_modules/assemblyscript/std/assembly/rt/rtrace.ts +15 -0
- package/node_modules/assemblyscript/std/assembly/rt/stub.ts +133 -0
- package/node_modules/assemblyscript/std/assembly/rt/tcms.ts +254 -0
- package/node_modules/assemblyscript/std/assembly/rt/tlsf.ts +592 -0
- package/node_modules/assemblyscript/std/assembly/rt.ts +87 -0
- package/node_modules/assemblyscript/std/assembly/set.ts +220 -0
- package/node_modules/assemblyscript/std/assembly/shared/feature.ts +65 -0
- package/node_modules/assemblyscript/std/assembly/shared/runtime.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/target.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/tsconfig.json +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/typeinfo.ts +72 -0
- package/node_modules/assemblyscript/std/assembly/staticarray.ts +401 -0
- package/node_modules/assemblyscript/std/assembly/string.ts +847 -0
- package/node_modules/assemblyscript/std/assembly/symbol.ts +114 -0
- package/node_modules/assemblyscript/std/assembly/table.ts +16 -0
- package/node_modules/assemblyscript/std/assembly/tsconfig.json +6 -0
- package/node_modules/assemblyscript/std/assembly/typedarray.ts +1945 -0
- package/node_modules/assemblyscript/std/assembly/uri.ts +17 -0
- package/node_modules/assemblyscript/std/assembly/util/bytes.ts +107 -0
- package/node_modules/assemblyscript/std/assembly/util/casemap.ts +497 -0
- package/node_modules/assemblyscript/std/assembly/util/error.ts +54 -0
- package/node_modules/assemblyscript/std/assembly/util/hash.ts +117 -0
- package/node_modules/assemblyscript/std/assembly/util/math.ts +1922 -0
- package/node_modules/assemblyscript/std/assembly/util/memory.ts +290 -0
- package/node_modules/assemblyscript/std/assembly/util/number.ts +873 -0
- package/node_modules/assemblyscript/std/assembly/util/sort.ts +313 -0
- package/node_modules/assemblyscript/std/assembly/util/string.ts +1202 -0
- package/node_modules/assemblyscript/std/assembly/util/uri.ts +275 -0
- package/node_modules/assemblyscript/std/assembly/vector.ts +4 -0
- package/node_modules/assemblyscript/std/assembly.json +16 -0
- package/node_modules/assemblyscript/std/portable/index.d.ts +462 -0
- package/node_modules/assemblyscript/std/portable/index.js +416 -0
- package/node_modules/assemblyscript/std/portable.json +11 -0
- package/node_modules/assemblyscript/std/types/assembly/index.d.ts +1 -0
- package/node_modules/assemblyscript/std/types/assembly/package.json +3 -0
- package/node_modules/assemblyscript/std/types/portable/index.d.ts +1 -0
- package/node_modules/assemblyscript/std/types/portable/package.json +3 -0
- package/node_modules/assemblyscript/tsconfig-base.json +13 -0
- package/package.json +112 -0
- package/runtime/deps/assemblyscript/LICENSE +201 -0
- package/runtime/deps/assemblyscript/NOTICE +93 -0
- package/runtime/deps/assemblyscript/bin/asc.js +35 -0
- package/runtime/deps/assemblyscript/dist/asc.js +25035 -0
- package/runtime/deps/assemblyscript/dist/assemblyscript.js +337 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/LICENSE +201 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/index.js +28905 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/package.json +50 -0
- package/runtime/deps/assemblyscript/node_modules/long/LICENSE +202 -0
- package/runtime/deps/assemblyscript/node_modules/long/index.js +1581 -0
- package/runtime/deps/assemblyscript/node_modules/long/package.json +58 -0
- package/runtime/deps/assemblyscript/package.json +114 -0
- package/runtime/host/amxts.inc +85 -0
- package/runtime/licenses/AMXX-LICENSE.txt +34 -0
- package/runtime/licenses/AssemblyScript-LICENSE +201 -0
- package/runtime/licenses/AssemblyScript-NOTICE +93 -0
- package/runtime/licenses/Binaryen-LICENSE +201 -0
- package/runtime/licenses/Bun-LICENSE.md +84 -0
- package/runtime/licenses/GPL-3.0.txt +674 -0
- package/runtime/licenses/LLVM-LICENSE.TXT +279 -0
- package/runtime/licenses/README.md +25 -0
- package/runtime/licenses/WAMR-LICENSE +219 -0
- package/runtime/natives.txt +1095 -0
- package/runtime/patches/README.md +59 -0
- package/runtime/patches/assemblyscript-0.28.20-amxts.patch +14174 -0
- package/runtime/patches/wamr-2.4.5-amxts.patch +364 -0
- package/scripts/apply-docs.ts +508 -0
- package/scripts/asc.ts +27 -0
- package/scripts/auto-imports.ts +258 -0
- package/scripts/build-wasm.ts +595 -0
- package/scripts/check.ts +93 -0
- package/scripts/compile-cache.ts +179 -0
- package/scripts/compile.ts +401 -0
- package/scripts/docker-server.ts +73 -0
- package/scripts/docs/as/amxts.ts +210 -0
- package/scripts/docs/as/effects.ts +1684 -0
- package/scripts/docs/as/facade.ts +3302 -0
- package/scripts/docs/as/fs.ts +173 -0
- package/scripts/docs/as/lib/check.ts +68 -0
- package/scripts/docs/as/modules/http.ts +66 -0
- package/scripts/docs/as/os.ts +16 -0
- package/scripts/docs/as/promise.ts +132 -0
- package/scripts/docs/as/promise.types.ts +63 -0
- package/scripts/docs/as/vector.ts +48 -0
- package/scripts/docs/entities.ts +2338 -0
- package/scripts/docs/events.ts +245 -0
- package/scripts/docs/game.ts +497 -0
- package/scripts/docs/messages.ts +148 -0
- package/scripts/file-contents.ts +74 -0
- package/scripts/includes.ts +134 -0
- package/scripts/player-fields.ts +866 -0
- package/scripts/plugin-cache.ts +92 -0
- package/scripts/plugin-natives.ts +1157 -0
- package/scripts/prebuilt.ts +268 -0
- package/scripts/prepare.ts +134 -0
- package/scripts/project.ts +973 -0
- package/scripts/run.ts +28 -0
- package/scripts/shared-modules.ts +906 -0
- package/scripts/system.ts +33 -0
- package/scripts/tracked-fs.ts +115 -0
- package/scripts/typed-configs.ts +788 -0
- package/scripts/ui.ts +77 -0
- package/src/cli-api.mjs +175 -0
- package/src/parser/include-parser.ts +506 -0
- package/src/system.mjs +155 -0
- package/src/testing/compile-cache.ts +31 -0
- package/src/testing/compile.ts +222 -0
- package/src/testing/coroutines.ts +191 -0
- package/src/testing/index.ts +39 -0
- package/src/testing/kits.ts +55 -0
- package/src/testing/memory.ts +125 -0
- package/src/testing/natives.ts +925 -0
- package/src/testing/server.ts +1874 -0
- package/src/testing/setup.ts +63 -0
- package/src/testing/tables.ts +139 -0
- package/src/types.ts +51 -0
|
@@ -0,0 +1,777 @@
|
|
|
1
|
+
// vim: set ts=4 sw=4 tw=99 noet:
|
|
2
|
+
//
|
|
3
|
+
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
|
4
|
+
// Copyright (C) The AMX Mod X Development Team.
|
|
5
|
+
//
|
|
6
|
+
// This software is licensed under the GNU General Public License, version 3 or higher.
|
|
7
|
+
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
|
8
|
+
// https://alliedmods.net/amxmodx-license
|
|
9
|
+
|
|
10
|
+
//
|
|
11
|
+
// JSON Natives
|
|
12
|
+
//
|
|
13
|
+
|
|
14
|
+
#if defined _json_included
|
|
15
|
+
#endinput
|
|
16
|
+
#endif
|
|
17
|
+
#define _json_included
|
|
18
|
+
|
|
19
|
+
#pragma reqlib json
|
|
20
|
+
#if !defined AMXMODX_NOAUTOLOAD
|
|
21
|
+
#pragma loadlib json
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
* JSON types
|
|
26
|
+
*/
|
|
27
|
+
enum JSONType
|
|
28
|
+
{
|
|
29
|
+
JSONError = -1,
|
|
30
|
+
JSONNull = 1,
|
|
31
|
+
JSONString = 2,
|
|
32
|
+
JSONNumber = 3,
|
|
33
|
+
JSONObject = 4,
|
|
34
|
+
JSONArray = 5,
|
|
35
|
+
JSONBoolean = 6
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/*
|
|
39
|
+
* JSON invalid handle
|
|
40
|
+
*/
|
|
41
|
+
enum JSON
|
|
42
|
+
{
|
|
43
|
+
Invalid_JSON = -1
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Helper macros for checking type
|
|
48
|
+
*/
|
|
49
|
+
#define json_is_object(%1) (%1 != Invalid_JSON && json_get_type(%1) == JSONObject)
|
|
50
|
+
#define json_is_array(%1) (%1 != Invalid_JSON && json_get_type(%1) == JSONArray)
|
|
51
|
+
#define json_is_string(%1) (%1 != Invalid_JSON && json_get_type(%1) == JSONString)
|
|
52
|
+
#define json_is_number(%1) (%1 != Invalid_JSON && json_get_type(%1) == JSONNumber)
|
|
53
|
+
#define json_is_bool(%1) (%1 != Invalid_JSON && json_get_type(%1) == JSONBoolean)
|
|
54
|
+
#define json_is_null(%1) (%1 != Invalid_JSON && json_get_type(%1) == JSONNull)
|
|
55
|
+
#define json_is_true(%1) (%1 != Invalid_JSON && json_is_bool(%1) && json_get_bool(%1))
|
|
56
|
+
#define json_is_false(%1) (%1 != Invalid_JSON && json_is_bool(%1) && !json_get_bool(%1))
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Parses JSON string or a file that contains JSON.
|
|
60
|
+
*
|
|
61
|
+
* @note Needs to be freed using json_free() native.
|
|
62
|
+
*
|
|
63
|
+
* @param string String to parse
|
|
64
|
+
* @param is_file True to treat string param as filename, false otherwise
|
|
65
|
+
* @param with_comments True if parsing JSON includes comments (it will ignore them), false otherwise
|
|
66
|
+
*
|
|
67
|
+
* @return JSON handle, Invalid_JSON if error occurred
|
|
68
|
+
*/
|
|
69
|
+
native JSON:json_parse(const string[], bool:is_file = false, bool:with_comments = false);
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Checks if the first value is the same as the second one.
|
|
73
|
+
*
|
|
74
|
+
* @param value1 JSON handle
|
|
75
|
+
* @param value2 JSON handle
|
|
76
|
+
*
|
|
77
|
+
* @return True if they are the same, false otherwise
|
|
78
|
+
* @error If passed value is not a valid handle
|
|
79
|
+
*/
|
|
80
|
+
native bool:json_equals(const JSON:value1, const JSON:value2);
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Validates json by checking if object have identically named
|
|
84
|
+
* fields with matching types.
|
|
85
|
+
*
|
|
86
|
+
* @note Schema {"name":"", "age":0} will validate
|
|
87
|
+
* {"name":"Joe", "age":25} and {"name":"Joe", "age":25, "gender":"m"},
|
|
88
|
+
* but not {"name":"Joe"} or {"name":"Joe", "age":"Cucumber"}.
|
|
89
|
+
*
|
|
90
|
+
* @note In case of arrays, only first value in schema
|
|
91
|
+
* is checked against all values in tested array.
|
|
92
|
+
*
|
|
93
|
+
* @note Empty objects ({}) validate all objects,
|
|
94
|
+
* empty arrays ([]) validate all arrays,
|
|
95
|
+
* null validates values of every type.
|
|
96
|
+
*
|
|
97
|
+
* @param schema JSON handle
|
|
98
|
+
* @param value JSON handle
|
|
99
|
+
*
|
|
100
|
+
* @return True if passed value is valid, false otherwise
|
|
101
|
+
* @error If a schema handle or value handle is invalid
|
|
102
|
+
*/
|
|
103
|
+
native bool:json_validate(const JSON:schema, const JSON:value);
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Gets value's parent handle.
|
|
107
|
+
*
|
|
108
|
+
* @note Parent's handle needs to be freed using json_free() native.
|
|
109
|
+
*
|
|
110
|
+
* @param value JSON handle
|
|
111
|
+
*
|
|
112
|
+
* @return Parent's handle
|
|
113
|
+
*/
|
|
114
|
+
native JSON:json_get_parent(const JSON:value);
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Gets JSON type of passed value.
|
|
118
|
+
*
|
|
119
|
+
* @param value JSON handle
|
|
120
|
+
*
|
|
121
|
+
* @return JSON type (JSONType constants)
|
|
122
|
+
* @error If a value handle is invalid
|
|
123
|
+
*/
|
|
124
|
+
native JSONType:json_get_type(const JSON:value);
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Inits an empty object.
|
|
128
|
+
*
|
|
129
|
+
* @note Needs to be freed using json_free() native.
|
|
130
|
+
*
|
|
131
|
+
* @return JSON handle, Invalid_JSON if error occurred
|
|
132
|
+
*/
|
|
133
|
+
native JSON:json_init_object();
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Inits an empty array.
|
|
137
|
+
*
|
|
138
|
+
* @note Needs to be freed using json_free() native.
|
|
139
|
+
*
|
|
140
|
+
* @return JSON handle, Invalid_JSON if error occurred
|
|
141
|
+
*/
|
|
142
|
+
native JSON:json_init_array();
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Inits string data.
|
|
146
|
+
*
|
|
147
|
+
* @note Needs to be freed using json_free() native.
|
|
148
|
+
*
|
|
149
|
+
* @param value String that the handle will be initialized with
|
|
150
|
+
*
|
|
151
|
+
* @return JSON handle, Invalid_JSON if error occurred
|
|
152
|
+
*/
|
|
153
|
+
native JSON:json_init_string(const value[]);
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Inits a number.
|
|
157
|
+
*
|
|
158
|
+
* @note Needs to be freed using json_free() native.
|
|
159
|
+
*
|
|
160
|
+
* @param value Integer number that the handle will be initialized with
|
|
161
|
+
*
|
|
162
|
+
* @return JSON handle, Invalid_JSON if error occurred
|
|
163
|
+
*/
|
|
164
|
+
native JSON:json_init_number(value);
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Inits a real number.
|
|
168
|
+
*
|
|
169
|
+
* @note Needs to be freed using json_free() native.
|
|
170
|
+
*
|
|
171
|
+
* @param value Real number that the handle will be initialized with
|
|
172
|
+
*
|
|
173
|
+
* @return JSON handle, Invalid_JSON if error occurred
|
|
174
|
+
*/
|
|
175
|
+
native JSON:json_init_real(Float:value);
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Inits a boolean value.
|
|
179
|
+
*
|
|
180
|
+
* @note Needs to be freed using json_free() native.
|
|
181
|
+
*
|
|
182
|
+
* @param value Boolean value that the handle will be initialized with
|
|
183
|
+
*
|
|
184
|
+
* @return JSON handle, Invalid_JSON if error occurred
|
|
185
|
+
*/
|
|
186
|
+
native JSON:json_init_bool(bool:value);
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Inits a null.
|
|
190
|
+
*
|
|
191
|
+
* @note Needs to be freed using json_free() native.
|
|
192
|
+
*
|
|
193
|
+
* @return JSON handle, Invalid_JSON if error occurred
|
|
194
|
+
*/
|
|
195
|
+
native JSON:json_init_null();
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Creates deep copy of passed value.
|
|
199
|
+
*
|
|
200
|
+
* @note Needs to be freed using json_free() native.
|
|
201
|
+
*
|
|
202
|
+
* @param value JSON handle to be copied
|
|
203
|
+
*
|
|
204
|
+
* @return JSON handle, Invalid_JSON if error occurred
|
|
205
|
+
* @error If passed value is not a valid handle
|
|
206
|
+
*/
|
|
207
|
+
native JSON:json_deep_copy(const JSON:value);
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Frees handle.
|
|
211
|
+
*
|
|
212
|
+
* @param handle JSON handle to be freed
|
|
213
|
+
*
|
|
214
|
+
* @return True if succeed, false otherwise
|
|
215
|
+
* @error If passed handle is not a valid handle
|
|
216
|
+
*/
|
|
217
|
+
native bool:json_free(&JSON:handle);
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Gets string data.
|
|
221
|
+
*
|
|
222
|
+
* @param value JSON handle
|
|
223
|
+
* @param buffer Buffer to copy string to
|
|
224
|
+
* @param maxlen Maximum size of the buffer
|
|
225
|
+
*
|
|
226
|
+
* @return The number of cells written to the buffer
|
|
227
|
+
* @error If passed value is not a valid handle
|
|
228
|
+
*/
|
|
229
|
+
native json_get_string(const JSON:value, buffer[], maxlen);
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Gets a number.
|
|
233
|
+
*
|
|
234
|
+
* @param value JSON handle
|
|
235
|
+
*
|
|
236
|
+
* @return Number
|
|
237
|
+
* @error If passed value is not a valid handle
|
|
238
|
+
*/
|
|
239
|
+
native json_get_number(const JSON:value);
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Gets a real number.
|
|
243
|
+
*
|
|
244
|
+
* @param value JSON handle
|
|
245
|
+
*
|
|
246
|
+
* @return Real number
|
|
247
|
+
* @error If passed value is not a valid handle
|
|
248
|
+
*/
|
|
249
|
+
native Float:json_get_real(const JSON:value);
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Gets a boolean value.
|
|
253
|
+
*
|
|
254
|
+
* @param value JSON handle
|
|
255
|
+
*
|
|
256
|
+
* @return Boolean value
|
|
257
|
+
* @error If passed value is not a valid handle
|
|
258
|
+
*/
|
|
259
|
+
native bool:json_get_bool(const JSON:value);
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Gets a value from the array.
|
|
263
|
+
*
|
|
264
|
+
* @note Needs to be freed using json_free() native.
|
|
265
|
+
*
|
|
266
|
+
* @param array Array handle
|
|
267
|
+
* @param index Position in the array (starting from 0)
|
|
268
|
+
*
|
|
269
|
+
* @return JSON handle, Invalid_JSON if error occurred
|
|
270
|
+
* @error If passed handle is not a valid array
|
|
271
|
+
*/
|
|
272
|
+
native JSON:json_array_get_value(const JSON:array, index);
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Gets string data from the array.
|
|
276
|
+
*
|
|
277
|
+
* @param array Array handle
|
|
278
|
+
* @param index Position in the array (starting from 0)
|
|
279
|
+
* @param buffer Buffer to copy string to
|
|
280
|
+
* @param maxlen Maximum size of the buffer
|
|
281
|
+
*
|
|
282
|
+
* @return The number of cells written to the buffer
|
|
283
|
+
* @error If passed handle is not a valid array
|
|
284
|
+
*/
|
|
285
|
+
native json_array_get_string(const JSON:array, index, buffer[], maxlen);
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Gets a number from the array.
|
|
289
|
+
*
|
|
290
|
+
* @param array Array handle
|
|
291
|
+
* @param index Position in the array (starting from 0)
|
|
292
|
+
*
|
|
293
|
+
* @return The number as integer
|
|
294
|
+
* @error If passed handle is not a valid array
|
|
295
|
+
*/
|
|
296
|
+
native json_array_get_number(const JSON:array, index);
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Gets a real number from the array.
|
|
300
|
+
*
|
|
301
|
+
* @param array Array handle
|
|
302
|
+
* @param index Position in the array (starting from 0)
|
|
303
|
+
*
|
|
304
|
+
* @return The number as float
|
|
305
|
+
* @error If passed handle is not a valid array
|
|
306
|
+
*/
|
|
307
|
+
native Float:json_array_get_real(const JSON:array, index);
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Gets a boolean value from the array.
|
|
311
|
+
*
|
|
312
|
+
* @param array Array handle
|
|
313
|
+
* @param index Position in the array (starting from 0)
|
|
314
|
+
*
|
|
315
|
+
* @return Boolean value
|
|
316
|
+
* @error If passed handle is not a valid array
|
|
317
|
+
*/
|
|
318
|
+
native bool:json_array_get_bool(const JSON:array, index);
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Gets count of the elements in the array.
|
|
322
|
+
*
|
|
323
|
+
* @param array Array handle
|
|
324
|
+
*
|
|
325
|
+
* @return Number of elements in the array
|
|
326
|
+
* @error If passed handle is not a valid array
|
|
327
|
+
*/
|
|
328
|
+
native json_array_get_count(const JSON:array);
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Replaces an element in the array with value.
|
|
332
|
+
*
|
|
333
|
+
* @param array Array handle
|
|
334
|
+
* @param index Position in the array to be replaced
|
|
335
|
+
* @param value JSON handle to set
|
|
336
|
+
*
|
|
337
|
+
* @return True if succeed, false otherwise
|
|
338
|
+
* @error If passed handle is not a valid array
|
|
339
|
+
*/
|
|
340
|
+
native bool:json_array_replace_value(JSON:array, index, const JSON:value);
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Replaces an element in the array with string data.
|
|
344
|
+
*
|
|
345
|
+
* @param array Array handle
|
|
346
|
+
* @param index Position in the array to be replaced
|
|
347
|
+
* @param string String to copy
|
|
348
|
+
*
|
|
349
|
+
* @return True if succeed, false otherwise
|
|
350
|
+
* @error If passed handle is not a valid array
|
|
351
|
+
*/
|
|
352
|
+
native bool:json_array_replace_string(JSON:array, index, const string[]);
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Replaces an element in the array with number.
|
|
356
|
+
*
|
|
357
|
+
* @param array Array handle
|
|
358
|
+
* @param index Position in the array to be replaced
|
|
359
|
+
* @param number Number to set
|
|
360
|
+
*
|
|
361
|
+
* @return True if succeed, false otherwise
|
|
362
|
+
* @error If passed handle is not a valid array
|
|
363
|
+
*/
|
|
364
|
+
native bool:json_array_replace_number(JSON:array, index, number);
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Replaces an element in the array with real number.
|
|
368
|
+
*
|
|
369
|
+
* @param array Array handle
|
|
370
|
+
* @param index Position in the array to be replaced
|
|
371
|
+
* @param number Real number to set
|
|
372
|
+
*
|
|
373
|
+
* @return True if succeed, false otherwise
|
|
374
|
+
* @error If passed handle is not a valid array
|
|
375
|
+
*/
|
|
376
|
+
native bool:json_array_replace_real(JSON:array, index, Float:number);
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Replaces an element in the array with boolean value.
|
|
380
|
+
*
|
|
381
|
+
* @param array Array handle
|
|
382
|
+
* @param index Position in the array to be replaced
|
|
383
|
+
* @param boolean Boolean value to set
|
|
384
|
+
*
|
|
385
|
+
* @return True if succeed, false otherwise
|
|
386
|
+
* @error If passed handle is not a valid array
|
|
387
|
+
*/
|
|
388
|
+
native bool:json_array_replace_bool(JSON:array, index, bool:boolean);
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Replaces an element in the array with null.
|
|
392
|
+
*
|
|
393
|
+
* @param array Array handle
|
|
394
|
+
* @param index Position in the array to be replaced
|
|
395
|
+
*
|
|
396
|
+
* @return True if succeed, false otherwise
|
|
397
|
+
* @error If passed handle is not a valid array
|
|
398
|
+
*/
|
|
399
|
+
native bool:json_array_replace_null(JSON:array, index);
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Appends a value in the array.
|
|
403
|
+
*
|
|
404
|
+
* @param array Array handle
|
|
405
|
+
* @param value JSON handle to set
|
|
406
|
+
*
|
|
407
|
+
* @return True if succeed, false otherwise
|
|
408
|
+
* @error If passed handle is not a valid array
|
|
409
|
+
*/
|
|
410
|
+
native bool:json_array_append_value(JSON:array, const JSON:value);
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Appends string data in the array.
|
|
414
|
+
*
|
|
415
|
+
* @param array Array handle
|
|
416
|
+
* @param string String to copy
|
|
417
|
+
*
|
|
418
|
+
* @return True if succeed, false otherwise
|
|
419
|
+
* @error If passed handle is not a valid array
|
|
420
|
+
*/
|
|
421
|
+
native bool:json_array_append_string(JSON:array, const string[]);
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Appends a number in the array.
|
|
425
|
+
*
|
|
426
|
+
* @param array Array handle
|
|
427
|
+
* @param number Number to set
|
|
428
|
+
*
|
|
429
|
+
* @return True if succeed, false otherwise
|
|
430
|
+
* @error If passed handle is not a valid array
|
|
431
|
+
*/
|
|
432
|
+
native bool:json_array_append_number(JSON:array, number);
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Appends a real number in the array.
|
|
436
|
+
*
|
|
437
|
+
* @param array Array handle
|
|
438
|
+
* @param number Real number to set
|
|
439
|
+
*
|
|
440
|
+
* @return True if succeed, false otherwise
|
|
441
|
+
* @error If passed handle is not a valid array
|
|
442
|
+
*/
|
|
443
|
+
native bool:json_array_append_real(JSON:array, Float:number);
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Appends a boolean value in the array.
|
|
447
|
+
*
|
|
448
|
+
* @param array Array handle
|
|
449
|
+
* @param boolean Boolean value to set
|
|
450
|
+
*
|
|
451
|
+
* @return True if succeed, false otherwise
|
|
452
|
+
* @error If passed handle is not a valid array
|
|
453
|
+
*/
|
|
454
|
+
native bool:json_array_append_bool(JSON:array, bool:boolean);
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Appends a null in the array.
|
|
458
|
+
*
|
|
459
|
+
* @param array Array handle
|
|
460
|
+
*
|
|
461
|
+
* @return True if succeed, false otherwise
|
|
462
|
+
* @error If passed handle is not a valid array
|
|
463
|
+
*/
|
|
464
|
+
native bool:json_array_append_null(JSON:array);
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Removes an element from the array.
|
|
468
|
+
*
|
|
469
|
+
* @note Order of values in array may change during execution.
|
|
470
|
+
*
|
|
471
|
+
* @param array Array handle
|
|
472
|
+
* @param index Position in the array (starting from 0)
|
|
473
|
+
*
|
|
474
|
+
* @return True if succeed, false otherwise
|
|
475
|
+
* @error If passed handle is not a valid array
|
|
476
|
+
*/
|
|
477
|
+
native bool:json_array_remove(JSON:array, index);
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Removes all elements from the array.
|
|
481
|
+
*
|
|
482
|
+
* @param array Array handle
|
|
483
|
+
*
|
|
484
|
+
* @return True if succeed, false otherwise
|
|
485
|
+
* @error If passed handle is not a valid array
|
|
486
|
+
*/
|
|
487
|
+
native bool:json_array_clear(JSON:array);
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Gets a value from the object.
|
|
491
|
+
*
|
|
492
|
+
* @note Needs to be freed using json_free() native.
|
|
493
|
+
* @note If dot notation is used some values may be inaccessible
|
|
494
|
+
* because valid names in JSON can contain dots.
|
|
495
|
+
*
|
|
496
|
+
* @param object Object handle
|
|
497
|
+
* @param name Key name
|
|
498
|
+
* @param dot_not True to use dot notation, false to not
|
|
499
|
+
*
|
|
500
|
+
* @return JSON handle, Invalid_JSON if error occurred
|
|
501
|
+
* @error If passed handle is not a valid object
|
|
502
|
+
*/
|
|
503
|
+
native JSON:json_object_get_value(const JSON:object, const name[], bool:dot_not = false);
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Gets string data from the object.
|
|
507
|
+
*
|
|
508
|
+
* @note If dot notation is used some values may be inaccessible
|
|
509
|
+
* because valid names in JSON can contain dots.
|
|
510
|
+
*
|
|
511
|
+
* @param object Object handle
|
|
512
|
+
* @param name Key name
|
|
513
|
+
* @param buffer Buffer to copy string to
|
|
514
|
+
* @param maxlen Maximum size of the buffer
|
|
515
|
+
* @param dot_not True to use dot notation, false to not
|
|
516
|
+
*
|
|
517
|
+
* @return The number of cells written to the buffer
|
|
518
|
+
* @error If passed handle is not a valid object
|
|
519
|
+
*/
|
|
520
|
+
native json_object_get_string(const JSON:object, const name[], buffer[], maxlen, bool:dot_not = false);
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Gets a number from the object.
|
|
524
|
+
*
|
|
525
|
+
* @note If dot notation is used some values may be inaccessible
|
|
526
|
+
* because valid names in JSON can contain dots.
|
|
527
|
+
*
|
|
528
|
+
* @param object Object handle
|
|
529
|
+
* @param name Key name
|
|
530
|
+
* @param dot_not True to use dot notation, false to not
|
|
531
|
+
*
|
|
532
|
+
* @return Number
|
|
533
|
+
* @error If passed handle is not a valid object
|
|
534
|
+
*/
|
|
535
|
+
native json_object_get_number(const JSON:object, const name[], bool:dot_not = false);
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Gets a real number from the object.
|
|
539
|
+
*
|
|
540
|
+
* @note If dot notation is used some values may be inaccessible
|
|
541
|
+
* because valid names in JSON can contain dots.
|
|
542
|
+
*
|
|
543
|
+
* @param object Object handle
|
|
544
|
+
* @param name Key name
|
|
545
|
+
* @param dot_not True to use dot notation, false to not
|
|
546
|
+
*
|
|
547
|
+
* @return Real number
|
|
548
|
+
* @error If passed handle is not a valid object
|
|
549
|
+
*/
|
|
550
|
+
native Float:json_object_get_real(const JSON:object, const name[], bool:dot_not = false);
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Gets a boolean value from the object.
|
|
554
|
+
*
|
|
555
|
+
* @note If dot notation is used some values may be inaccessible
|
|
556
|
+
* because valid names in JSON can contain dots.
|
|
557
|
+
*
|
|
558
|
+
* @param object Object handle
|
|
559
|
+
* @param name Key name
|
|
560
|
+
* @param dot_not True to use dot notation, false to not
|
|
561
|
+
*
|
|
562
|
+
* @return Boolean value
|
|
563
|
+
* @error If passed handle is not a valid object
|
|
564
|
+
*/
|
|
565
|
+
native bool:json_object_get_bool(const JSON:object, const name[], bool:dot_not = false);
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Gets count of the keys in the object.
|
|
569
|
+
*
|
|
570
|
+
* @param object Object handle
|
|
571
|
+
*
|
|
572
|
+
* @return Keys count
|
|
573
|
+
* @error If passed handle is not a valid object
|
|
574
|
+
*/
|
|
575
|
+
native json_object_get_count(const JSON:object);
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* Gets name of the object's key.
|
|
579
|
+
*
|
|
580
|
+
* @param object Object handle
|
|
581
|
+
* @param index Position from which get key name
|
|
582
|
+
* @param buffer Buffer to copy string to
|
|
583
|
+
* @param maxlen Maximum size of the buffer
|
|
584
|
+
*
|
|
585
|
+
* @return The number of cells written to the buffer
|
|
586
|
+
* @error If passed handle is not a valid object
|
|
587
|
+
*/
|
|
588
|
+
native json_object_get_name(const JSON:object, index, buffer[], maxlen);
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Gets a value at the specified position from the object.
|
|
592
|
+
*
|
|
593
|
+
* @note Needs to be freed using json_free() native.
|
|
594
|
+
*
|
|
595
|
+
* @param object Object handle
|
|
596
|
+
* @param index Position from which get key name
|
|
597
|
+
*
|
|
598
|
+
* @return JSON handle, Invalid_JSON if error occurred
|
|
599
|
+
* @error If passed handle is not a valid object
|
|
600
|
+
*/
|
|
601
|
+
native JSON:json_object_get_value_at(const JSON:object, index);
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Checks if the object has a value with a specific name and type.
|
|
605
|
+
*
|
|
606
|
+
* @param object Object handle
|
|
607
|
+
* @param name Key name
|
|
608
|
+
* @param type Type of value, if JSONError type will not be checked
|
|
609
|
+
* @param dot_not True to use dot notation, false to not
|
|
610
|
+
*
|
|
611
|
+
* @return True if has, false if not
|
|
612
|
+
* @error If passed handle is not a valid object
|
|
613
|
+
*/
|
|
614
|
+
native bool:json_object_has_value(const JSON:object, const name[], JSONType:type = JSONError, bool:dot_not = false);
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Sets a value in the object.
|
|
618
|
+
*
|
|
619
|
+
* @note If dot notation is used some values may be inaccessible
|
|
620
|
+
* because valid names in JSON can contain dots.
|
|
621
|
+
* @note It also removes the old value if any.
|
|
622
|
+
*
|
|
623
|
+
* @param object Object handle
|
|
624
|
+
* @param name Key name
|
|
625
|
+
* @param value JSON handle to set
|
|
626
|
+
* @param dot_not True to use dot notation, false to not
|
|
627
|
+
*
|
|
628
|
+
* @return True if succeed, false otherwise
|
|
629
|
+
* @error If passed handle is not a valid object
|
|
630
|
+
*/
|
|
631
|
+
native bool:json_object_set_value(JSON:object, const name[], const JSON:value, bool:dot_not = false);
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Sets string data in the object.
|
|
635
|
+
*
|
|
636
|
+
* @note If dot notation is used some values may be inaccessible
|
|
637
|
+
* because valid names in JSON can contain dots.
|
|
638
|
+
* @note It also removes the old value if any.
|
|
639
|
+
*
|
|
640
|
+
* @param object Object handle
|
|
641
|
+
* @param name Key name
|
|
642
|
+
* @param string String to copy
|
|
643
|
+
* @param dot_not True to use dot notation, false to not
|
|
644
|
+
*
|
|
645
|
+
* @return True if succeed, false otherwise
|
|
646
|
+
* @error If passed handle is not a valid object
|
|
647
|
+
*/
|
|
648
|
+
native bool:json_object_set_string(JSON:object, const name[], const string[], bool:dot_not = false);
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Sets a number in the object.
|
|
652
|
+
*
|
|
653
|
+
* @note If dot notation is used some values may be inaccessible
|
|
654
|
+
* because valid names in JSON can contain dots.
|
|
655
|
+
* @note It also removes the old value if any.
|
|
656
|
+
*
|
|
657
|
+
* @param object Object handle
|
|
658
|
+
* @param name Key name
|
|
659
|
+
* @param number Number to set
|
|
660
|
+
* @param dot_not True to use dot notation, false to not
|
|
661
|
+
*
|
|
662
|
+
* @return True if succeed, false otherwise
|
|
663
|
+
* @error If passed handle is not a valid object
|
|
664
|
+
*/
|
|
665
|
+
native bool:json_object_set_number(JSON:object, const name[], number, bool:dot_not = false);
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* Sets a real number in the object.
|
|
669
|
+
*
|
|
670
|
+
* @note If dot notation is used some values may be inaccessible
|
|
671
|
+
* because valid names in JSON can contain dots.
|
|
672
|
+
* @note It also removes the old value if any.
|
|
673
|
+
*
|
|
674
|
+
* @param object Object handle
|
|
675
|
+
* @param name Key name
|
|
676
|
+
* @param number Real number to set
|
|
677
|
+
* @param dot_not True to use dot notation, false to not
|
|
678
|
+
*
|
|
679
|
+
* @return True if succeed, false otherwise
|
|
680
|
+
* @error If passed handle is not a valid object
|
|
681
|
+
*/
|
|
682
|
+
native bool:json_object_set_real(JSON:object, const name[], Float:number, bool:dot_not = false);
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Sets a boolean value in the object.
|
|
686
|
+
*
|
|
687
|
+
* @note If dot notation is used some values may be inaccessible
|
|
688
|
+
* because valid names in JSON can contain dots.
|
|
689
|
+
* @note It also removes the old value if any.
|
|
690
|
+
*
|
|
691
|
+
* @param object Object handle
|
|
692
|
+
* @param name Key name
|
|
693
|
+
* @param boolean Boolean value to set
|
|
694
|
+
* @param dot_not True to use dot notation, false to not
|
|
695
|
+
*
|
|
696
|
+
* @return True if succeed, false otherwise
|
|
697
|
+
* @error If passed handle is not a valid object
|
|
698
|
+
*/
|
|
699
|
+
native bool:json_object_set_bool(JSON:object, const name[], bool:boolean, bool:dot_not = false);
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Sets a null in the object.
|
|
703
|
+
*
|
|
704
|
+
* @note If dot notation is used some values may be inaccessible
|
|
705
|
+
* because valid names in JSON can contain dots.
|
|
706
|
+
* @note It also removes the old value if any.
|
|
707
|
+
*
|
|
708
|
+
* @param object Object handle
|
|
709
|
+
* @param name Key name
|
|
710
|
+
* @param dot_not True to use dot notation, false to not
|
|
711
|
+
*
|
|
712
|
+
* @return True if succeed, false otherwise
|
|
713
|
+
* @error If passed handle is not a valid object
|
|
714
|
+
*/
|
|
715
|
+
native bool:json_object_set_null(JSON:object, const name[], bool:dot_not = false);
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Removes a key and its value in the object.
|
|
719
|
+
*
|
|
720
|
+
* @note If dot notation is used some values may be inaccessible
|
|
721
|
+
* because valid names in JSON can contain dots.
|
|
722
|
+
*
|
|
723
|
+
* @param object Object handle
|
|
724
|
+
* @param name Key name
|
|
725
|
+
* @param dot_not True to use dot notation, false to not
|
|
726
|
+
*
|
|
727
|
+
* @return True if succeed, false otherwise
|
|
728
|
+
* @error If passed handle is not a valid object
|
|
729
|
+
*/
|
|
730
|
+
native bool:json_object_remove(JSON:object, const name[], bool:dot_not = false);
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Removes all keys and their values in the object.
|
|
734
|
+
*
|
|
735
|
+
* @param object Object handle
|
|
736
|
+
*
|
|
737
|
+
* @return True if succeed, false otherwise
|
|
738
|
+
* @error If passed handle is not a valid object
|
|
739
|
+
*/
|
|
740
|
+
native bool:json_object_clear(JSON:object);
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* Gets size of serialization.
|
|
744
|
+
*
|
|
745
|
+
* @param value JSON handle
|
|
746
|
+
* @param pretty True to count size for pretty format, false to not
|
|
747
|
+
* @param null_byte True to include null byte, false to not
|
|
748
|
+
*
|
|
749
|
+
* @return Size of serialized string
|
|
750
|
+
* @error If passed handle is not a valid value
|
|
751
|
+
*/
|
|
752
|
+
native json_serial_size(const JSON:value, bool:pretty = false, bool:null_byte = false);
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* Copies serialized string to the buffer.
|
|
756
|
+
*
|
|
757
|
+
* @param value JSON handle
|
|
758
|
+
* @param buffer Buffer to copy string to
|
|
759
|
+
* @param maxlen Maximum size of the buffer
|
|
760
|
+
* @param pretty True to format pretty JSON string, false to not
|
|
761
|
+
*
|
|
762
|
+
* @return The number of cells written to the buffer
|
|
763
|
+
* @error If passed handle is not a valid value
|
|
764
|
+
*/
|
|
765
|
+
native json_serial_to_string(const JSON:value, buffer[], maxlen, bool:pretty = false);
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Copies serialized string to the file.
|
|
769
|
+
*
|
|
770
|
+
* @param value JSON handle
|
|
771
|
+
* @param file Path to the file
|
|
772
|
+
* @param pretty True to format pretty JSON string, false to not
|
|
773
|
+
*
|
|
774
|
+
* @return True if succeed, false otherwise
|
|
775
|
+
* @error If passed handle is not a valid value
|
|
776
|
+
*/
|
|
777
|
+
native bool:json_serial_to_file(const JSON:value, const file[], bool:pretty = false);
|