1#ifndef  __JBXL_TINY_JSON_H_ 
    2#define  __JBXL_TINY_JSON_H_ 
   27#define  JSON_ANCHOR_NODE    JBXL_STATE_ANCHOR       
   28#define  JSON_TEMP_NODE             -1               
   29#define  JSON_BRACKET_NODE           1               
   30#define  JSON_DATA_NODE              2               
   31#define  JSON_ARRAY_NODE             3               
   32#define  JSON_ARRAY_VALUE_NODE       4               
   35#define  JSON_VALUE_UNRESOLV        -1               
   36#define  JSON_VALUE_NULL             0               
   37#define  JSON_VALUE_INT              1               
   38#define  JSON_VALUE_REAL             2               
   39#define  JSON_VALUE_BOOL             3               
   40#define  JSON_VALUE_STR              4               
   41#define  JSON_VALUE_OBJ              5               
   42#define  JSON_VALUE_ARRAY            6               
   44#define  JSON_ONELINE_FORMAT         0               
   45#define  JSON_CRLF_FORMAT            1               
   46#define  JSON_INDENT_FORMAT          2               
   52#define new_json_node()         new_tTree_node()             
   53#define new_json_anchor_node()  new_tTree_anchor_node()      
   54#define new_json()              new_tTree_node()             
   55#define new_json_anchor()       new_tTree_anchor_node()      
   56#define new_json_anchor_node()  new_tTree_anchor_node()      
   57#define del_json_anchor(t)      del_tTree_anchor_node((t))   
   58#define del_json_anchor_node(t) del_tTree_anchor_node((t))   
   60#define del_json(j)             del_tTree((j))               
   61#define del_all_json(j)         del_all_tTree((j))           
   62#define del_json_node(j)        del_tTree_node((j))          
   63#define free_json(j)            free_tTree_node((j))         
   64#define free_json_node(j)       free_tTree_node((j))         
  182#define  print_tJson(f, j)          print_tTree((f), (j))                                
  183#define  print_tJson_tree(f, j, s)  print_tTree_tree((f), (j), (s))                      
  213#define  dup_merge_json(p, c)               dup_merge_tTree((p), (c))                    
  219#define  find_top_json(p, n)                search_top_bracket_json((p), (n))            
  220#define  find_sister_json(p, n)             search_sister_json((p), (n))                 
  221#define  find_key_json(p, k)                search_key_json((p), (k), FALSE, 1)          
  222#define  find_key_child_json(p, k)          search_key_child_json( (p), (k), FALSE)      
  223#define  find_key_sister_json(p, k)         search_key_sister_json((p), (k), FALSE)      
  224#define  find_key_json_obj(p, k)            search_key_json_obj((p), (k))                
  225#define  find_double_key_json(p, k1, k2)    search_double_key_json((p), (k1), (k2), FALSE)   
tJson * json_append_array_key(tJson *json, const char *key)
値(value)なしの配列 "key":[] を追加する.
 
void json_append_array_str_val(tJson *json, const char *val)
配列 [] の要素として 文字列 val を追加する.
 
tJson * json_parse_file(const char *fn, int num)
JSONデータをファイルから読み込んで,パースする.
 
Buffer get_Buffer_from_json(tJson *json)
 
tJson * search_key_json_obj(tJson *pp, const char *key, int nn)
名前(属性名)が key である nn番目のオブジェクトノード(JSON_VALUE_OBJ)へのポインタを返す.ex.) "key":{}
 
