json.h 800 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * File: json.h
  3. * Author: Arthur Brandao
  4. *
  5. * Created on 28 octobre 2018, 17:53
  6. */
  7. #ifndef JSON_H
  8. #define JSON_H
  9. /* --- Include --- */
  10. #include <string.h>
  11. #include "boolean.h"
  12. /* --- Constante --- */
  13. #define JSON_ERROR -1
  14. #define JSON_OK 0
  15. #define JSON_STRING 1
  16. #define JSON_NUMBER 2
  17. #define JSON_BOOLEAN 3
  18. #define JSON_ARRAY 4
  19. #define JSON_OBJECT 5
  20. /* --- Structure --- */
  21. typedef struct{
  22. char* str; //La chaine de carac json
  23. char** key; //La position des clef dans la chaine
  24. char** val; //La position de la valeur
  25. int* key_length; //La taille des clefs
  26. int* val_length; //La taille des valeurs
  27. int* type; //Le type des valeurs
  28. }JsonParser;
  29. /* --- fonctions ---- */
  30. int json_parse(JsonParser*, char*);
  31. void clean_json_parser(JsonParser*);
  32. #endif /* JSON_H */