FreeRDP
|
Wrapper around cJSON, JSONC or jansson 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 WINPR_JSON * | WINPR_JSON_ParseFromFile (const char *filename) |
Parse a JSON string read from a file filename. | |
WINPR_API WINPR_JSON * | WINPR_JSON_ParseFromFileFP (FILE *fp) |
Parse a JSON string read from a FILE. | |
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 sensitive 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, JSONC or jansson 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_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 252 of file c-json.c.
Referenced by freerdp_settings_serialize().
WINPR_API WINPR_JSON * WINPR_JSON_AddFalseToObject | ( | WINPR_JSON * | object, |
const char * | name | ||
) |
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 272 of file c-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 237 of file c-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 257 of file c-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 267 of file c-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 262 of file c-json.c.
Referenced by freerdp_settings_serialize().
WINPR_API WINPR_JSON * WINPR_JSON_AddTrueToObject | ( | WINPR_JSON * | object, |
const char * | name | ||
) |
WINPR_API WINPR_JSON * WINPR_JSON_CreateArray | ( | void | ) |
WINPR_API WINPR_JSON * WINPR_JSON_CreateBool | ( | BOOL | boolean | ) |
WINPR_API WINPR_JSON * WINPR_JSON_CreateFalse | ( | void | ) |
WINPR_API WINPR_JSON * WINPR_JSON_CreateNull | ( | void | ) |
WINPR_API WINPR_JSON * WINPR_JSON_CreateNumber | ( | double | num | ) |
WINPR_API WINPR_JSON * WINPR_JSON_CreateObject | ( | void | ) |
WINPR_JSON_CreateObject.
Definition at line 232 of file c-json.c.
Referenced by freerdp_settings_serialize().
WINPR_API WINPR_JSON * WINPR_JSON_CreateString | ( | const char * | string | ) |
WINPR_API WINPR_JSON * WINPR_JSON_CreateTrue | ( | void | ) |
WINPR_API void WINPR_JSON_Delete | ( | WINPR_JSON * | item | ) |
Delete a WinPR JSON wrapper object.
item | The instance to delete |
Definition at line 103 of file c-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 108 of file c-json.c.
WINPR_API size_t WINPR_JSON_GetArraySize | ( | const WINPR_JSON * | array | ) |
WINPR_API const char * WINPR_JSON_GetErrorPtr | ( | void | ) |
WINPR_API double WINPR_JSON_GetNumberValue | ( | const WINPR_JSON * | item | ) |
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 (case is ignored) |
Definition at line 122 of file c-json.c.
WINPR_API WINPR_JSON * WINPR_JSON_GetObjectItemCaseSensitive | ( | const WINPR_JSON * | object, |
const char * | string | ||
) |
Same as WINPR_JSON_GetObjectItem but with case sensitive matching.
object | the JSON instance to query |
string | the name of the object |
Definition at line 127 of file c-json.c.
Referenced by freerdp_settings_deserialize().
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 142 of file c-json.c.
Referenced by freerdp_settings_deserialize().
WINPR_API BOOL WINPR_JSON_HasObjectItem | ( | const WINPR_JSON * | object, |
const char * | string | ||
) |
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 187 of file c-json.c.
Referenced by WINPR_JSON_IsInvalid(), and 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 167 of file c-json.c.
Referenced by freerdp_settings_deserialize(), WINPR_JSON_IsInvalid(), and WINPR_JSON_IsInvalid().
WINPR_API BOOL WINPR_JSON_IsFalse | ( | const WINPR_JSON * | item | ) |
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 152 of file c-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 172 of file c-json.c.
Referenced by freerdp_settings_deserialize(), WINPR_JSON_IsInvalid(), 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 177 of file c-json.c.
Referenced by WINPR_JSON_IsInvalid(), and 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 192 of file c-json.c.
Referenced by WINPR_JSON_IsInvalid(), and 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 182 of file c-json.c.
Referenced by freerdp_settings_deserialize(), WINPR_JSON_IsInvalid(), 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 162 of file c-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 93 of file c-json.c.
WINPR_API WINPR_JSON * WINPR_JSON_ParseFromFile | ( | const char * | filename | ) |
Parse a JSON string read from a file filename.
filename | the name of the file to read from |
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 27 of file json.c.
References WINPR_JSON_ParseFromFileFP().
WINPR_API WINPR_JSON * WINPR_JSON_ParseFromFileFP | ( | FILE * | fp | ) |
Parse a JSON string read from a FILE.
fp | a FILE pointer to read from. |
Definition at line 37 of file json.c.
References WINPR_JSON_ParseWithLength().
Referenced by WINPR_JSON_ParseFromFile().
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 98 of file c-json.c.
Referenced by freerdp_settings_deserialize(), and WINPR_JSON_ParseFromFileFP().
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 289 of file c-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 294 of file c-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 88 of file c-json.c.