Simple JSON  0.1
A free simple json library for C
simple_json_string.h
Go to the documentation of this file.
1 #ifndef __SIMPLE_JSON_STRING_H__
2 #define __SIMPLE_JSON_STRING_H__
3 
8 typedef struct
9 {
10  char *text;
11  int size;
12 }SJString;
13 
19 
26 
28 
30 
32 
37 void sj_string_free(SJString *string);
38 
45 int sj_string_cmp(SJString *string,char *s);
46 
52 void sj_string_set(SJString *string,char *s);
53 
60 void sj_string_set_limit(SJString *string,char *s,unsigned long length);
61 
67 void sj_string_concat(SJString *string1,SJString *string2);
68 
74 void sj_string_append(SJString *string,char *buffer);
75 
81 char *sj_string_get_text(SJString *string);
82 
89 int sj_string_as_integer(SJString *string,int *output);
90 
97 int sj_string_as_float(SJString *string,float *output);
98 
105 int sj_string_as_bool(SJString *string,short int *output);
106 
107 
108 #endif
int sj_string_cmp(SJString *string, char *s)
performs a strcmp on the string with the provided character array
int sj_string_as_integer(SJString *string, int *output)
get the integer value if the string is a numer
int sj_string_as_float(SJString *string, float *output)
get the float value if the string is a numer
SJString * sj_string_new_float(float i)
void sj_string_concat(SJString *string1, SJString *string2)
append the contents of string2 to string1
SJString * sj_string_new()
make a new empty string
char * sj_string_get_text(SJString *string)
get the text back from the string
int sj_string_as_bool(SJString *string, short int *output)
get the bool value if the string is a bool
void sj_string_set_limit(SJString *string, char *s, unsigned long length)
set the value of string to s but only length of s
a basic structure that keeps track of a string and its length Automatically grows to accomodate longe...
void sj_string_set(SJString *string, char *s)
set the value of string to s
void sj_string_append(SJString *string, char *buffer)
append the contents of buffer to the string
SJString * sj_string_new_text(char *s)
make a new string with the characters from array s
SJString * sj_string_new_integer(int i)
void sj_string_free(SJString *string)
free an SJString
SJString * sj_string_new_bool(int i)