#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <math.h>
#include "debug.h"
#include "bits.h"
#include "json_object.h"
#include "json_more_utils.h"
#include "json_tokener.h"
#include "JSON_checker.h"
#include "linkhash.h"
Go to the source code of this file.
Macros | |
#define | NAN strtod("NaN",0) |
Functions | |
double | convert_to_double (JO jo) |
void | jo_add_double (JO root, const char *name, double v) |
void | jo_add_double_array (JO root, const char *name, const double *v, int n) |
void | jo_add_int (JO root, const char *name, int v) |
void | jo_add_int_array (JO root, const char *name, const int *v, int n) |
void | jo_add_string (JO root, const char *name, const char *v) |
JO | jo_double_or_null (double v) |
int | jo_has_field (JO s, const char *name) |
JO | jo_new_double_array (const double *v, int n) |
JO | jo_new_int_array (const int *v, int n) |
int | jo_read_double (JO jo, const char *name, double *p) |
int | jo_read_double_array (JO s, const char *name, double *p, int n, double when_null) |
int | jo_read_from_double_array (JO jo, double *p, int n, double when_null) |
int | jo_read_int (JO jo, const char *name, int *p) |
int | jo_read_int_array (JO s, const char *name, int *p, int n, int when_null) |
int | jo_read_string (JO jo, const char *name, char *dest_string, size_t max_len) |
JO | json_parse (const char *str) |
JO | json_read_stream (FILE *f) |
int | json_stream_skip (FILE *f) |
int | json_to_double (JO jo, double *ptr) |
int | json_to_int (JO jo, int *ptr) |
struct json_object * | json_tokener_parse_len (const char *str, int len) |
const char * | json_write (JO jo) |
#define NAN strtod("NaN",0) |
Definition at line 19 of file json_more_utils.c.
double convert_to_double | ( | JO | jo | ) |
Definition at line 257 of file json_more_utils.c.
void jo_add_double | ( | JO | root, |
const char * | name, | ||
double | v | ||
) |
Definition at line 308 of file json_more_utils.c.
void jo_add_double_array | ( | JO | root, |
const char * | name, | ||
const double * | v, | ||
int | n | ||
) |
Definition at line 296 of file json_more_utils.c.
void jo_add_int | ( | JO | root, |
const char * | name, | ||
int | v | ||
) |
Definition at line 304 of file json_more_utils.c.
void jo_add_int_array | ( | JO | root, |
const char * | name, | ||
const int * | v, | ||
int | n | ||
) |
Definition at line 300 of file json_more_utils.c.
void jo_add_string | ( | JO | root, |
const char * | name, | ||
const char * | v | ||
) |
Definition at line 292 of file json_more_utils.c.
JO jo_double_or_null | ( | double | v | ) |
Definition at line 196 of file json_more_utils.c.
int jo_has_field | ( | JO | s, |
const char * | name | ||
) |
Return true if there is a field
Definition at line 117 of file json_more_utils.c.
JO jo_new_double_array | ( | const double * | v, |
int | n | ||
) |
Definition at line 201 of file json_more_utils.c.
JO jo_new_int_array | ( | const int * | v, |
int | n | ||
) |
Definition at line 209 of file json_more_utils.c.
int jo_read_double | ( | JO | parent, |
const char * | name, | ||
double * | p | ||
) |
This also tolerates an integer
Definition at line 267 of file json_more_utils.c.
int jo_read_double_array | ( | JO | s, |
const char * | name, | ||
double * | p, | ||
int | n, | ||
double | when_null | ||
) |
Definition at line 122 of file json_more_utils.c.
int jo_read_from_double_array | ( | JO | jo, |
double * | p, | ||
int | n, | ||
double | when_null | ||
) |
Definition at line 133 of file json_more_utils.c.
int jo_read_int | ( | JO | parent, |
const char * | name, | ||
int * | p | ||
) |
Return 0 if there isn't a field called 'name'
Definition at line 249 of file json_more_utils.c.
int jo_read_int_array | ( | JO | s, |
const char * | name, | ||
int * | p, | ||
int | n, | ||
int | when_null | ||
) |
XXX should we thro error?
Definition at line 169 of file json_more_utils.c.
int jo_read_string | ( | JO | jo, |
const char * | name, | ||
char * | dest_string, | ||
size_t | max_len | ||
) |
Definition at line 280 of file json_more_utils.c.
JO json_parse | ( | const char * | str | ) |
Definition at line 312 of file json_more_utils.c.
JO json_read_stream | ( | FILE * | ) |
Reads a JSON object from stream. Returns 0 on error. XXX: does not support unicode.
Definition at line 48 of file json_more_utils.c.
int json_stream_skip | ( | FILE * | ) |
Skips one object from stream (without parsing it). Returns 0 on error. XXX: does not support unicode.
Definition at line 22 of file json_more_utils.c.
int json_to_double | ( | JO | jo, |
double * | ptr | ||
) |
Converts an integer or a double to a double, or else *ptr will be set to NAN.
Definition at line 236 of file json_more_utils.c.
int json_to_int | ( | JO | jo, |
int * | ptr | ||
) |
XXX forse ho fatto casino
Definition at line 218 of file json_more_utils.c.
struct json_object* json_tokener_parse_len | ( | const char * | str, |
int | len | ||
) |
Definition at line 101 of file json_more_utils.c.
const char* json_write | ( | JO | jo | ) |
Definition at line 316 of file json_more_utils.c.