123456789101112131415161718192021222324252627282930313233343536373839404142 |
- /*
- * File: json.h
- * Author: Arthur Brandao
- *
- * Created on 28 octobre 2018, 17:53
- */
- #ifndef JSON_H
- #define JSON_H
- /* --- Include --- */
- #include <string.h>
- #include "boolean.h"
- /* --- Constante --- */
- #define JSON_ERROR -1
- #define JSON_OK 0
- #define JSON_STRING 1
- #define JSON_NUMBER 2
- #define JSON_BOOLEAN 3
- #define JSON_ARRAY 4
- #define JSON_OBJECT 5
- /* --- Structure --- */
- typedef struct{
- char* str; //La chaine de carac json
- int elt; //Le nombre d'element
- char** key; //La position des clef dans la chaine
- char** val; //La position de la valeur
- int* key_length; //La taille des clefs
- int* val_length; //La taille des valeurs
- int* type; //Le type des valeurs
- }JsonParser;
- /* --- fonctions ---- */
- int json_parse(JsonParser*, char*);
- void clean_json_parser(JsonParser*);
- int get_type(JsonParser*, char*);
- char* get(JsonParser*, char*);
- char* get_index(JsonParser*, int);
- #endif /* JSON_H */
|