|
Simple JSON
0.1
A free simple json library for C
|

Go to the source code of this file.
Classes | |
| struct | SJString |
| a basic structure that keeps track of a string and its length Automatically grows to accomodate longer strings More... | |
Functions | |
| SJString * | sj_string_new () |
| make a new empty string More... | |
| SJString * | sj_string_new_text (char *s) |
| make a new string with the characters from array s More... | |
| SJString * | sj_string_new_integer (int i) |
| SJString * | sj_string_new_float (float i) |
| SJString * | sj_string_new_bool (int i) |
| void | sj_string_free (SJString *string) |
| free an SJString More... | |
| int | sj_string_cmp (SJString *string, char *s) |
| performs a strcmp on the string with the provided character array More... | |
| void | sj_string_set (SJString *string, char *s) |
| set the value of string to s More... | |
| void | sj_string_set_limit (SJString *string, char *s, unsigned long length) |
| set the value of string to s but only length of s More... | |
| void | sj_string_concat (SJString *string1, SJString *string2) |
| append the contents of string2 to string1 More... | |
| void | sj_string_append (SJString *string, char *buffer) |
| append the contents of buffer to the string More... | |
| char * | sj_string_get_text (SJString *string) |
| get the text back from the string More... | |
| int | sj_string_as_integer (SJString *string, int *output) |
| get the integer value if the string is a numer More... | |
| int | sj_string_as_float (SJString *string, float *output) |
| get the float value if the string is a numer More... | |
| int | sj_string_as_bool (SJString *string, short int *output) |
| get the bool value if the string is a bool More... | |
| void sj_string_append | ( | SJString * | string, |
| char * | buffer | ||
| ) |
append the contents of buffer to the string
| string | the string to be added to |
| buffer | a NULL terminated character buffer. This will not be modified |
Definition at line 213 of file simple_json_string.c.
| int sj_string_as_bool | ( | SJString * | string, |
| short int * | output | ||
| ) |
get the bool value if the string is a bool
| string | the string to use as a bool |
| output | [optional] where to store the boolean value. This is untouched if the string was not a bool |
Definition at line 286 of file simple_json_string.c.
| int sj_string_as_float | ( | SJString * | string, |
| float * | output | ||
| ) |
get the float value if the string is a numer
| string | the string to use as a float |
| output | [optional] where to store the float value. This is untouched if the string was not a float |
Definition at line 269 of file simple_json_string.c.
| int sj_string_as_integer | ( | SJString * | string, |
| int * | output | ||
| ) |
get the integer value if the string is a numer
| string | the string to use as an integer |
| output | [optional] where to store the integer value. This is untouched if the string was not an integer |
Definition at line 252 of file simple_json_string.c.
| int sj_string_cmp | ( | SJString * | string, |
| char * | s | ||
| ) |
performs a strcmp on the string with the provided character array
| string | the SJString to check |
| s | the character array to compare with |
Definition at line 80 of file simple_json_string.c.
append the contents of string2 to string1
| string1 | this string will be modified by this operation |
| string2 | this string will NOT be modified by this operation |
Definition at line 190 of file simple_json_string.c.
| void sj_string_free | ( | SJString * | string | ) |
free an SJString
| string | the string to free |
Definition at line 70 of file simple_json_string.c.
| char* sj_string_get_text | ( | SJString * | string | ) |
get the text back from the string
| string | the string to get |
Definition at line 184 of file simple_json_string.c.
| SJString* sj_string_new | ( | ) |
make a new empty string
Definition at line 8 of file simple_json_string.c.
| SJString* sj_string_new_bool | ( | int | i | ) |
Definition at line 64 of file simple_json_string.c.
| SJString* sj_string_new_float | ( | float | i | ) |
Definition at line 57 of file simple_json_string.c.
| SJString* sj_string_new_integer | ( | int | i | ) |
Definition at line 50 of file simple_json_string.c.
| SJString* sj_string_new_text | ( | char * | s | ) |
make a new string with the characters from array s
| s | the character array to populate the string with |
Definition at line 26 of file simple_json_string.c.
| void sj_string_set | ( | SJString * | string, |
| char * | s | ||
| ) |
set the value of string to s
| string | the string to change |
| s | the character array to change it to |
Definition at line 95 of file simple_json_string.c.
| void sj_string_set_limit | ( | SJString * | string, |
| char * | s, | ||
| unsigned long | length | ||
| ) |
set the value of string to s but only length of s
| string | the string to change |
| s | the character array to change it to |
| length | the limit on characters to copy from s |
Definition at line 123 of file simple_json_string.c.