tJson * json_insert_parse(tJson *parent, const char *str)
str をパースして繋げる.str は { または [ で始まる必要がある.
 
void print_json(FILE *fp, tJson *json, int mode)
tJsonデータをmodeに従って fp に出力する.
 
void json_append_obj_str_val(tJson *json, const char *key, const char *val)
{} の要素として "key":val(val は文字列)を追加する.
 
tJson * json_insert_child(tJson *parent, tJson *child)
parent に dict または array の child を繋げる.
 
tJson * search_key_json(tJson *pp, const char *key, int needval, int nn)
名前(属性名)が key である nn番目のノードへのポインタを返す
 
tJson * search_key_sister_json(tJson *pp, const char *key, int needval)
姉妹ノードで名前(属性名)が key である nn番目のノードへのポインタを返す.
 
Buffer json_inverse_parse(tJson *pp, int mode)
tJsonデータをmodeに従って元の書式に戻して Bufferに格納する.
 
tJson * search_double_key_json(tJson *pp, const char *key1, const char *key2, int needval)
属性名が key1 -> key2 の親子関係を持つ,key2ノードのポインタを返す.
 
tJson * json_parse_seq(tJson *json, const char *str, int num)
断片化した JSONデータを読み込んで処理する.
 
tJson * json_append_obj_key(tJson *json, const char *key)
属性値(value)なしのリストデータ "key":{} を追加する.
 
tJson * join_json(tJson *parent, tJson **child)
parent の子として child そのものを 直接繋げる.
 
tList * search_all_node_strval_json(tJson *json, const char *name, const char *val)
指定した条件に合う全てのノードへのポインタを,リストに格納して返す.
 
Buffer get_key_sister_json_val(tJson *pp, const char *key)
姉妹ノードで名前(属性名)が key である nn番目のノードの属性値を返す.
 
tJson * _json_parse_term(tJson *json, const char *st, const char *ed, const char *com)
json_parse_prop() の補助関数.断片的な入力データ用.
 
char * get_string_from_json(tJson *json)
要 free()
 
tJson * search_key_child_json(tJson *pp, const char *key, int needval)
子の姉妹ノードで名前(属性名)が key である nn番目のノードへのポインタを返す.
 
int _json_check_node_bykey(tJson *pp, const char *key, int needval, int nn)
search 系関数の補助関数
 
void json_copy_data(tJson *f_json, tJson *t_json)
f_json から t_json へ属性名(key)と属性値(value)をコピーする.
 
Buffer get_json_val(tJson *json)
 
void _json_to_Buffer(tJson *pp, Buffer *buf, const char *crlf, const char *space)
tJsonデータを元の書式に戻して Bufferに格納する.補助関数.
 
void json_append_array_real_val(tJson *json, float val)
配列 [] の要素として 実数 val を追加する.
 
tJson * _search_key_json(tJson *pp, const char *key, int need, int *nn)
search_key_json() の補助関数
 
tJson * _json_array_parse(tJson *json, int num)
json_parse_prop() の補助関数.配列処理用.
 
tJson * search_top_bracket_json(tJson *pp, int nn)
ツリーが複数のルート(TOP)を持つ場合(JBXL_JSON_MULTI_ROOT),指定されたTOPへのポインタを返す.
 
void json_append_obj_int_val(tJson *json, const char *key, int val)
{} の要素として "key":val(val は整数)を追加する.
 
void json_append_obj_real_val(tJson *json, const char *key, float val)
{} の要素として "key":val(va lは実数)を追加する.
 
tJson * search_sister_json(tJson *pp, int nn)
nn個先の sister ノードを返す.正数の場合は younger sister. 負数の場合は elder sister.
 
void json_append_array_int_val(tJson *json, int val)
配列 [] の要素として 整数 val を追加する.
 
void json_set_real_val(tJson *json, float val)
json ノード "key":val に実数の属性値(value)を設定する.
 
void json_copy_val(tJson *f_json, tJson *t_json)
f_json から t_json へ属性値(value)をコピーする.
 
void json_set_str_val(tJson *json, const char *val)
json ノード "key":val に文字列の属性値(value)を設定する.
 
tJson * json_parse_prop(tJson *json, const char *str, int num)
JSON Main Parser.json が NULL の場合は ANCHOR付き.
 
Buffer json_inverse_parse_opt(tJson *pp, const char *crlf, const char *space)
tJsonデータを指定に従って元の書式に戻して Bufferに格納する.
 
void print_json_opt(FILE *fp, tJson *json, const char *crlf, const char *space)
tJsonデータを指定に従って fp に出力する.
 
Buffer get_double_key_json_val(tJson *pp, const char *key1, const char *key2)
key1 -> key2 の親子関係を持つ,key2ノードの属性値を返す.
 
tList * _search_all_node_strval_json(tList *list, tJson *pp, const char *name, const char *val)
search_all_node_strval_json() の補助関数
 
Buffer get_key_json_val(tJson *pp, const char *key, int nn)
名前(属性名)が key である nn番目のノードの属性値を返す.
 
tJson * json_array_parse(tJson *json, const char *str, int num)
JSONデータの 配列ノードの値(配列データ)を処理する.
 
void json_set_int_val(tJson *json, int val)
json ノード "key":val に整数の属性値(value)を設定する.
 
tJson * _search_key_json_obj(tJson *pp, const char *key, int *nn)
search_key_json_obj() の補助関数
 
tJson * json_parse(const char *str, int num)
文字列のJSONデータを解釈して,tJsonのツリーを生成する.ANCHOR付き.
 
Tiny Tree Graph 構造ライブラリヘッダ