1Type 3 – UTF-8 strings
2=============================
3
4CBOR strings have the same structure as :doc:`type_2`.
5
6==================================  ======================================================
7Corresponding :type:`cbor_type`     ``CBOR_TYPE_STRING``
8Number of allocations (definite)    One plus any manipulations with the data
9Number of allocations (indefinite)  One plus logarithmically many
10                                    reallocations relative  to chunk count
11Storage requirements (definite)     ``sizeof(cbor_item_t) + length(handle)``
12Storage requirements (indefinite)   ``sizeof(cbor_item_t) * (1 + chunk_count) + chunks``
13==================================  ======================================================
14
15
16UTF-8 encoding validation
17~~~~~~~~~~~~~~~~~~~~~~~~~~~
18*libcbor* considers UTF-8 encoding validity to be a part of the well-formedness notion of CBOR and therefore invalid UTF-8 strings will be rejected by the parser. Strings created by the user are not checked.
19
20
21Getting metadata
22~~~~~~~~~~~~~~~~~
23
24.. doxygenfunction:: cbor_string_length
25.. doxygenfunction:: cbor_string_is_definite
26.. doxygenfunction:: cbor_string_is_indefinite
27.. doxygenfunction:: cbor_string_chunk_count
28
29Reading data
30~~~~~~~~~~~~~
31
32.. doxygenfunction:: cbor_string_handle
33.. doxygenfunction:: cbor_string_chunks_handle
34
35Creating new items
36~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37
38.. doxygenfunction:: cbor_new_definite_string
39.. doxygenfunction:: cbor_new_indefinite_string
40
41
42Building items
43~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44.. doxygenfunction:: cbor_build_string
45
46
47Manipulating existing items
48~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49
50.. doxygenfunction:: cbor_string_set_handle
51.. doxygenfunction:: cbor_string_add_chunk
52