_cbsonmodule.c File Reference

#include <Python.h>
#include <stdio.h>
#include <datetime.h>
#include "_cbson.h"
#include "buffer.h"
#include <time.h>
Include dependency graph for _cbsonmodule.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define FLAGS_SIZE   7
#define INT2STRING(buffer, i)   asprintf((buffer), "%d", (i))
#define STRCAT(dest, n, src)   strcat((dest), (src))
#define WARN(category, message)   PyErr_Warn((category), (message))

Functions

static PyObject * _cbson_bson_to_dict (PyObject *self, PyObject *args)
static PyObject * _cbson_decode_all (PyObject *self, PyObject *args)
static PyObject * _cbson_dict_to_bson (PyObject *self, PyObject *args)
static PyObject * _error (char *name)
static int _reload_object (PyObject **object, char *module_name, char *object_name)
static int _reload_python_objects (void)
static int _write_element_to_buffer (buffer_t buffer, int type_byte, PyObject *value, unsigned char check_keys, unsigned char first_attempt)
int buffer_write_bytes (buffer_t buffer, const char *data, int size)
static int check_key_name (const char *name, const Py_ssize_t name_length)
static PyObject * datetime_from_millis (long long millis)
int decode_and_write_pair (buffer_t buffer, PyObject *key, PyObject *value, unsigned char check_keys, unsigned char top_level)
static PyObject * elements_to_dict (const char *string, int max, PyObject *as_class, unsigned char tz_aware)
static PyObject * get_value (const char *buffer, int *position, int type, PyObject *as_class, unsigned char tz_aware)
PyMODINIT_FUNC init_cbson (void)
static long long millis_from_datetime (PyObject *datetime)
int write_dict (buffer_t buffer, PyObject *dict, unsigned char check_keys, unsigned char top_level)
static int write_element_to_buffer (buffer_t buffer, int type_byte, PyObject *value, unsigned char check_keys, unsigned char first_attempt)
int write_pair (buffer_t buffer, const char *name, Py_ssize_t name_length, PyObject *value, unsigned char check_keys, unsigned char allow_id)
static int write_string (buffer_t buffer, PyObject *py_string)

Variables

static PyMethodDef _CBSONMethods []
static PyObject * Binary = NULL
static PyObject * Code = NULL
static PyObject * DBRef = NULL
static PyObject * MaxKey = NULL
static PyObject * MinKey = NULL
static PyObject * ObjectId = NULL
static PyObject * RECompile = NULL
static PyTypeObject * REType = NULL
static PyObject * Timestamp = NULL
static PyObject * UTC = NULL
static PyObject * UUID = NULL

Define Documentation

#define FLAGS_SIZE   7

Definition at line 54 of file _cbsonmodule.c.

#define INT2STRING ( buffer,
 )     asprintf((buffer), "%d", (i))

Definition at line 86 of file _cbsonmodule.c.

#define STRCAT ( dest,
n,
src   )     strcat((dest), (src))

Definition at line 87 of file _cbsonmodule.c.

#define WARN ( category,
message   )     PyErr_Warn((category), (message))

Definition at line 46 of file _cbsonmodule.c.


Function Documentation

static PyObject* _cbson_bson_to_dict ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 1247 of file _cbsonmodule.c.

static PyObject* _cbson_decode_all ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 1312 of file _cbsonmodule.c.

static PyObject* _cbson_dict_to_bson ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 822 of file _cbsonmodule.c.

static PyObject* _error ( char *  name  )  [static]

Definition at line 159 of file _cbsonmodule.c.

static int _reload_object ( PyObject **  object,
char *  module_name,
char *  object_name 
) [static]

Definition at line 173 of file _cbsonmodule.c.

static int _reload_python_objects ( void   )  [static]

Definition at line 190 of file _cbsonmodule.c.

static int _write_element_to_buffer ( buffer_t  buffer,
int  type_byte,
PyObject *  value,
unsigned char  check_keys,
unsigned char  first_attempt 
) [static]

