libcbor  0.5.0
libcbor is a C library for parsing and generating CBOR, the general-purpose schema-less binary data format.
Functions
ints.c File Reference
#include "ints.h"

Go to the source code of this file.

Functions

cbor_int_width cbor_int_get_width (const cbor_item_t *item)
 Queries the integer width. More...
 
uint8_t cbor_get_uint8 (const cbor_item_t *item)
 Extracts the integer value. More...
 
uint16_t cbor_get_uint16 (const cbor_item_t *item)
 Extracts the integer value. More...
 
uint32_t cbor_get_uint32 (const cbor_item_t *item)
 Extracts the integer value. More...
 
uint64_t cbor_get_uint64 (const cbor_item_t *item)
 Extracts the integer value. More...
 
uint64_t cbor_get_int (const cbor_item_t *item)
 Extracts the integer value. More...
 
void cbor_set_uint8 (cbor_item_t *item, uint8_t value)
 Assigns the integer value. More...
 
void cbor_set_uint16 (cbor_item_t *item, uint16_t value)
 Assigns the integer value. More...
 
void cbor_set_uint32 (cbor_item_t *item, uint32_t value)
 Assigns the integer value. More...
 
void cbor_set_uint64 (cbor_item_t *item, uint64_t value)
 Assigns the integer value. More...
 
void cbor_mark_uint (cbor_item_t *item)
 Marks the integer item as a positive integer. More...
 
void cbor_mark_negint (cbor_item_t *item)
 Marks the integer item as a negative integer. More...
 
cbor_item_tcbor_new_int8 ()
 Allocates new integer with 1B width. More...
 
cbor_item_tcbor_new_int16 ()
 Allocates new integer with 2B width. More...
 
cbor_item_tcbor_new_int32 ()
 Allocates new integer with 4B width. More...
 
cbor_item_tcbor_new_int64 ()
 Allocates new integer with 8B width. More...
 
cbor_item_tcbor_build_uint8 (uint8_t value)
 Constructs a new positive integer. More...
 
cbor_item_tcbor_build_uint16 (uint16_t value)
 Constructs a new positive integer. More...
 
cbor_item_tcbor_build_uint32 (uint32_t value)
 Constructs a new positive integer. More...
 
cbor_item_tcbor_build_uint64 (uint64_t value)
 Constructs a new positive integer. More...
 
cbor_item_tcbor_build_negint8 (uint8_t value)
 Constructs a new negative integer. More...
 
cbor_item_tcbor_build_negint16 (uint16_t value)
 Constructs a new negative integer. More...
 
cbor_item_tcbor_build_negint32 (uint32_t value)
 Constructs a new negative integer. More...
 
cbor_item_tcbor_build_negint64 (uint64_t value)
 Constructs a new negative integer. More...
 

Function Documentation

§ cbor_build_negint16()

cbor_item_t* cbor_build_negint16 ( uint16_t  value)

Constructs a new negative integer.

Parameters
valuethe value to use
Returns
new negative integer

Definition at line 185 of file ints.c.

§ cbor_build_negint32()

cbor_item_t* cbor_build_negint32 ( uint32_t  value)

Constructs a new negative integer.

Parameters
valuethe value to use
Returns
new negative integer

Definition at line 193 of file ints.c.

§ cbor_build_negint64()

cbor_item_t* cbor_build_negint64 ( uint64_t  value)

Constructs a new negative integer.

Parameters
valuethe value to use
Returns
new negative integer

Definition at line 201 of file ints.c.

§ cbor_build_negint8()

cbor_item_t* cbor_build_negint8 ( uint8_t  value)

Constructs a new negative integer.

Parameters
valuethe value to use
Returns
new negative integer

Definition at line 177 of file ints.c.

§ cbor_build_uint16()

cbor_item_t* cbor_build_uint16 ( uint16_t  value)

Constructs a new positive integer.

Parameters
valuethe value to use
Returns
new positive integer

Definition at line 153 of file ints.c.

§ cbor_build_uint32()

cbor_item_t* cbor_build_uint32 ( uint32_t  value)

Constructs a new positive integer.

Parameters
valuethe value to use
Returns
new positive integer

Definition at line 161 of file ints.c.

§ cbor_build_uint64()

cbor_item_t* cbor_build_uint64 ( uint64_t  value)

Constructs a new positive integer.

