PageRenderTime 30ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/src/json.h

https://code.google.com/
C Header | 78 lines | 27 code | 22 blank | 29 comment | 0 complexity | 027b94dbf9078127563059cf238ada31 MD5 | raw file
Possible License(s): GPL-2.0
  1. /*
  2. $Id: json.h 231 2011-06-27 13:46:19Z marc.noirot $
  3. FLV Metadata updater
  4. Copyright (C) 2007-2012 Marc Noirot <marc.noirot AT gmail.com>
  5. This file is part of FLVMeta.
  6. FLVMeta is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. FLVMeta is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with FLVMeta; if not, write to the Free Software
  16. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef __JSON_H__
  19. #define __JSON_H__
  20. #include "types.h"
  21. /**
  22. This is a basic JSON emitter.
  23. It prints JSON-formatted data to stdout without creating
  24. an in-memory tree.
  25. */
  26. /* json emitter structure */
  27. typedef struct __json_emitter {
  28. byte print_comma;
  29. } json_emitter;
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif /* __cplusplus */
  33. void json_emit_init(json_emitter * je);
  34. void json_emit_object_start(json_emitter * je);
  35. void json_emit_object_key(json_emitter * je, const char * str, size_t bytes);
  36. void json_emit_object_key_z(json_emitter * je, const char * str);
  37. void json_emit_object_end(json_emitter * je);
  38. void json_emit_array_start(json_emitter * je);
  39. void json_emit_array_end(json_emitter * je);
  40. void json_emit_boolean(json_emitter * je, byte value);
  41. void json_emit_null(json_emitter * je);
  42. void json_emit_integer(json_emitter * je, int value);
  43. void json_emit_file_offset(json_emitter * je, file_offset_t value);
  44. void json_emit_number(json_emitter * je, number64 value);
  45. void json_emit_string(json_emitter * je, const char * str, size_t bytes);
  46. void json_emit_string_z(json_emitter * je, const char * str);
  47. #ifdef __cplusplus
  48. }
  49. #endif /* __cplusplus */
  50. #endif /* __JSON_H__ */