00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _CBSON_H
00018 #define _CBSON_H
00019
00020 #include <Python.h>
00021 #include <stdio.h>
00022 #include "buffer.h"
00023
00024 #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
00025 typedef unsigned int Py_ssize_t;
00026 #define PY_SSIZE_T_MAX UINT_MAX
00027 #define PY_SSIZE_T_MIN 0
00028 #endif
00029
00030 int buffer_write_bytes(buffer_t buffer, const char* data, int size);
00031
00032 int write_dict(buffer_t buffer, PyObject* dict,
00033 unsigned char check_keys, unsigned char top_level);
00034
00035 int write_pair(buffer_t buffer, const char* name, Py_ssize_t name_length,
00036 PyObject* value, unsigned char check_keys, unsigned char allow_id);
00037
00038 int decode_and_write_pair(buffer_t buffer, PyObject* key, PyObject* value,
00039 unsigned char check_keys, unsigned char top_level);
00040
00041 #endif