Parameters
valuethe value to use
Returns
new positive integer

Definition at line 169 of file ints.c.

§ cbor_build_uint8()

cbor_item_t* cbor_build_uint8 ( uint8_t  value)

Constructs a new positive integer.

Parameters
valuethe value to use
Returns
new positive integer

Definition at line 145 of file ints.c.

§ cbor_get_int()

uint64_t cbor_get_int ( const cbor_item_t item)

Extracts the integer value.

Parameters
item[borrow]positive or negative integer
Returns
the value, extended to uint64_t

Definition at line 44 of file ints.c.

§ cbor_get_uint16()

uint16_t cbor_get_uint16 ( const cbor_item_t item)

Extracts the integer value.

Parameters
item[borrow]positive or negative integer
Returns
the value

Definition at line 23 of file ints.c.

§ cbor_get_uint32()

uint32_t cbor_get_uint32 ( const cbor_item_t item)

Extracts the integer value.

Parameters
item[borrow]positive or negative integer
Returns
the value

Definition at line 30 of file ints.c.

§ cbor_get_uint64()

uint64_t cbor_get_uint64 ( const cbor_item_t item)

Extracts the integer value.

Parameters
item[borrow]positive or negative integer
Returns
the value

Definition at line 37 of file ints.c.

§ cbor_get_uint8()

uint8_t cbor_get_uint8 ( const cbor_item_t item)

Extracts the integer value.

Parameters
item[borrow]positive or negative integer
Returns
the value

Definition at line 16 of file ints.c.

§ cbor_int_get_width()

cbor_int_width cbor_int_get_width ( const cbor_item_t item)

Queries the integer width.

Parameters
item[borrow]positive or negative integer item
Returns
the width

Definition at line 10 of file ints.c.

§ cbor_mark_negint()

void cbor_mark_negint ( cbor_item_t item)

Marks the integer item as a negative integer.

The data value is not changed

Parameters
item[borrow]positive or negative integer item

Definition at line 91 of file ints.c.

§ cbor_mark_uint()

void cbor_mark_uint ( cbor_item_t item)

Marks the integer item as a positive integer.

The data value is not changed

Parameters
item[borrow]positive or negative integer item

Definition at line 85 of file ints.c.

§ cbor_new_int16()

cbor_item_t* cbor_new_int16 ( )

Allocates new integer with 2B width.

The width cannot be changed once allocated

Returns
new positive integer. The value is not initialized.

Definition at line 109 of file ints.c.

§ cbor_new_int32()

cbor_item_t* cbor_new_int32 ( )

Allocates new integer with 4B width.

The width cannot be changed once allocated

Returns
new positive integer. The value is not initialized.

Definition at line 121 of file ints.c.

§ cbor_new_int64()

cbor_item_t* cbor_new_int64 ( )

Allocates new integer with 8B width.

The width cannot be changed once allocated

Returns
new positive integer. The value is not initialized.

Definition at line 133 of file ints.c.

§ cbor_new_int8()

cbor_item_t* cbor_new_int8 ( )

Allocates new integer with 1B width.

The width cannot be changed once allocated

Returns
new positive integer. The value is not initialized.

Definition at line 97 of file ints.c.

§ cbor_set_uint16()

void cbor_set_uint16 ( cbor_item_t item,
uint16_t  value 
)

Assigns the integer value.

Parameters
item[borrow]positive or negative integer item
valuethe value to assign. For negative integer, the logical value is -value - 1

Definition at line 63 of file ints.c.

§ cbor_set_uint32()

void cbor_set_uint32 ( cbor_item_t item,
uint32_t  value 
)

Assigns the integer value.

Parameters
item[borrow]positive or negative integer item
valuethe value to assign. For negative integer, the logical value is -value - 1

Definition at line 71 of file ints.c.

§ cbor_set_uint64()

void cbor_set_uint64 ( cbor_item_t item,
uint64_t  value 
)

Assigns the integer value.

Parameters
item[borrow]positive or negative integer item
valuethe value to assign. For negative integer, the logical value is -value - 1

Definition at line 78 of file ints.c.

§ cbor_set_uint8()

void cbor_set_uint8 ( cbor_item_t item,
uint8_t  value 
)

Assigns the integer value.

Parameters
item[borrow]positive or negative integer item
valuethe value to assign. For negative integer, the logical value is -value - 1

Definition at line 56 of file ints.c.