Horizon
value_t.hpp
1 #pragma once
2 
3 #include <array> // array
4 #include <ciso646> // and
5 #include <cstddef> // size_t
6 #include <cstdint> // uint8_t
7 
8 namespace nlohmann
9 {
10 namespace detail
11 {
13 // JSON type enumeration //
15 
40 enum class value_t : std::uint8_t
41 {
42  null,
43  object,
44  array,
45  string,
46  boolean,
49  number_float,
50  discarded
51 };
52 
63 inline bool operator<(const value_t lhs, const value_t rhs) noexcept
64 {
65  static constexpr std::array<std::uint8_t, 8> order = {{
66  0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */,
67  1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */
68  }
69  };
70 
71  const auto l_index = static_cast<std::size_t>(lhs);
72  const auto r_index = static_cast<std::size_t>(rhs);
73  return l_index < order.size() and r_index < order.size() and order[l_index] < order[r_index];
74 }
75 }
76 }
nlohmann::detail::value_t
value_t
the JSON type enumeration
Definition: value_t.hpp:40
nlohmann::detail::value_t::object
object (unordered set of name/value pairs)
libzip::uint8_t
zip_uint8_t uint8_t
zip_uint8_t typedef.
Definition: zip.hpp:78
nlohmann
namespace for Niels Lohmann
Definition: adl_serializer.hpp:8
nlohmann::detail::value_t::number_float
number value (floating-point)
nlohmann::detail::value_t::number_integer
number value (signed integer)
nlohmann::detail::value_t::string
string value
nlohmann::detail::operator<
bool operator<(const value_t lhs, const value_t rhs) noexcept
comparison operator for JSON types
Definition: value_t.hpp:63
nlohmann::detail::value_t::number_unsigned
number value (unsigned integer)
nlohmann::detail::value_t::array
array (ordered collection of values)
nlohmann::detail::value_t::discarded
discarded by the the parser callback function
nlohmann::detail::value_t::boolean
boolean value