QCBOR
Loading...
Searching...
No Matches
_QCBORItem Struct Reference

#include <qcbor_decode.h>

Data Fields

uint8_t uDataType
uint8_t uLabelType
uint8_t uNestingLevel
uint8_t uNextNestLevel
uint8_t uDataAlloc
uint8_t uLabelAlloc
union { 
   int64_t   int64 
   uint64_t   uint64 
   UsefulBufC   string 
   uint16_t   uCount 
   double   dfnum 
   float   fnum 
   struct { 
      int64_t   nSeconds 
      double   fSecondsFraction 
   }   epochDate
   int64_t   epochDays 
   UsefulBufC   dateString 
   UsefulBufC   bigNum 
   uint8_t   uSimple 
   QCBORExpAndMantissa   expAndMantissa 
   uint64_t   uTagV 
val
union { 
   int64_t   int64 
   uint64_t   uint64 
   UsefulBufC   string 
label
uint16_t uTags [QCBOR_MAX_TAGS_PER_ITEM]

Detailed Description

This holds a decoded data item. It is returned by the QCBORDecode_GetNext(), the principle decoding function. It holds the type, value, label, tags and other details of the decoded data item.

This is typically 56 bytes on 64-bit CPUs and 52 bytes on 32-bit CPUs (the CPU and the system's ABI determine this size).

Field Documentation

◆ bigNum

UsefulBufC bigNum

The value for uDataType QCBOR_TYPE_POSBIGNUM and QCBOR_TYPE_NEGBIGNUM.

◆ dateString

UsefulBufC dateString

No longer used. Was the value for QCBOR_TYPE_DATE_STRING, but now that value is in string. This will be removed in QCBOR 2.0.

◆ dfnum

double dfnum

The value for uDataType QCBOR_TYPE_DOUBLE. All floating-point values (double, single and half-precision) are returned as a double except when the library is built with QCBOR_DISABLE_PREFERRED_FLOAT, in which case double and single are returned as dfnum and fnum respectiively, and half-precision results in an error.

◆ [struct]

struct { ... } epochDate

The value for uDataType QCBOR_TYPE_DATE_EPOCH, the number of seconds after or before Jan 1, 1970. This has a range of 500 billion years. Floating-point dates are converted to this integer + fractional value. If the input value is beyond the 500 billion-year range (e.g., +/i infinity, large floating point values, NaN) QCBOR_ERR_DATE_OVERFLOW will be returned. If the input is floating-point and QCBOR has been compiled with floating-point disabled, one of the various floating-point disabled errors will be returned.

◆ epochDays

int64_t epochDays

The value for uDataType QCBOR_TYPE_DAYS_EPOCH – the number of days before or after Jan 1, 1970.

◆ fnum

float fnum

The value for uDataType QCBOR_TYPE_FLOAT.

◆ int64

int64_t int64

The value for uDataType QCBOR_TYPE_INT64.

The label for uLabelType for QCBOR_TYPE_INT64

◆ [union]

union { ... } label

Union holding the different label types selected based on uLabelType

◆ string

UsefulBufC string

The value for uDataType QCBOR_TYPE_BYTE_STRING and QCBOR_TYPE_TEXT_STRING. Also for many tags whose content is a string such QCBOR_TYPE_DAYS_STRING and QCBOR_TYPE_URI.

The label for uLabelType QCBOR_TYPE_BYTE_STRING and QCBOR_TYPE_TEXT_STRING

◆ uCount

uint16_t uCount

The "value" for uDataType QCBOR_TYPE_ARRAY or QCBOR_TYPE_MAP, the number of items in the array or map. It is UINT16_MAX when decoding indefinite-lengths maps and arrays. Detection of the end of a map or array is best done with uNestLevel and uNextNestLevel so as to work for both definite and indefinite length maps and arrays.

◆ uDataAlloc

uint8_t uDataAlloc

1 if a val that is a string is allocated with string allocator, 0 if not. Always 0 unless an allocator has been set up by calling QCBORDecode_SetMemPool() or QCBORDecode_SetUpAllocator().

◆ uDataType

uint8_t uDataType

Tells what element of the val union to use. One of QCBOR_TYPE_INT64, QCBOR_TYPE_ARRAY, ...

◆ uint64

uint64_t uint64

The value for uDataType QCBOR_TYPE_UINT64.

The label for uLabelType for QCBOR_TYPE_UINT64

◆ uLabelAlloc

uint8_t uLabelAlloc

1 if a label that is a string is allocated with string allocator, 0 if not. Always 0 unless an allocator has been set up by calling QCBORDecode_SetMemPool() or QCBORDecode_SetUpAllocator().

◆ uLabelType

uint8_t uLabelType

Tells what element of the label union to use. One of QCBOR_TYPE_INT64, QCBOR_TYPE_BYTE_STRING, ...

◆ uNestingLevel

uint8_t uNestingLevel

Holds the nesting depth for arrays and map. 0 is the top level with no arrays or maps entered.

◆ uNextNestLevel

uint8_t uNextNestLevel

Holds the nesting level of the next item after this one. If less than uNestingLevel, this item was the last one in an arry or map and it closed out at least one nesting level.

◆ uSimple

uint8_t uSimple

◆ uTags

uint16_t uTags[QCBOR_MAX_TAGS_PER_ITEM]

The tags numbers for which the item is the tag content. Tags nest, so index 0 in the array is the tag on the data item itself, index 1 is the tag that applies to the tag in index

  1. The end of the list is indicated by CBOR_TAG_INVALID16

Tag nesting is uncommon and rarely deep. This implementation only allows nesting to a depth of QCBOR_MAX_TAGS_PER_ITEM, usually 4.

Tag numbers in the array below and equal to QCBOR_LAST_UNMAPPED_TAG are unmapped and can be used directly. Tag numbers above this must be translated through QCBORDecode_GetNthTag().

See also the large number of functions like QCBORDecode_GetEpochDate() and QCBORDecode_GetBignum() in qcbor_spiffy_decode.h for a way to decode tagged types without having to reference this array. Also see Tags-Overview.

◆ [union]

union { ... } val

The union holding the item's value. Select union member based on uDataType.


The documentation for this struct was generated from the following file: