Skip to content

Latest commit

 

History

History
41 lines (27 loc) · 1.32 KB

item_types.rst

File metadata and controls

41 lines (27 loc) · 1.32 KB

Types of items

Every cbor_item_t has a cbor_type associated with it - these constants correspond to the types specified by the CBOR standard:

cbor_type

To find out the type of an item, one can use

cbor_typeof

Please note the distinction between functions like cbor_isa_uint() and cbor_is_int(). The following functions work solely with the major type value.

Binary queries

Alternatively, there are functions to query each particular type.

Warning

Passing an invalid cbor_item_t reference to any of these functions results in undefined behavior.

cbor_isa_uint

cbor_isa_negint

cbor_isa_bytestring

cbor_isa_string

cbor_isa_array

cbor_isa_map

cbor_isa_tag

cbor_isa_float_ctrl

Logical queries

These functions provide information about the item type from a more high-level perspective

cbor_is_int

cbor_is_float

cbor_is_bool

cbor_is_null

cbor_is_undef