25#ifndef JOIN_DATA_VALUE_HPP
26#define JOIN_DATA_VALUE_HPP
53 using Array = std::vector<Value>;
58 template <
typename Type>
124 constexpr Value (std::nullptr_t value)
290 constexpr std::size_t
index () const noexcept
292 return _data.
index ();
325 return convertBool ();
333 explicit operator bool ()
const
374 switch (_data.
index ())
377 return _data.
get<
IntegerValue> () >=
static_cast<int32_t
> (std::numeric_limits<int8_t>::min ()) &&
378 _data.
get<
IntegerValue> () <=
static_cast<int32_t
> (std::numeric_limits<int8_t>::max ());
381 return _data.
get<
UnsignedValue> () <=
static_cast<uint32_t
> (std::numeric_limits<int8_t>::max ());
384 return _data.
get<
Integer64Value> () >=
static_cast<int64_t
> (std::numeric_limits<int8_t>::min ()) &&
385 _data.
get<
Integer64Value> () <=
static_cast<int64_t
> (std::numeric_limits<int8_t>::max ());
388 return _data.
get<
Unsigned64Value> () <=
static_cast<uint64_t
> (std::numeric_limits<int8_t>::max ());
392 _data.
get<
RealValue> () >=
static_cast<double> (std::numeric_limits<int8_t>::min ()) &&
393 _data.
get<
RealValue> () <=
static_cast<double> (std::numeric_limits<int8_t>::max ());
411 switch (_data.
index ())
430 throwException<std::bad_cast> ();
438 explicit operator int8_t ()
const
449 switch (_data.
index ())
453 _data.
get<
IntegerValue> () <=
static_cast<int32_t
> (std::numeric_limits<uint8_t>::max ());
456 return _data.
get<
UnsignedValue> () <=
static_cast<uint32_t
> (std::numeric_limits<uint8_t>::max ());
460 _data.
get<
Integer64Value> () <=
static_cast<int64_t
> (std::numeric_limits<uint8_t>::max ());
464 static_cast<uint64_t
> (std::numeric_limits<uint8_t>::max ());
469 _data.
get<
RealValue> () <=
static_cast<double> (std::numeric_limits<uint8_t>::max ());
487 switch (_data.
index ())
506 throwException<std::bad_cast> ();
514 explicit operator uint8_t ()
const
525 switch (_data.
index ())
528 return _data.
get<
IntegerValue> () >=
static_cast<int32_t
> (std::numeric_limits<int16_t>::min ()) &&
529 _data.
get<
IntegerValue> () <=
static_cast<int32_t
> (std::numeric_limits<int16_t>::max ());
532 return _data.
get<
UnsignedValue> () <=
static_cast<uint32_t
> (std::numeric_limits<int16_t>::max ());
536 static_cast<int64_t
> (std::numeric_limits<int16_t>::min ()) &&
537 _data.
get<
Integer64Value> () <=
static_cast<int64_t
> (std::numeric_limits<int16_t>::max ());
541 static_cast<uint64_t
> (std::numeric_limits<int16_t>::max ());
545 _data.
get<
RealValue> () >=
static_cast<double> (std::numeric_limits<int16_t>::min ()) &&
546 _data.
get<
RealValue> () <=
static_cast<double> (std::numeric_limits<int16_t>::max ());
564 switch (_data.
index ())
583 throwException<std::bad_cast> ();
591 explicit operator int16_t ()
const
602 switch (_data.
index ())
606 _data.
get<
IntegerValue> () <=
static_cast<int32_t
> (std::numeric_limits<uint16_t>::max ());
609 return _data.
get<
UnsignedValue> () <=
static_cast<uint32_t
> (std::numeric_limits<uint16_t>::max ());
613 _data.
get<
Integer64Value> () <=
static_cast<int64_t
> (std::numeric_limits<uint16_t>::max ());
617 static_cast<uint64_t
> (std::numeric_limits<uint16_t>::max ());
622 _data.
get<
RealValue> () <=
static_cast<double> (std::numeric_limits<uint16_t>::max ());
640 switch (_data.
index ())
659 throwException<std::bad_cast> ();
667 explicit operator uint16_t ()
const
678 switch (_data.
index ())
684 return _data.
get<
UnsignedValue> () <=
static_cast<uint32_t
> (std::numeric_limits<int32_t>::max ());
688 static_cast<int64_t
> (std::numeric_limits<int32_t>::min ()) &&
689 _data.
get<
Integer64Value> () <=
static_cast<int64_t
> (std::numeric_limits<int32_t>::max ());
693 static_cast<uint64_t
> (std::numeric_limits<int32_t>::max ());
697 _data.
get<
RealValue> () >=
static_cast<double> (std::numeric_limits<int32_t>::min ()) &&
698 _data.
get<
RealValue> () <=
static_cast<double> (std::numeric_limits<int32_t>::max ());
719 return convertInt ();
727 explicit operator int32_t ()
const
738 switch (_data.
index ())
748 _data.
get<
Integer64Value> () <=
static_cast<int64_t
> (std::numeric_limits<uint32_t>::max ());
752 static_cast<uint64_t
> (std::numeric_limits<uint32_t>::max ());
757 _data.
get<
RealValue> () <=
static_cast<double> (std::numeric_limits<uint32_t>::max ());
778 return convertUint ();
786 explicit operator uint32_t ()
const
797 switch (_data.
index ())
806 static_cast<uint64_t
> (std::numeric_limits<int64_t>::max ());
810 _data.
get<
RealValue> () >=
static_cast<double> (std::numeric_limits<int64_t>::min ()) &&
811 _data.
get<
RealValue> () <
static_cast<double> (std::numeric_limits<int64_t>::max ());
832 return convertInt64 ();
840 explicit operator int64_t ()
const
851 switch (_data.
index ())
868 _data.
get<
RealValue> () <
static_cast<double> (std::numeric_limits<uint64_t>::max ());
889 return convertUint64 ();
897 explicit operator uint64_t ()
const
923 return convertFloat ();
931 explicit operator float ()
const
957 return convertDouble ();
965 explicit operator double ()
const
994 explicit operator std::string_view ()
const
1067 if (member.first.isNull ())
1069 return member.second;
1073 throwException<std::out_of_range> (
"invalid key");
1086 if (member.first.isBool () && member.first.getBool () ==
key)
1088 return member.second;
1092 throwException<std::out_of_range> (
"invalid key");
1110 if (member.first.isInt () && member.first.getInt () ==
key)
1112 return member.second;
1116 throwException<std::out_of_range> (
"invalid key");
1134 if (member.first.isUint () && member.first.getUint () ==
key)
1136 return member.second;
1140 throwException<std::out_of_range> (
"invalid key");
1158 if (member.first.isInt64 () && member.first.getInt64 () ==
key)
1160 return member.second;
1164 throwException<std::out_of_range> (
"invalid key");
1182 if (member.first.isUint64 () && member.first.getUint64 () ==
key)
1184 return member.second;
1188 throwException<std::out_of_range> (
"invalid key");
1201 if (member.first.isDouble () && member.first.getDouble () ==
key)
1203 return member.second;
1207 throwException<std::out_of_range> (
"invalid key");
1220 if (member.first.isString () && member.first.getString () ==
key)
1222 return member.second;
1226 throwException<std::out_of_range> (
"invalid key");
1237 return at (std::string_view (
key));
1250 if (member.first.isNull ())
1252 return member.second;
1256 throwException<std::out_of_range> (
"invalid key");
1269 if (member.first.isBool () && member.first.getBool () ==
key)
1271 return member.second;
1275 throwException<std::out_of_range> (
"invalid key");
1293 if (member.first.isInt () && member.first.getInt () ==
key)
1295 return member.second;
1299 throwException<std::out_of_range> (
"invalid key");
1317 if (member.first.isUint () && member.first.getUint () ==
key)
1319 return member.second;
1323 throwException<std::out_of_range> (
"invalid key");
1341 if (member.first.isInt64 () && member.first.getInt64 () ==
key)
1343 return member.second;
1347 throwException<std::out_of_range> (
"invalid key");
1365 if (member.first.isUint64 () && member.first.getUint64 () ==
key)
1367 return member.second;
1371 throwException<std::out_of_range> (
"invalid key");
1384 if (member.first.isDouble () && member.first.getDouble () ==
key)
1386 return member.second;
1390 throwException<std::out_of_range> (
"invalid key");
1403 if (member.first.isString () && member.first.getString () ==
key)
1405 return member.second;
1409 throwException<std::out_of_range> (
"invalid key");
1420 return at (std::string_view (
key));
1438 if (member.first.isNull ())
1440 return member.second;
1464 if (member.first.isBool () && member.first.getBool () ==
key)
1466 return member.second;
1495 if (member.first.isInt () && member.first.getInt () ==
key)
1497 return member.second;
1526 if (member.first.isUint () && member.first.getUint () ==
key)
1528 return member.second;
1557 if (member.first.isInt64 () && member.first.getInt64 () ==
key)
1559 return member.second;
1588 if (member.first.isUint64 () && member.first.getUint64 () ==
key)
1590 return member.second;
1614 if (member.first.isDouble () && member.first.getDouble () ==
key)
1616 return member.second;
1640 if (member.first.isString () && member.first.getString () ==
key)
1642 return member.second;
1669 switch (_data.
index ())
1684 throwException<std::bad_cast> ();
1694 switch (_data.
index ())
1709 throwException<std::bad_cast> ();
1719 switch (_data.
index ())
1737 throwException<std::bad_cast> ();
1746 switch (_data.
index ())
1764 throwException<std::bad_cast> ();
1802 for (
auto it = beg; it != end; ++it)
1804 if (it->first.isNull ())
1825 for (
auto it = beg; it != end; ++it)
1827 if (it->first.isBool () && it->first.getBool () ==
key)
1848 for (
auto it = beg; it != end; ++it)
1850 if (it->first.isInt () && it->first.getInt () ==
key)
1871 for (
auto it = beg; it != end; ++it)
1873 if (it->first.isUint () && it->first.getUint () ==
key)
1894 for (
auto it = beg; it != end; ++it)
1896 if (it->first.isInt64 () && it->first.getInt64 () ==
key)
1917 for (
auto it = beg; it != end; ++it)
1919 if (it->first.isUint64 () && it->first.getUint64 () ==
key)
1940 for (
auto it = beg; it != end; ++it)
1942 if (it->first.isDouble () && it->first.getDouble () ==
key)
1963 for (
auto it = beg; it != end; ++it)
1965 if (it->first.isString () && it->first.getString () ==
key)
1983 return erase (std::string_view (
key));
1992 template <
typename... Args>
1999 _data.
get<
ArrayValue> ().emplace_back (std::forward<Args> (args)...);
2054 if (member.first.isNull ())
2073 if (member.first.isBool () && member.first.getBool () ==
key)
2097 if (member.first.isInt () && member.first.getInt () ==
key)
2121 if (member.first.isUint () && member.first.getUint () ==
key)
2145 if (member.first.isInt64 () && member.first.getInt64 () ==
key)
2169 if (member.first.isUint64 () && member.first.getUint64 () ==
key)
2188 if (member.first.isDouble () && member.first.getDouble () ==
key)
2207 if (member.first.isString () && member.first.getString () ==
key)
2233 Value temp (std::move (*
this));
2234 *
this = std::move (other);
2235 other = std::move (temp);
2243 template <
typename Handler>
2267 template <
typename Reader,
typename... Args>
2271 return reader.deserialize (std::forward<Args> (args)..., *
this);
2280 template <
typename Writer,
typename... Args>
2281 int serialize (std::ostream& document, Args&&... args)
const
2283 Writer writer (document, std::forward<Args> (args)...);
2293 int jsonRead (
const char* document,
size_t length);
2301 int jsonRead (
const char* first,
const char* last);
2308 int jsonRead (std::string_view document);
2315 int jsonRead (std::stringstream& document);
2322 int jsonRead (std::istringstream& document);
2329 int jsonRead (std::fstream& document);
2336 int jsonRead (std::ifstream& document);
2343 int jsonRead (std::iostream& document);
2350 int jsonRead (std::istream& document);
2358 int jsonWrite (std::ostream& document,
size_t indentation = 0)
const;
2373 int packRead (
const char* document,
size_t length);
2381 int packRead (
const char* first,
const char* last);
2388 int packRead (std::string_view document);
2395 int packRead (std::stringstream& document);
2402 int packRead (std::istringstream& document);
2409 int packRead (std::fstream& document);
2416 int packRead (std::ifstream& document);
2423 int packRead (std::iostream& document);
2430 int packRead (std::istream& document);
2437 int packWrite (std::ostream& document)
const;
2452 template <
typename Handler>
2453 static int setValue (
const Value& value, Handler& handler)
2455 switch (value.
index ())
2458 return handler.setBool (value.
getBool ());
2461 return handler.setInt (value.
getInt ());
2464 return handler.setUint (value.
getUint ());
2467 return handler.setInt64 (value.
getInt64 ());
2470 return handler.setUint64 (value.
getUint64 ());
2473 return handler.setDouble (value.
getDouble ());
2476 return handler.setString (value.
getString ());
2479 return setArray (value.
getArray (), handler);
2482 return setObject (value.
getObject (), handler);
2485 return handler.setNull ();
2495 template <
typename Handler>
2496 static int setArray (
const Array& array, Handler& handler)
2498 if (handler.startArray (array.size ()) == -1)
2503 for (
auto const& element : array)
2505 if (setValue (element, handler) == -1)
2511 return handler.stopArray ();
2520 template <
typename Handler>
2521 static int setObject (
const Object&
object, Handler& handler)
2523 if (handler.startObject (
object.size ()) == -1)
2528 for (
const Member& member : handler.members (
object))
2534 result = handler.setKey (member.first.getString ());
2538 switch (member.first.index ())
2541 result = handler.setKey (member.first.getBool ());
2545 result = handler.setKey (member.first.getInt ());
2549 result = handler.setKey (member.first.getUint ());
2553 result = handler.setKey (member.first.getInt64 ());
2557 result = handler.setKey (member.first.getUint64 ());
2561 result = handler.setKey (member.first.getDouble ());
2570 result = handler.setKey (
nullptr);
2580 if (setValue (member.second, handler) == -1)
2586 return handler.stopObject ();
2593 float convertFloat ()
const
2595 switch (_data.
index ())
2613 throwException<std::bad_cast> ();
2620 bool convertBool ()
const
2622 switch (_data.
index ())
2646 throwException<std::bad_cast> ();
2653 int32_t convertInt ()
const
2657 switch (_data.
index ())
2673 throwException<std::bad_cast> ();
2680 uint32_t convertUint ()
const
2684 switch (_data.
index ())
2696 return static_cast<uint32_t
> (_data.
get<
RealValue> ());
2700 throwException<std::bad_cast> ();
2707 int64_t convertInt64 ()
const
2711 switch (_data.
index ())
2727 throwException<std::bad_cast> ();
2734 uint64_t convertUint64 ()
const
2738 switch (_data.
index ())
2750 return static_cast<uint64_t
> (_data.
get<
RealValue> ());
2754 throwException<std::bad_cast> ();
2761 double convertDouble ()
const
2763 switch (_data.
index ())
2781 throwException<std::bad_cast> ();
2812 return lhs._data == rhs._data;
2829 return std::partial_ordering::less;
2837 return std::partial_ordering::greater;
2847 return lhs._data <=> rhs._data;
value class.
Definition value.hpp:92
constexpr int32_t getInt() const
get variable held by value as a 32 bits integer.
Definition value.hpp:712
constexpr bool isFloat() const
check if the variable held by value is a float value.
Definition value.hpp:906
Value & at(std::string_view key)
returns a reference to the value mapped to key.
Definition value.hpp:1216
int serialize(Handler &handler) const
serialize the value, resetting the handler on failure.
Definition value.hpp:2244
bool contains(double key) const
checks if the nested container contains an element that is mapped to key.
Definition value.hpp:2184
size_t size() const
returns the number of elements in the nested container.
Definition value.hpp:1692
size_t erase(uint64_t key)
removes member with the key equivalent to key.
Definition value.hpp:1912
Value & operator=(const Value &other)=default
copy assignment.
Value(Object &&value)
constructs an object value.
Definition value.hpp:250
void clear()
erases all elements in the nested container.
Definition value.hpp:1744
Value(std::string_view value)
constructs a string value from a string view.
Definition value.hpp:196
const Value & at(std::nullptr_t key) const
returns a reference to the value mapped to key.
Definition value.hpp:1246
void swap(Value &other)
exchanges the contents of the value with those of other.
Definition value.hpp:2231
constexpr bool isFalse() const
check if the content of the value is false.
Definition value.hpp:353
bool contains(std::string_view key) const
checks if the nested container contains an element that is mapped to key.
Definition value.hpp:2203
int deserialize(Args &&... args)
deserialize a document into the value.
Definition value.hpp:2268
Value & at(uint64_t key)
returns a reference to the value at position pos or mapped to key.
Definition value.hpp:1173
bool contains(uint32_t key) const
checks if the nested container contains an element that is mapped to key.
Definition value.hpp:2112
Value & at(std::nullptr_t key)
returns a reference to the value mapped to key.
Definition value.hpp:1063
constexpr int16_t getInt16() const
get variable held by value as a 16 bits integer.
Definition value.hpp:560
constexpr bool isInt() const
check if the variable held by value is a 32 bits integer value.
Definition value.hpp:676
size_t erase(std::string_view key)
removes member with the key equivalent to key.
Definition value.hpp:1958
friend constexpr bool operator==(const Value &lhs, const Value &rhs)
compare if equal.
Definition value.hpp:2794
size_t erase(std::nullptr_t key)
removes member with the key equivalent to key.
Definition value.hpp:1797
constexpr bool isInt64() const
check if the variable held by value is a 64 bits integer value.
Definition value.hpp:795
constexpr bool isUint16() const
check if the variable held by value is a 16 bits unsigned integer value.
Definition value.hpp:600
void popBack()
removes the last element of the nested container.
Definition value.hpp:2039
bool contains(int32_t key) const
checks if the nested container contains an element that is mapped to key.
Definition value.hpp:2088
constexpr bool isTrue() const
check if the content of the value is true.
Definition value.hpp:343
Value(const Object &value)
constructs an object value.
Definition value.hpp:241
const Value & at(const char *key) const
returns a reference to the value mapped to key.
Definition value.hpp:1418
constexpr Value(uint32_t value)
constructs an unsigned integer value.
Definition value.hpp:151
constexpr const Array & getArray() const
get variable held by value as an array.
Definition value.hpp:1013
Value & insert(Member &&member)
insert element in the nested container.
Definition value.hpp:1785
constexpr Value(bool value)
constructs a boolean value.
Definition value.hpp:133
constexpr bool isArray() const
check if the variable held by value is an array.
Definition value.hpp:1003
int serialize(std::ostream &document, Args &&... args) const
serialize the value to a stream.
Definition value.hpp:2281
constexpr bool isUint64() const
check if the variable held by value is a 64 bits unsigned integer value.
Definition value.hpp:849
bool contains(bool key) const
checks if the nested container contains an element that is mapped to key.
Definition value.hpp:2069
Value & at(bool key)
returns a reference to the value mapped to key.
Definition value.hpp:1082
Value & at(int64_t key)
returns a reference to the value at position pos or mapped to key.
Definition value.hpp:1149
constexpr std::string_view getString() const
get variable held by value as a string value.
Definition value.hpp:984
Value & pushBack(Value &&value)
appends element at the end of the nested container.
Definition value.hpp:2025
constexpr Object & getObject()
get variable held by value as an object.
Definition value.hpp:1052
constexpr bool isObject() const
check if the variable held by value is an object.
Definition value.hpp:1032
constexpr const Object & getObject() const
get variable held by value as an object.
Definition value.hpp:1042
void reserve(size_t cap)
increase the capacity of the nested container.
Definition value.hpp:1717
constexpr uint8_t getUint8() const
get variable held by value as a 8 bits unsigned integer.
Definition value.hpp:483
const Value & at(int32_t key) const
returns a reference to the value at position pos or mapped to key.
Definition value.hpp:1284
size_t erase(bool key)
removes member with the key equivalent to key.
Definition value.hpp:1820
bool contains(std::nullptr_t key) const
checks if the nested container contains an element that is mapped to key.
Definition value.hpp:2050
constexpr bool isUint() const
check if the variable held by value is a 32 bits unsigned integer value.
Definition value.hpp:736
constexpr bool isInt16() const
check if the variable held by value is a 16 bits integer value.
Definition value.hpp:523
Value(Array &&value)
constructs an array value.
Definition value.hpp:232
constexpr bool getBool() const
get variable held by value as a boolean value.
Definition value.hpp:318
Value & at(int32_t key)
returns a reference to the value at position pos or mapped to key.
Definition value.hpp:1101
bool contains(uint64_t key) const
checks if the nested container contains an element that is mapped to key.
Definition value.hpp:2160
size_t erase(double key)
removes member with the key equivalent to key.
Definition value.hpp:1935
constexpr Value(std::nullptr_t value)
constructs a null value.
Definition value.hpp:124
int jsonCanonicalize(std::ostream &document) const
serialize canonicalized json data.
Definition value.cpp:132
constexpr std::size_t index() const noexcept
get the index of the alternative in use.
Definition value.hpp:290
Index
nested value type index.
Definition value.hpp:102
@ StringValue
Definition value.hpp:110
@ RealValue
Definition value.hpp:109
@ UnsignedValue
Definition value.hpp:106
@ BooleanValue
Definition value.hpp:104
@ NullValue
Definition value.hpp:103
@ Integer64Value
Definition value.hpp:107
@ Unsigned64Value
Definition value.hpp:108
@ ArrayValue
Definition value.hpp:111
@ IntegerValue
Definition value.hpp:105
@ ObjectValue
Definition value.hpp:112
Value & pushBack(const Value &value)
appends element at the end of the nested container.
Definition value.hpp:2009
const Value & at(uint32_t key) const
returns a reference to the value at position pos or mapped to key.
Definition value.hpp:1308
const Value & at(std::string_view key) const
returns a reference to the value mapped to key.
Definition value.hpp:1399
Value(const std::string &value)
constructs a string value.
Definition value.hpp:205
constexpr Value(Value &&other)=default
move constructor.
constexpr int8_t getInt8() const
get variable held by value as a 8 bits integer.
Definition value.hpp:407
const Value & at(int64_t key) const
returns a reference to the value at position pos or mapped to key.
Definition value.hpp:1332
Value(const Array &value)
constructs an array value.
Definition value.hpp:223
Value & at(double key)
returns a reference to the value mapped to key.
Definition value.hpp:1197
constexpr double getDouble() const
get variable held by value as a double value.
Definition value.hpp:950
constexpr Value(const Value &other)=default
copy constructor.
constexpr uint32_t getUint() const
get variable held by value as a 32 bits unsigned integer value.
Definition value.hpp:771
constexpr bool isBool() const
check if the variable held by value is a boolean value.
Definition value.hpp:308
constexpr Value()=default
default constructor.
Value & operator[](std::nullptr_t key)
returns a reference to the value mapped to key.
Definition value.hpp:1429
bool contains(int64_t key) const
checks if the nested container contains an element that is mapped to key.
Definition value.hpp:2136
const Value & at(uint64_t key) const
returns a reference to the value at position pos or mapped to key.
Definition value.hpp:1356
bool contains(const char *key) const
checks if the nested container contains an element that is mapped to key.
Definition value.hpp:2222
Value & at(const char *key)
returns a reference to the value mapped to key.
Definition value.hpp:1235
int jsonRead(const char *document, size_t length)
deserialize a json document.
Definition value.cpp:42
friend constexpr std::partial_ordering operator<=>(const Value &lhs, const Value &rhs)
three-way compare values.
Definition value.hpp:2821
constexpr bool isString() const
check if the variable held by value is a string value.
Definition value.hpp:974
constexpr float getFloat() const
get variable held by value as a float value.
Definition value.hpp:916
Value & at(uint32_t key)
returns a reference to the value at position pos or mapped to key.
Definition value.hpp:1125
constexpr bool isDouble() const
check if the variable held by value is a double value.
Definition value.hpp:940
constexpr Value(int64_t value)
constructs a 64 bits integer value.
Definition value.hpp:160
size_t erase(int64_t key)
removes member with the key equivalent to key.
Definition value.hpp:1889
size_t erase(uint32_t key)
removes member with the key equivalent to key.
Definition value.hpp:1866
constexpr Value(double value)
constructs a real value.
Definition value.hpp:178
const Value & at(double key) const
returns a reference to the value mapped to key.
Definition value.hpp:1380
size_t erase(int32_t key)
removes member with the key equivalent to key.
Definition value.hpp:1843
~Value()=default
destroy the Value instance.
Value & insert(const Member &member)
insert element in the nested container.
Definition value.hpp:1773
Value(std::string &&value)
constructs a string value.
Definition value.hpp:214
Value & emplaceBack(Args &&... args)
constructs an element in place at the end of the nested container.
Definition value.hpp:1993
constexpr uint64_t getUint64() const
get variable held by value as a 64 bits unsigned integer value.
Definition value.hpp:882
int packRead(const char *document, size_t length)
deserialize a msgpack document.
Definition value.cpp:141
size_t erase(const char *key)
removes member with the key equivalent to key.
Definition value.hpp:1981
constexpr Value(int32_t value)
constructs an integer value.
Definition value.hpp:142
bool empty() const
check if the nested container is empty.
Definition value.hpp:1667
constexpr bool isNumber() const
check if the variable held by value is a number value.
Definition value.hpp:362
int jsonWrite(std::ostream &document, size_t indentation=0) const
serialize json data.
Definition value.cpp:123
const Value & at(bool key) const
returns a reference to the value mapped to key.
Definition value.hpp:1265
constexpr bool isNull() const
check if the variable held by value is a null value.
Definition value.hpp:299
Value(const char *value)
constructs a string value from a C-style string.
Definition value.hpp:187
constexpr uint16_t getUint16() const
get variable held by value as a 16 bits unsigned integer.
Definition value.hpp:636
constexpr bool isUint8() const
check if the variable held by value is a 8 bits unsigned integer value.
Definition value.hpp:447
constexpr int64_t getInt64() const
get variable held by value as a 64 bits integer value.
Definition value.hpp:825
int packWrite(std::ostream &document) const
serialize msgpack data.
Definition value.cpp:222
constexpr Value(uint64_t value)
constructs a 64 bits unsigned integer value.
Definition value.hpp:169
constexpr bool isInt8() const
check if the variable held by value is a 8 bits integer value.
Definition value.hpp:372
constexpr Array & getArray()
get variable held by value as an array.
Definition value.hpp:1023
constexpr std::size_t index() const noexcept
return the index of the alternative that is currently held by the variant.
Definition variant.hpp:624
constexpr T & set(Args &&... args)
set the variable type of the object identified by type and assign it a value.
Definition variant.hpp:456
constexpr T & get()
get the variable value of the object type identified by type.
Definition variant.hpp:505
const std::string key(65, 'a')
key.
Definition acceptor.hpp:32
bool operator==(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
compare if endpoints are equal.
Definition endpoint.hpp:196
BasicMember< Value > Member
object member.
Definition value.hpp:83
std::vector< Value > Array
array.
Definition value.hpp:53
std::error_code make_error_code(join::Errc code) noexcept
Create an std::error_code object.
Definition error.cpp:195
thread_local std::error_code lastError
last error.
Definition error.cpp:32
std::vector< Member > Object
object.
Definition value.hpp:86
std::strong_ordering operator<=>(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
three-way compare endpoints.
Definition endpoint.hpp:208
member.
Definition value.hpp:60
Type first
member key.
Definition value.hpp:76
Type second
member value.
Definition value.hpp:79
constexpr bool operator==(const BasicMember &other) const =default
compare members.
constexpr std::partial_ordering operator<=>(const BasicMember &other) const =default
three-way compare members.
#define JOIN_LIKELY(x)
Definition utils.hpp:50