File: encoding.rst

package info (click to toggle)
libcbor 0.5.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 1,176 kB
  • sloc: ansic: 7,131; makefile: 154; sh: 71; python: 54; ruby: 17; cpp: 6
file content (23 lines) | stat: -rw-r--r-- 893 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Encoding
=============================

The easiest way to encode data items is using the :func:`cbor_serialize` or :func:`cbor_serialize_alloc` functions:

.. doxygenfunction:: cbor_serialize
.. doxygenfunction:: cbor_serialize_alloc

Type-specific serializers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In case you know the type of the item you want to serialize beforehand, you can use one
of the type-specific serializers.

.. note:: Unless compiled in debug mode, these do not verify the type. Passing an incorrect item will result in an undefined behavior.

.. doxygenfunction:: cbor_serialize_uint
.. doxygenfunction:: cbor_serialize_negint
.. doxygenfunction:: cbor_serialize_bytestring
.. doxygenfunction:: cbor_serialize_string
.. doxygenfunction:: cbor_serialize_array
.. doxygenfunction:: cbor_serialize_map
.. doxygenfunction:: cbor_serialize_tag
.. doxygenfunction:: cbor_serialize_float_ctrl