Definition at line 230 of file _cbsonmodule.c.

int buffer_write_bytes ( buffer_t  buffer,
const char *  data,
int  size 
)

Definition at line 130 of file _cbsonmodule.c.

static int check_key_name ( const char *  name,
const Py_ssize_t  name_length 
) [static]

Definition at line 639 of file _cbsonmodule.c.

static PyObject* datetime_from_millis ( long long  millis  )  [static]

Definition at line 98 of file _cbsonmodule.c.

int decode_and_write_pair ( buffer_t  buffer,
PyObject *  key,
PyObject *  value,
unsigned char  check_keys,
unsigned char  top_level 
)

Definition at line 694 of file _cbsonmodule.c.

static PyObject * elements_to_dict ( const char *  string,
int  max,
PyObject *  as_class,
unsigned char  tz_aware 
) [static]

Definition at line 1219 of file _cbsonmodule.c.

static PyObject* get_value ( const char *  buffer,
int *  position,
int  type,
PyObject *  as_class,
unsigned char  tz_aware 
) [static]

Definition at line 850 of file _cbsonmodule.c.

PyMODINIT_FUNC init_cbson ( void   ) 

Definition at line 1388 of file _cbsonmodule.c.

static long long millis_from_datetime ( PyObject *  datetime  )  [static]

Definition at line 113 of file _cbsonmodule.c.

int write_dict ( buffer_t  buffer,
PyObject *  dict,
unsigned char  check_keys,
unsigned char  top_level 
)

Definition at line 758 of file _cbsonmodule.c.

static int write_element_to_buffer ( buffer_t  buffer,
int  type_byte,
PyObject *  value,
unsigned char  check_keys,
unsigned char  first_attempt 
) [static]

Definition at line 213 of file _cbsonmodule.c.

int write_pair ( buffer_t  buffer,
const char *  name,
Py_ssize_t  name_length,
PyObject *  value,
unsigned char  check_keys,
unsigned char  allow_id 
)

Definition at line 666 of file _cbsonmodule.c.

static int write_string ( buffer_t  buffer,
PyObject *  py_string 
) [static]

Definition at line 139 of file _cbsonmodule.c.


Variable Documentation

PyMethodDef _CBSONMethods[] [static]
Initial value:
 {
    {"_dict_to_bson", _cbson_dict_to_bson, METH_VARARGS,
     "convert a dictionary to a string containing it's BSON representation."},
    {"_bson_to_dict", _cbson_bson_to_dict, METH_VARARGS,
     "convert a BSON string to a SON object."},
    {"decode_all", _cbson_decode_all, METH_VARARGS,
     "convert binary data to a sequence of documents."},
    {NULL, NULL, 0, NULL}
}

Definition at line 1378 of file _cbsonmodule.c.

PyObject* Binary = NULL [static]

Definition at line 33 of file _cbsonmodule.c.

PyObject* Code = NULL [static]

Definition at line 34 of file _cbsonmodule.c.

PyObject* DBRef = NULL [static]

Definition at line 36 of file _cbsonmodule.c.

PyObject* MaxKey = NULL [static]

Definition at line 41 of file _cbsonmodule.c.

PyObject* MinKey = NULL [static]

Definition at line 40 of file _cbsonmodule.c.

PyObject* ObjectId = NULL [static]

Definition at line 35 of file _cbsonmodule.c.

PyObject* RECompile = NULL [static]

Definition at line 37 of file _cbsonmodule.c.

PyTypeObject* REType = NULL [static]

Definition at line 43 of file _cbsonmodule.c.

PyObject* Timestamp = NULL [static]

Definition at line 39 of file _cbsonmodule.c.

PyObject* UTC = NULL [static]

Definition at line 42 of file _cbsonmodule.c.

PyObject* UUID = NULL [static]

Definition at line 38 of file _cbsonmodule.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines


pymongo
Author(s): Bhaskara Marthi
autogenerated on Fri Jan 11 10:09:03 2013