• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * $Id: json_util.h,v 1.4 2006/01/30 23:07:57 mclark Exp $
3  *
4  * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
5  * Michael Clark <michael@metaparadigm.com>
6  *
7  * This library is free software; you can redistribute it and/or modify
8  * it under the terms of the MIT license. See COPYING for details.
9  *
10  */
11 
12 #ifndef _json_util_h_
13 #define _json_util_h_
14 
15 #include "json_object.h"
16 
17 #ifndef json_min
18 #define json_min(a,b) ((a) < (b) ? (a) : (b))
19 #endif
20 
21 #ifndef json_max
22 #define json_max(a,b) ((a) > (b) ? (a) : (b))
23 #endif
24 
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #define JSON_FILE_BUF_SIZE 4096
31 
32 /* utility functions */
33 extern struct json_object* json_object_from_file(const char *filename);
34 extern int json_object_to_file(const char *filename, struct json_object *obj);
35 extern int json_object_to_file_ext(const char *filename, struct json_object *obj, int flags);
36 extern int json_parse_int64(const char *buf, int64_t *retval);
37 extern int json_parse_double(const char *buf, double *retval);
38 
39 
40 /**
41  * Return a string describing the type of the object.
42  * e.g. "int", or "object", etc...
43  */
44 extern const char *json_type_to_name(enum json_type o_type);
45 
46 #ifdef __cplusplus
47 }
48 #endif
49 
50 #endif
51