Working json output and split source into multiple files
This commit is contained in:
+16
-5
@@ -24,6 +24,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
//type of data
|
||||
enum JSON_type{
|
||||
json_object,
|
||||
@@ -110,11 +111,21 @@ struct JSON_value* rjp_add_member(struct JSON_object* dest, int alloc_key, char*
|
||||
//add an element to a json array
|
||||
struct JSON_value* rjp_add_element(struct JSON_array* dest, struct JSON_value value);
|
||||
|
||||
/*struct JSON_value* root = rjp_init_json();
|
||||
rjp_add_member(root, "intel_backlight", 15, rjp_init_integer(100));
|
||||
rjp_free(root);
|
||||
//{intel_backlight:100}
|
||||
*/
|
||||
struct JSON_value rjp_integer(long i);
|
||||
struct JSON_value rjp_boolean(char b);
|
||||
struct JSON_value rjp_dfloat(double d);
|
||||
struct JSON_value rjp_string(char* c, size_t len);
|
||||
struct JSON_value rjp_null(void);
|
||||
struct JSON_value rjp_object(void);
|
||||
struct JSON_value rjp_array(void);
|
||||
|
||||
size_t rjp_escape_strcpy(char* dest, const char* src);
|
||||
size_t rjp_escape_strlen(const char* str);
|
||||
|
||||
size_t rjp_dump_object(struct JSON_value* root, char* dest);
|
||||
size_t rjp_dump_array(struct JSON_value* arr, char* dest);
|
||||
char* rjp_to_json(struct JSON_value* root);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef RJP_INTERNAL_H
|
||||
#define RJP_INTERNAL_H
|
||||
|
||||
#include "rjp.h"
|
||||
|
||||
char* _rjp__parse_string(struct JSON_value* root, const char* str, int* len, int* row, int* column);
|
||||
size_t _rjp__object_strlen(struct JSON_value* root);
|
||||
void _rjp__add_member(struct JSON_object* j, char* str, size_t len);
|
||||
void _rjp__add_member_no_alloc(struct JSON_object* j, char* str, size_t len);
|
||||
void _rjp__add_element(struct JSON_array* j);
|
||||
size_t _rjp__object_strlen(struct JSON_value* root);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user