php_json_encoder.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Copyright (c) The PHP Group |
  4. +----------------------------------------------------------------------+
  5. | This source file is subject to version 3.01 of the PHP license, |
  6. | that is bundled with this package in the file LICENSE, and is |
  7. | available through the world-wide-web at the following url: |
  8. | https://www.php.net/license/3_01.txt |
  9. | If you did not receive a copy of the PHP license and are unable to |
  10. | obtain it through the world-wide-web, please send a note to |
  11. | license@php.net so we can mail you a copy immediately. |
  12. +----------------------------------------------------------------------+
  13. | Author: Jakub Zelenka <bukka@php.net> |
  14. +----------------------------------------------------------------------+
  15. */
  16. #ifndef PHP_JSON_ENCODER_H
  17. #define PHP_JSON_ENCODER_H
  18. #include "php.h"
  19. #include "zend_smart_str.h"
  20. typedef struct _php_json_encoder php_json_encoder;
  21. struct _php_json_encoder {
  22. int depth;
  23. int max_depth;
  24. php_json_error_code error_code;
  25. };
  26. static inline void php_json_encode_init(php_json_encoder *encoder)
  27. {
  28. memset(encoder, 0, sizeof(php_json_encoder));
  29. }
  30. int php_json_encode_zval(smart_str *buf, zval *val, int options, php_json_encoder *encoder);
  31. #endif /* PHP_JSON_ENCODER_H */