File: encoder.h

package info (click to toggle)
cbor2 5.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 684 kB
  • sloc: ansic: 5,667; python: 3,995; makefile: 19; sh: 8
file content (35 lines) | stat: -rw-r--r-- 1,025 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <stdint.h>
#include <stdbool.h>

// Constants for decimal_classify
#define DC_NORMAL 0
#define DC_INFINITE 1
#define DC_NAN 2
#define DC_ERROR -1

typedef struct {
    PyObject_HEAD
    PyObject *write;    // cached write() method of fp
    PyObject *encoders;
    PyObject *default_handler;
    PyObject *shared;
    PyObject *string_references;
    PyObject *tz;       // renamed from timezone to avoid Python issue #24643
    PyObject *shared_handler;
    uint8_t enc_style;  // 0=regular, 1=canonical, 2=custom
    bool timestamp_format;
    bool date_as_datetime;
    bool value_sharing;
    bool string_referencing;
    bool string_namespacing;
    bool indefinite_containers;
    Py_ssize_t encode_depth;
} CBOREncoderObject;

extern PyTypeObject CBOREncoderType;

PyObject * CBOREncoder_new(PyTypeObject *, PyObject *, PyObject *);
int CBOREncoder_init(CBOREncoderObject *, PyObject *, PyObject *);
PyObject * CBOREncoder_encode(CBOREncoderObject *, PyObject *);