5#ifndef ASTARTE_DEVICE_SDK_TYPE_H
6#define ASTARTE_DEVICE_SDK_TYPE_H
75 if (type ==
"binaryblob") {
78 if (type ==
"boolean") {
81 if (type ==
"datetime") {
84 if (type ==
"double") {
87 if (type ==
"integer") {
90 if (type ==
"longinteger") {
93 if (type ==
"string") {
96 if (type ==
"binaryblobarray") {
99 if (type ==
"booleanarray") {
102 if (type ==
"datetimearray") {
105 if (type ==
"doublearray") {
108 if (type ==
"integerarray") {
111 if (type ==
"longintegerarray") {
114 if (type ==
"stringarray") {
130 template <
typename ParseContext>
131 constexpr auto parse(ParseContext& ctx)
const {
141 template <
typename FormatContext>
143 std::string_view name =
"Unknown Type";
162 name =
"LongInteger";
168 name =
"BinaryBlobArray";
171 name =
"BooleanArray";
174 name =
"DatetimeArray";
177 name =
"DoubleArray";
180 name =
"IntegerArray";
183 name =
"LongIntegerArray";
186 name =
"StringArray";
190 return astarte_fmt::format_to(ctx.out(),
"{}", name);
202 out << astarte_fmt::format(
"{}", typ);
Error indicating that the provided Astarte type is incorrect.
Definition errors.hpp:425
Error types and handling for the Astarte device library.
Umbrella namespace for the Astarte device library.
Definition data.hpp:29
auto astarte_type_from_str(const std::string &type) -> astarte_tl::expected< Type, Error >
Converts a string representation of a type to a Type enum.
Definition type.hpp:74
Type
Enumeration of supported Astarte data types.
Definition type.hpp:33
@ kIntegerArray
Integer array Astarte type.
Definition type.hpp:57
@ kBoolean
Boolean Astarte type.
Definition type.hpp:37
@ kBooleanArray
Boolean array Astarte type.
Definition type.hpp:51
@ kLongIntegerArray
Long integer array Astarte type.
Definition type.hpp:59
@ kString
String Astarte type.
Definition type.hpp:47
@ kStringArray
String array Astarte type.
Definition type.hpp:61
@ kDatetime
Date-time Astarte type.
Definition type.hpp:39
@ kDoubleArray
Double array Astarte type.
Definition type.hpp:55
@ kInteger
Integer Astarte type.
Definition type.hpp:43
@ kLongInteger
Long integer Astarte type.
Definition type.hpp:45
@ kDouble
Double Astarte type.
Definition type.hpp:41
@ kBinaryBlob
Binary blob Astarte type.
Definition type.hpp:35
@ kDatetimeArray
Datetime array Astarte type.
Definition type.hpp:53
@ kBinaryBlobArray
Binary blob array Astarte type.
Definition type.hpp:49
Global namespace for all Astarte related functionality.
Definition data.hpp:29
auto operator<<(std::ostream &out, const astarte::device::Type typ) -> std::ostream &
Stream insertion operator for Type.
Definition type.hpp:201