Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 1 | /* |
Michael Clark | 837240f | 2007-03-13 08:26:25 +0000 | [diff] [blame] | 2 | * $Id: json_util.h,v 1.4 2006/01/30 23:07:57 mclark Exp $ |
Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 3 | * |
Michael Clark | f6a6e48 | 2007-03-13 08:26:23 +0000 | [diff] [blame] | 4 | * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. |
Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 5 | * Michael Clark <michael@metaparadigm.com> |
| 6 | * |
Michael Clark | f6a6e48 | 2007-03-13 08:26:23 +0000 | [diff] [blame] | 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. |
Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 9 | * |
| 10 | */ |
| 11 | |
Michael Clark | f0d0888 | 2007-03-13 08:26:18 +0000 | [diff] [blame] | 12 | #ifndef _json_util_h_ |
| 13 | #define _json_util_h_ |
| 14 | |
| 15 | #include "json_object.h" |
| 16 | |
Eric Haszlakiewicz | d4e81f9 | 2014-05-03 22:29:10 -0400 | [diff] [blame] | 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 | |
Michael Clark | aaec1ef | 2009-02-25 02:31:32 +0000 | [diff] [blame] | 26 | #ifdef __cplusplus |
| 27 | extern "C" { |
| 28 | #endif |
| 29 | |
Michael Clark | f0d0888 | 2007-03-13 08:26:18 +0000 | [diff] [blame] | 30 | #define JSON_FILE_BUF_SIZE 4096 |
| 31 | |
Michael Clark | 75d0f12 | 2009-01-10 14:14:12 +0000 | [diff] [blame] | 32 | /* utility functions */ |
Michael Clark | 88ded9c | 2009-08-27 06:40:59 +0000 | [diff] [blame] | 33 | extern struct json_object* json_object_from_file(const char *filename); |
Pascal Bach | 20e4708 | 2013-08-13 18:24:23 +0200 | [diff] [blame] | 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); |
Michael Clark | c4dceae | 2010-10-06 16:39:20 +0000 | [diff] [blame] | 36 | extern int json_parse_int64(const char *buf, int64_t *retval); |
Remi Collet | 16a4a32 | 2012-11-27 11:06:49 +0100 | [diff] [blame] | 37 | extern int json_parse_double(const char *buf, double *retval); |
Michael Clark | f0d0888 | 2007-03-13 08:26:18 +0000 | [diff] [blame] | 38 | |
Eric Haszlakiewicz | 3fcffe1 | 2012-04-28 13:26:09 -0500 | [diff] [blame] | 39 | |
Eric Haszlakiewicz | 886c4fb | 2011-05-03 20:40:49 +0000 | [diff] [blame] | 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 | |
Michael Clark | aaec1ef | 2009-02-25 02:31:32 +0000 | [diff] [blame] | 46 | #ifdef __cplusplus |
| 47 | } |
| 48 | #endif |
| 49 | |
Michael Clark | f0d0888 | 2007-03-13 08:26:18 +0000 | [diff] [blame] | 50 | #endif |