libcbor 0.12.0
libcbor is a C library for parsing and generating CBOR, the general-purpose schema-less binary data format.
Loading...
Searching...
No Matches
floats_ctrls.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014-2020 Pavel Kalvoda <me@pavelkalvoda.com>
3 *
4 * libcbor is free software; you can redistribute it and/or modify
5 * it under the terms of the MIT license. See LICENSE for details.
6 */
7
8#ifndef LIBCBOR_FLOATS_CTRLS_H
9#define LIBCBOR_FLOATS_CTRLS_H
10
11#include "cbor/cbor_export.h"
12#include "cbor/common.h"
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18/*
19 * ============================================================================
20 * Float manipulation
21 * ============================================================================
22 */
23
30 const cbor_item_t* item);
31
39
48 const cbor_item_t* item);
49
58 const cbor_item_t* item);
59
67_CBOR_NODISCARD CBOR_EXPORT double cbor_float_get_float8(
68 const cbor_item_t* item);
69
77_CBOR_NODISCARD CBOR_EXPORT double cbor_float_get_float(
78 const cbor_item_t* item);
79
85_CBOR_NODISCARD CBOR_EXPORT bool cbor_get_bool(const cbor_item_t* item);
86
96
106
116
126
133_CBOR_NODISCARD CBOR_EXPORT cbor_item_t* cbor_new_null(void);
134
142
150_CBOR_NODISCARD CBOR_EXPORT cbor_item_t* cbor_build_bool(bool value);
151
163CBOR_EXPORT void cbor_set_ctrl(cbor_item_t* item, uint8_t value);
164
170CBOR_EXPORT void cbor_set_bool(cbor_item_t* item, bool value);
171
177CBOR_EXPORT void cbor_set_float2(cbor_item_t* item, float value);
178
184CBOR_EXPORT void cbor_set_float4(cbor_item_t* item, float value);
185
191CBOR_EXPORT void cbor_set_float8(cbor_item_t* item, double value);
192
198_CBOR_NODISCARD CBOR_EXPORT uint8_t cbor_ctrl_value(const cbor_item_t* item);
199
207_CBOR_NODISCARD CBOR_EXPORT cbor_item_t* cbor_build_float2(float value);
208
216_CBOR_NODISCARD CBOR_EXPORT cbor_item_t* cbor_build_float4(float value);
217
225_CBOR_NODISCARD CBOR_EXPORT cbor_item_t* cbor_build_float8(double value);
226
234_CBOR_NODISCARD CBOR_EXPORT cbor_item_t* cbor_build_ctrl(uint8_t value);
235
236#ifdef __cplusplus
237}
238#endif
239
240#endif // LIBCBOR_FLOATS_CTRLS_H
#define _CBOR_NODISCARD
Definition common.h:93
cbor_float_width
Possible widths of CBOR_TYPE_FLOAT_CTRL items.
Definition data.h:66
cbor_float_width cbor_float_get_width(const cbor_item_t *item)
Get the float width.
cbor_item_t * cbor_build_ctrl(uint8_t value)
Constructs a ctrl item.
cbor_item_t * cbor_new_undef(void)
Constructs new undef ctrl item.
bool cbor_float_ctrl_is_ctrl(const cbor_item_t *item)
Is this a ctrl value?
double cbor_float_get_float8(const cbor_item_t *item)
Get a double precision float.
cbor_item_t * cbor_new_float2(void)
Constructs a new float item.
cbor_item_t * cbor_new_float8(void)
Constructs a new float item.
void cbor_set_ctrl(cbor_item_t *item, uint8_t value)
Assign a control value.
void cbor_set_float4(cbor_item_t *item, float value)
Assigns a float value.
void cbor_set_float8(cbor_item_t *item, double value)
Assigns a float value.
cbor_item_t * cbor_new_ctrl(void)
Constructs a new ctrl item.
cbor_item_t * cbor_build_bool(bool value)
Constructs new boolean ctrl item.
cbor_item_t * cbor_build_float4(float value)
Constructs a new float.
cbor_item_t * cbor_new_null(void)
Constructs new null ctrl item.
uint8_t cbor_ctrl_value(const cbor_item_t *item)
Reads the control value.
void cbor_set_float2(cbor_item_t *item, float value)
Assigns a float value.
float cbor_float_get_float2(const cbor_item_t *item)
Get a half precision float.
cbor_item_t * cbor_build_float8(double value)
Constructs a new float.
cbor_item_t * cbor_new_float4(void)
Constructs a new float item.
void cbor_set_bool(cbor_item_t *item, bool value)
Assign a boolean value to a boolean ctrl item.
float cbor_float_get_float4(const cbor_item_t *item)
Get a single precision float.
double cbor_float_get_float(const cbor_item_t *item)
Get the float value represented as double.
cbor_item_t * cbor_build_float2(float value)
Constructs a new float.
bool cbor_get_bool(const cbor_item_t *item)
Get value from a boolean ctrl item.
The item handle.
Definition data.h:171