File: cbor_options.md

package info (click to toggle)
jsoncons 1.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 17,584 kB
  • sloc: cpp: 136,382; sh: 33; makefile: 5
file content (48 lines) | stat: -rw-r--r-- 1,340 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
36
37
38
39
40
41
42
43
44
45
46
47
48
### jsoncons::cbor::cbor_options

```cpp
#include <jsoncons_ext/cbor/cbor_options.hpp>

class cbor_options;
```

<br>

![cbor_options](./diagrams/cbor_options.png)

Specifies options for reading and writing CBOR.

#### Constructors

    cbor_options()
Constructs a `cbor_options` with default values. 

#### Modifiers

    void max_nesting_depth(int depth)
The maximum nesting depth allowed when decoding and encoding CBOR. 
Default is 1024. Parsing can have an arbitrarily large depth
limited only by available memory. Serializing a [basic_json](../basic_json.md) to
CBOR is limited by stack size.

    cbor_options& pack_strings(bool value)

If set to `true`, then encode will store text strings and
byte strings once, and use string references to represent repeated occurences
of the strings. Decoding the resulting CBOR requires a decoder
that supports the 
[stringref extension to CBOR](http://cbor.schmorp.de/stringref), such as
jsoncons itself, or [Perl CBOR::XS](http://software.schmorp.de/pkg/CBOR-XS.html)

If set to `false` (the default), then encode
will encode strings the usual CBOR way. 

This option does not affect decode - jsoncons will always decode
string references if present.

    cbor_options& use_typed_arrays(bool value)

This option does not affect decode - jsoncons will always decode
typed arrays if present.