FreeRDP
|
Wrapper around cJSON or JSONC libraries. More...
Typedefs | |
typedef void | WINPR_JSON |
Functions | |
WINPR_API int | WINPR_JSON_version (char *buffer, size_t len) |
Get the library version string. | |
WINPR_API void | WINPR_JSON_Delete (WINPR_JSON *item) |
Delete a WinPR JSON wrapper object. | |
WINPR_API WINPR_JSON * | WINPR_JSON_Parse (const char *value) |
Parse a '\0' terminated JSON string. | |
WINPR_API WINPR_JSON * | WINPR_JSON_ParseWithLength (const char *value, size_t buffer_length) |
Parse a JSON string. | |
WINPR_API size_t | WINPR_JSON_GetArraySize (const WINPR_JSON *array) |
Get the number of arrayitems from an array. | |
WINPR_API WINPR_JSON * | WINPR_JSON_GetArrayItem (const WINPR_JSON *array, size_t index) |
Return a pointer to an item in the array. | |
WINPR_API WINPR_JSON * | WINPR_JSON_GetObjectItem (const WINPR_JSON *object, const char *string) |
Return a pointer to an JSON object item. | |
WINPR_API WINPR_JSON * | WINPR_JSON_GetObjectItemCaseSensitive (const WINPR_JSON *object, const char *string) |
Same as WINPR_JSON_GetObjectItem but with case insensitive matching. | |
WINPR_API BOOL | WINPR_JSON_HasObjectItem (const WINPR_JSON *object, const char *string) |
Check if JSON has an object matching the name. | |
WINPR_API const char * | WINPR_JSON_GetErrorPtr (void) |
Return an error string. | |
WINPR_API const char * | WINPR_JSON_GetStringValue (WINPR_JSON *item) |
Return the String value of a JSON item. | |
WINPR_API double | WINPR_JSON_GetNumberValue (const WINPR_JSON *item) |
Return the Number value of a JSON item. | |
WINPR_API BOOL | WINPR_JSON_IsInvalid (const WINPR_JSON *item) |
Check if JSON item is valid. | |
WINPR_API BOOL | WINPR_JSON_IsFalse (const WINPR_JSON *item) |
Check if JSON item is BOOL value False. | |
WINPR_API BOOL | WINPR_JSON_IsTrue (const WINPR_JSON *item) |
Check if JSON item is BOOL value True. | |
WINPR_API BOOL | WINPR_JSON_IsBool (const WINPR_JSON *item) |
Check if JSON item is of type BOOL. | |
WINPR_API BOOL | WINPR_JSON_IsNull (const WINPR_JSON *item) |
Check if JSON item is Null. | |
WINPR_API BOOL | WINPR_JSON_IsNumber (const WINPR_JSON *item) |
Check if JSON item is of type Number. | |
WINPR_API BOOL | WINPR_JSON_IsString (const WINPR_JSON *item) |
Check if JSON item is of type String. | |
WINPR_API BOOL | WINPR_JSON_IsArray (const WINPR_JSON *item) |
Check if JSON item is of type Array. | |
WINPR_API BOOL | WINPR_JSON_IsObject (const WINPR_JSON *item) |
Check if JSON item is of type Object. | |
WINPR_API WINPR_JSON * | WINPR_JSON_CreateNull (void) |
WINPR_JSON_CreateNull. | |
WINPR_API WINPR_JSON * | WINPR_JSON_CreateTrue (void) |
WINPR_JSON_CreateTrue. | |
WINPR_API WINPR_JSON * | WINPR_JSON_CreateFalse (void) |
WINPR_JSON_CreateFalse. | |
WINPR_API WINPR_JSON * | WINPR_JSON_CreateBool (BOOL boolean) |
WINPR_JSON_CreateBool. | |
WINPR_API WINPR_JSON * | WINPR_JSON_CreateNumber (double num) |
WINPR_JSON_CreateNumber. | |
WINPR_API WINPR_JSON * | WINPR_JSON_CreateString (const char *string) |
WINPR_JSON_CreateString. | |
WINPR_API WINPR_JSON * | WINPR_JSON_CreateArray (void) |
WINPR_JSON_CreateArray. | |
WINPR_API WINPR_JSON * | WINPR_JSON_CreateObject (void) |
WINPR_JSON_CreateObject. | |
WINPR_API WINPR_JSON * | WINPR_JSON_AddNullToObject (WINPR_JSON *object, const char *name) |
WINPR_JSON_AddNullToObject. | |
WINPR_API WINPR_JSON * | WINPR_JSON_AddTrueToObject (WINPR_JSON *object, const char *name) |
WINPR_JSON_AddTrueToObject. | |
WINPR_API WINPR_JSON * | WINPR_JSON_AddFalseToObject (WINPR_JSON *object, const char *name) |
WINPR_JSON_AddFalseToObject. | |
WINPR_API WINPR_JSON * | WINPR_JSON_AddBoolToObject (WINPR_JSON *object, const char *name, BOOL boolean) |
WINPR_JSON_AddBoolToObject. | |
WINPR_API WINPR_JSON * | WINPR_JSON_AddNumberToObject (WINPR_JSON *object, const char *name, double number) |
WINPR_JSON_AddNumberToObject. | |
WINPR_API WINPR_JSON * | WINPR_JSON_AddStringToObject (WINPR_JSON *object, const char *name, const char *string) |
WINPR_JSON_AddStringToObject. | |
WINPR_API WINPR_JSON * | WINPR_JSON_AddObjectToObject (WINPR_JSON *object, const char *name) |
WINPR_JSON_AddObjectToObject. | |
WINPR_API WINPR_JSON * | WINPR_JSON_AddArrayToObject (WINPR_JSON *object, const char *name) |
WINPR_JSON_AddArrayToObject. | |
WINPR_API BOOL | WINPR_JSON_AddItemToArray (WINPR_JSON *array, WINPR_JSON *item) |
Add an item to an existing array. | |
WINPR_API char * | WINPR_JSON_Print (WINPR_JSON *item) |
Serialize a JSON instance to string for minimal size without formatting see WINPR_JSON_PrintUnformatted. | |
WINPR_API char * | WINPR_JSON_PrintUnformatted (WINPR_JSON *item) |
Serialize a JSON instance to string without formatting for human readable formatted output see WINPR_JSON_Print. | |
Wrapper around cJSON or JSONC libraries.
FreeRDP: A Remote Desktop Protocol Implementation JSON parser wrapper
Copyright 2024 Armin Novak anova.nosp@m.k@th.nosp@m.incas.nosp@m.t.co.nosp@m.m Copyright 2024 Thincast Technologies GmbH
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
WINPR_API WINPR_JSON * WINPR_JSON_AddArrayToObject | ( | WINPR_JSON * | object, |
const char * | name | ||
) |
WINPR_JSON_AddArrayToObject.
object | The JSON object the new item is added to |
name | The name of the object |
Definition at line 634 of file json.c.
WINPR_API WINPR_JSON * WINPR_JSON_AddBoolToObject | ( | WINPR_JSON * | object, |
const char * | name, | ||
BOOL | boolean | ||
) |
WINPR_JSON_AddBoolToObject.
object | The JSON object the new item is added to |
name | The name of the object |
Definition at line 532 of file json.c.
Referenced by freerdp_settings_serialize().
WINPR_API WINPR_JSON * WINPR_JSON_AddFalseToObject | ( | WINPR_JSON * | object, |
const char * | name | ||
) |
WINPR_JSON_AddFalseToObject.
object | The JSON object the new item is added to |
name | The name of the object |
Definition at line 513 of file json.c.
WINPR_API BOOL WINPR_JSON_AddItemToArray | ( | WINPR_JSON * | array, |
WINPR_JSON * | item | ||
) |
Add an item to an existing array.
array | An array to add to, must not be NULL |
item | An item to add, must not be NULL |
Definition at line 611 of file json.c.
WINPR_API WINPR_JSON * WINPR_JSON_AddNullToObject | ( | WINPR_JSON * | object, |
const char * | name | ||
) |
WINPR_JSON_AddNullToObject.
object | The JSON object the new item is added to |
name | The name of the object |
Definition at line 475 of file json.c.
Referenced by freerdp_settings_serialize().
WINPR_API WINPR_JSON * WINPR_JSON_AddNumberToObject | ( | WINPR_JSON * | object, |
const char * | name, | ||
double | number | ||
) |
WINPR_JSON_AddNumberToObject.
object | The JSON object the new item is added to |
name | The name of the object |
Definition at line 552 of file json.c.
Referenced by freerdp_settings_serialize().
WINPR_API WINPR_JSON * WINPR_JSON_AddObjectToObject | ( | WINPR_JSON * | object, |
const char * | name | ||
) |
WINPR_JSON_AddObjectToObject.
object | The JSON object the new item is added to |
name | The name of the object |
Definition at line 592 of file json.c.
Referenced by freerdp_settings_serialize().
WINPR_API WINPR_JSON * WINPR_JSON_AddStringToObject | ( | WINPR_JSON * | object, |
const char * | name, | ||
const char * | string | ||
) |
WINPR_JSON_AddStringToObject.
object | The JSON object the new item is added to |
name | The name of the object |
Definition at line 572 of file json.c.
Referenced by freerdp_settings_serialize().
WINPR_API WINPR_JSON * WINPR_JSON_AddTrueToObject | ( | WINPR_JSON * | object, |
const char * | name | ||
) |
WINPR_JSON_AddTrueToObject.
object | The JSON object the new item is added to |
name | The name of the object |
Definition at line 494 of file json.c.
WINPR_API WINPR_JSON * WINPR_JSON_CreateArray | ( | void | ) |
WINPR_API WINPR_JSON * WINPR_JSON_CreateBool | ( | BOOL | boolean | ) |
WINPR_JSON_CreateBool.
boolean | the value the JSON item should have |
Definition at line 417 of file json.c.
WINPR_API WINPR_JSON * WINPR_JSON_CreateFalse | ( | void | ) |
WINPR_JSON_CreateFalse.
Definition at line 406 of file json.c.
WINPR_API WINPR_JSON * WINPR_JSON_CreateNull | ( | void | ) |
WINPR_API WINPR_JSON * WINPR_JSON_CreateNumber | ( | double | num | ) |
WINPR_JSON_CreateNumber.
num | the number value of the new item |
Definition at line 429 of file json.c.
WINPR_API WINPR_JSON * WINPR_JSON_CreateObject | ( | void | ) |
WINPR_JSON_CreateObject.
Definition at line 464 of file json.c.
Referenced by freerdp_settings_serialize().
WINPR_API WINPR_JSON * WINPR_JSON_CreateString | ( | const char * | string | ) |
WINPR_JSON_CreateString.
string | The string value of the new item |
Definition at line 441 of file json.c.
WINPR_API WINPR_JSON * WINPR_JSON_CreateTrue | ( | void | ) |
WINPR_JSON_CreateTrue.
Definition at line 395 of file json.c.
WINPR_API void WINPR_JSON_Delete | ( | WINPR_JSON * | item | ) |
Delete a WinPR JSON wrapper object.
item | The instance to delete |
Definition at line 143 of file json.c.
Referenced by freerdp_settings_deserialize(), and freerdp_settings_serialize().
WINPR_API WINPR_JSON * WINPR_JSON_GetArrayItem | ( | const WINPR_JSON * | array, |
size_t | index | ||
) |
Return a pointer to an item in the array.
array | the JSON instance to query |
index | The index of the array item |
Definition at line 154 of file json.c.
WINPR_API size_t WINPR_JSON_GetArraySize | ( | const WINPR_JSON * | array | ) |
Get the number of arrayitems from an array.
array | the JSON instance to query |
Definition at line 168 of file json.c.
WINPR_API const char * WINPR_JSON_GetErrorPtr | ( | void | ) |
Return an error string.
Definition at line 222 of file json.c.
WINPR_API double WINPR_JSON_GetNumberValue | ( | const WINPR_JSON * | item | ) |
Return the Number value of a JSON item.
item | the JSON item to query |
Definition at line 245 of file json.c.
WINPR_API WINPR_JSON * WINPR_JSON_GetObjectItem | ( | const WINPR_JSON * | object, |
const char * | string | ||
) |
Return a pointer to an JSON object item.
object | the JSON object |
string | the name of the object |
Definition at line 183 of file json.c.
Referenced by freerdp_settings_deserialize().
WINPR_API WINPR_JSON * WINPR_JSON_GetObjectItemCaseSensitive | ( | const WINPR_JSON * | object, |
const char * | string | ||
) |
Same as WINPR_JSON_GetObjectItem but with case insensitive matching.
object | the JSON instance to query |
string | the name of the object |
Definition at line 196 of file json.c.
WINPR_API const char * WINPR_JSON_GetStringValue | ( | WINPR_JSON * | item | ) |
Return the String value of a JSON item.
item | the JSON item to query |
Definition at line 233 of file json.c.
Referenced by freerdp_settings_deserialize().
WINPR_API BOOL WINPR_JSON_HasObjectItem | ( | const WINPR_JSON * | object, |
const char * | string | ||
) |
Check if JSON has an object matching the name.
object | the JSON instance |
string | the name of the object |
Definition at line 209 of file json.c.
WINPR_API BOOL WINPR_JSON_IsArray | ( | const WINPR_JSON * | item | ) |
Check if JSON item is of type Array.
item | the JSON item to query |
Definition at line 360 of file json.c.
Referenced by WINPR_JSON_IsInvalid().
WINPR_API BOOL WINPR_JSON_IsBool | ( | const WINPR_JSON * | item | ) |
Check if JSON item is of type BOOL.
item | the JSON item to query |
Definition at line 311 of file json.c.
Referenced by freerdp_settings_deserialize(), and WINPR_JSON_IsInvalid().
WINPR_API BOOL WINPR_JSON_IsFalse | ( | const WINPR_JSON * | item | ) |
Check if JSON item is BOOL value False.
item | the JSON item to query |
Definition at line 281 of file json.c.
WINPR_API BOOL WINPR_JSON_IsInvalid | ( | const WINPR_JSON * | item | ) |
Check if JSON item is valid.
item | the JSON item to query |
Definition at line 257 of file json.c.
References WINPR_JSON_IsArray(), WINPR_JSON_IsBool(), WINPR_JSON_IsNull(), WINPR_JSON_IsNumber(), WINPR_JSON_IsObject(), and WINPR_JSON_IsString().
WINPR_API BOOL WINPR_JSON_IsNull | ( | const WINPR_JSON * | item | ) |
Check if JSON item is Null.
item | the JSON item to query |
Definition at line 323 of file json.c.
Referenced by freerdp_settings_deserialize(), and WINPR_JSON_IsInvalid().
WINPR_API BOOL WINPR_JSON_IsNumber | ( | const WINPR_JSON * | item | ) |
Check if JSON item is of type Number.
item | the JSON item to query |
Definition at line 335 of file json.c.
Referenced by WINPR_JSON_IsInvalid().
WINPR_API BOOL WINPR_JSON_IsObject | ( | const WINPR_JSON * | item | ) |
Check if JSON item is of type Object.
item | the JSON item to query |
Definition at line 372 of file json.c.
Referenced by WINPR_JSON_IsInvalid().
WINPR_API BOOL WINPR_JSON_IsString | ( | const WINPR_JSON * | item | ) |
Check if JSON item is of type String.
item | the JSON item to query |
Definition at line 348 of file json.c.
Referenced by freerdp_settings_deserialize(), and WINPR_JSON_IsInvalid().
WINPR_API BOOL WINPR_JSON_IsTrue | ( | const WINPR_JSON * | item | ) |
Check if JSON item is BOOL value True.
item | the JSON item to query |
Definition at line 296 of file json.c.
Referenced by freerdp_settings_deserialize().
WINPR_API WINPR_JSON * WINPR_JSON_Parse | ( | const char * | value | ) |
Parse a '\0' terminated JSON string.
value | A '\0' terminated JSON string |
Definition at line 112 of file json.c.
WINPR_API WINPR_JSON * WINPR_JSON_ParseWithLength | ( | const char * | value, |
size_t | buffer_length | ||
) |
Parse a JSON string.
value | A JSON string |
buffer_length | The length in bytes of the JSON string |
Definition at line 124 of file json.c.
Referenced by freerdp_settings_deserialize().
WINPR_API char * WINPR_JSON_Print | ( | WINPR_JSON * | item | ) |
Serialize a JSON instance to string for minimal size without formatting see WINPR_JSON_PrintUnformatted.
item | The JSON instance to serialize |
Definition at line 653 of file json.c.
Referenced by freerdp_settings_serialize().
WINPR_API char * WINPR_JSON_PrintUnformatted | ( | WINPR_JSON * | item | ) |
Serialize a JSON instance to string without formatting for human readable formatted output see WINPR_JSON_Print.
item | The JSON instance to serialize |
Definition at line 668 of file json.c.
Referenced by freerdp_settings_serialize().
WINPR_API int WINPR_JSON_version | ( | char * | buffer, |
size_t | len | ||
) |
Get the library version string.
buffer | a string buffer to hold the version string |
len | the length of the buffer |
FreeRDP: A Remote Desktop Protocol Implementation JSON parser wrapper
Copyright 2024 Armin Novak anova.nosp@m.k@th.nosp@m.incas.nosp@m.t.co.nosp@m.m Copyright 2024 Thincast Technologies GmbH
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition at line 100 of file json.c.