regify utility  2.0.0-0
json.h
1 /*
2  * Copyright regify
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20  * SOFTWARE.
21  */
35 #ifndef REGIFY_UTIL_JSON_H
36 #define REGIFY_UTIL_JSON_H
37 #ifdef __cplusplus
38 extern "C" {
39 #endif /* __cplusplus */
43 typedef void* ruJson;
44 
45 #define RU_JSON_PRETTIFY 0x01
46 #define RU_JSON_ESCAPE_SLASH 0x02
47 
48 
55 
90 RUAPI ruJson ruJsonNew(int32_t flags, trans_chars ident);
91 
117 RUAPI ruJson ruJsonStart(bool map);
118 
124 RUAPI int32_t ruJsonStartMap(ruJson rj);
125 
131 RUAPI int32_t ruJsonEndMap(ruJson rj);
132 
138 RUAPI int32_t ruJsonStartArray(ruJson rj);
139 
145 RUAPI int32_t ruJsonEndArray(ruJson rj);
146 
153 RUAPI int32_t ruJsonSetInt(ruJson rj, int64_t val);
154 
161 RUAPI int32_t ruJsonSetDouble(ruJson rj, double val);
162 
169 RUAPI int32_t ruJsonSetStr(ruJson rj, trans_chars val);
170 
178 RUAPI int32_t ruJsonSetKeyStr(ruJson rj, trans_chars key, trans_chars val);
179 
187 RUAPI int32_t ruJsonSetKeyInt(ruJson rj, trans_chars key, int64_t val);
188 
196 RUAPI int32_t ruJsonSetKeyDouble(ruJson rj, trans_chars key, double val);
197 
204 RUAPI int32_t ruJsonStartKeyMap(ruJson rj, trans_chars key);
205 
212 RUAPI int32_t ruJsonStartKeyArray(ruJson rj, trans_chars key);
213 
221 RUAPI int32_t ruJsonWrite(ruJson rj, perm_chars* output);
222 
289 RUAPI ruJson ruJsonParse(trans_chars jsonStr, int32_t* status);
290 
297 RUAPI rusize ruJsonArrayLen(ruJson rj, int32_t* status);
298 
306 RUAPI perm_chars ruJsonStr(ruJson rj, int32_t* status);
307 
315 RUAPI int64_t ruJsonParseInt(ruJson rj, int32_t* status);
316 
324 RUAPI int64_t ruJsonInt(ruJson rj, int32_t* status);
325 
333 RUAPI bool ruJsonParseBool(ruJson rj, int32_t* status);
334 
342 RUAPI bool ruJsonBool(ruJson rj, int32_t* status);
343 
351 RUAPI ruList ruJsonKeys(ruJson rj, int32_t* status);
352 
360 RUAPI perm_chars ruJsonKeyStr(ruJson rj, trans_chars key, int32_t* status);
361 
369 RUAPI alloc_chars ruJsonKeyToStr(ruJson rj, trans_chars key, int32_t* status);
370 
378 RUAPI alloc_chars ruJsonKeyStrDup(ruJson rj, trans_chars key, int32_t* status);
379 
388 RUAPI int64_t ruJsonKeyParseInt(ruJson rj, trans_chars key, int32_t* status);
389 
397 RUAPI int64_t ruJsonKeyInt(ruJson rj, trans_chars key, int32_t* status);
398 
406 RUAPI double ruJsonKeyDouble(ruJson rj, trans_chars key, int32_t* status);
407 
416 RUAPI bool ruJsonKeyParseBool(ruJson rj, trans_chars key, int32_t* status);
417 
425 RUAPI bool ruJsonKeyBool(ruJson rj, trans_chars key, int32_t* status);
426 
434 RUAPI ruJson ruJsonKeyMap(ruJson rj, trans_chars key, int32_t* status);
435 
443 RUAPI ruJson ruJsonKeyArray(ruJson rj, trans_chars key, int32_t* status);
444 
452 RUAPI perm_chars ruJsonIdxStr(ruJson rj, rusize index, int32_t* status);
453 
461 RUAPI alloc_chars ruJsonIdxStrDup(ruJson rj, rusize index, int32_t* status);
462 
471 RUAPI int64_t ruJsonIdxParseInt(ruJson rj, rusize index, int32_t* status);
472 
480 RUAPI int64_t ruJsonIdxInt(ruJson rj, rusize index, int32_t* status);
481 
490 RUAPI bool ruJsonIdxParseBool(ruJson rj, rusize index, int32_t* status);
491 
499 RUAPI bool ruJsonIdxBool(ruJson rj, rusize index, int32_t* status);
500 
508 RUAPI double ruJsonIdxDouble(ruJson rj, rusize index, int32_t* status);
509 
517 RUAPI ruJson ruJsonIdxMap(ruJson rj, rusize index, int32_t* status);
518 
526 RUAPI ruJson ruJsonIdxArray(ruJson rj, rusize index, int32_t* status);
527 
531 #ifdef __cplusplus
532 }
533 #endif /* __cplusplus */
534 #endif //REGIFY_UTIL_JSON_H
RUAPI rusize ruJsonArrayLen(ruJson rj, int32_t *status)
RUAPI int32_t ruJsonWrite(ruJson rj, perm_chars *output)
RUAPI int64_t ruJsonKeyParseInt(ruJson rj, trans_chars key, int32_t *status)
RUAPI bool ruJsonBool(ruJson rj, int32_t *status)
RUAPI double ruJsonIdxDouble(ruJson rj, rusize index, int32_t *status)
RUAPI int32_t ruJsonSetKeyInt(ruJson rj, trans_chars key, int64_t val)
RUAPI bool ruJsonParseBool(ruJson rj, int32_t *status)
RUAPI perm_chars ruJsonIdxStr(ruJson rj, rusize index, int32_t *status)
RUAPI int32_t ruJsonStartKeyArray(ruJson rj, trans_chars key)
RUAPI ruJson ruJsonKeyArray(ruJson rj, trans_chars key, int32_t *status)
RUAPI int32_t ruJsonStartMap(ruJson rj)
RUAPI int64_t ruJsonIdxParseInt(ruJson rj, rusize index, int32_t *status)
RUAPI int32_t ruJsonSetKeyDouble(ruJson rj, trans_chars key, double val)
RUAPI int64_t ruJsonKeyInt(ruJson rj, trans_chars key, int32_t *status)
RUAPI ruJson ruJsonParse(trans_chars jsonStr, int32_t *status)
RUAPI int32_t ruJsonEndMap(ruJson rj)
RUAPI alloc_chars ruJsonKeyToStr(ruJson rj, trans_chars key, int32_t *status)
RUAPI bool ruJsonKeyBool(ruJson rj, trans_chars key, int32_t *status)
RUAPI bool ruJsonIdxParseBool(ruJson rj, rusize index, int32_t *status)
RUAPI double ruJsonKeyDouble(ruJson rj, trans_chars key, int32_t *status)
RUAPI int64_t ruJsonInt(ruJson rj, int32_t *status)
RUAPI int32_t ruJsonSetStr(ruJson rj, trans_chars val)
RUAPI int32_t ruJsonEndArray(ruJson rj)
RUAPI ruJson ruJsonKeyMap(ruJson rj, trans_chars key, int32_t *status)
RUAPI bool ruJsonKeyParseBool(ruJson rj, trans_chars key, int32_t *status)
RUAPI ruJson ruJsonStart(bool map)
RUAPI int32_t ruJsonSetInt(ruJson rj, int64_t val)
RUAPI bool ruJsonIdxBool(ruJson rj, rusize index, int32_t *status)
RUAPI ruList ruJsonKeys(ruJson rj, int32_t *status)
Returns an ruList of keys in the current map.
RUAPI alloc_chars ruJsonIdxStrDup(ruJson rj, rusize index, int32_t *status)
RUAPI ruJson ruJsonNew(int32_t flags, trans_chars ident)
RUAPI int32_t ruJsonSetDouble(ruJson rj, double val)
RUAPI int32_t ruJsonSetKeyStr(ruJson rj, trans_chars key, trans_chars val)
void * ruJson
An opaque type representing a JSON object.
Definition: json.h:43
RUAPI perm_chars ruJsonKeyStr(ruJson rj, trans_chars key, int32_t *status)
RUAPI ruJson ruJsonIdxArray(ruJson rj, rusize index, int32_t *status)
RUAPI perm_chars ruJsonStr(ruJson rj, int32_t *status)
RUAPI ruJson ruJsonIdxMap(ruJson rj, rusize index, int32_t *status)
RUAPI int64_t ruJsonParseInt(ruJson rj, int32_t *status)
RUAPI alloc_chars ruJsonKeyStrDup(ruJson rj, trans_chars key, int32_t *status)
RUAPI ruJson ruJsonFree(ruJson rj)
RUAPI int64_t ruJsonIdxInt(ruJson rj, rusize index, int32_t *status)
RUAPI int32_t ruJsonStartKeyMap(ruJson rj, trans_chars key)
RUAPI int32_t ruJsonStartArray(ruJson rj)
void * ruList
Opaque pointer to list object. See List Collection.
Definition: list.h:103
const char * trans_chars
A transient NULL terminated string pointer.
Definition: regify-util.h:186
const char * perm_chars
A permanent NULL terminated string pointer.
Definition: regify-util.h:176
char * alloc_chars
An allocated NULL terminated string pointer.
Definition: regify-util.h:199
size_t rusize
Abstracted version of size_t.
Definition: regify-util.h:338