48 { from_json(j, val) };
67 std::is_same_v<T, std::nullptr_t> ||
68 std::is_same_v<T, bool> ||
69 std::is_floating_point_v<T> ||
70 std::is_integral_v<T> ||
71 std::convertible_to<T, std::string> ||
72 std::convertible_to<T, std::string_view> ||
73 std::is_same_v<T, std::vector<json>> ||
74 std::is_same_v<T, wpi::util::StringMap<json>>;
76template <
typename F,
typename Tuple,
size_t... I>
79 (f(std::get<I * 2>(std::forward<Tuple>(t)),
80 std::get<I * 2 + 1>(std::forward<Tuple>(t))), ...);
126 overlong_utf8_0xffff,
127 object_missing_value,
128 illegal_utf8_character,
129 invalid_unicode_escape,
130 utf16_surrogate_in_utf8,
131 unexpected_end_of_array,
132 hex_escape_not_printable,
133 invalid_escape_character,
134 utf8_exceeds_utf16_range,
135 unexpected_end_of_string,
136 unexpected_end_of_object,
137 object_key_must_be_string,
138 c1_control_code_in_string,
139 non_del_c0_control_code_in_string,
192 if (
value <= LLONG_MAX) {
207 if (
value <= LLONG_MAX) {
232 template <std::ranges::input_range R>
238 template <detail::HasToJson T>
241 to_json(*
this,
value);
244 template <detail::HasJsonSerializer T>
318 template <detail::HasFromJson T>
321 from_json(*
this,
value);
325 template <detail::HasJsonDeserializer T>
338 template <
typename... Args>
342 (j.
array_value.emplace_back(std::forward<Args>(args)), ...);
346 template <
typename... Args>
351 [&](
auto&& key,
auto&&
value) {
352 j.
object_value[std::forward<decltype(key)>(key)] = std::forward<decltype(value)>(
value);
354 std::forward_as_tuple(args...),
355 std::make_index_sequence<
sizeof...(Args) / 2>{});
365 template <detail::HasToJson T>
367 to_json(*
this,
value);
371 template <detail::HasJsonSerializer T>
395 operator std::string()
const
400 void marshal(wpi::util::raw_ostream& os,
bool pretty =
false,
int indent = 0)
const;
413 static const char* StatusToString(Status);
415 static void serialize(wpi::util::raw_ostream&, std::string_view);
416 static Status
parse(
json&,
const char*&,
const char*,
int,
int);
421 return !(lhs == rhs);
and restrictions which apply to each piece of software is included later in this file and or inside of the individual applicable source files The disclaimer of warranty in the WPILib license above applies to all code in and nothing in any of the other licenses gives permission to use the names of FIRST nor the names of the WPILib contributors to endorse or promote products derived from this software The following pieces of software have additional or alternate and or glfw and nanopb were modified for use in Google Inc All rights reserved Redistribution and use in source and binary with or without are permitted provided that the following conditions are this list of conditions and the following disclaimer *Redistributions in binary form must reproduce the above copyright this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution *Neither the name of Google Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable from
Definition ThirdPartyNotices.txt:136
StringMap is a sorted associative container that contains key-value pairs with unique string keys.
Definition StringMap.hpp:26
An expected<T, E> object is an object that contains the storage for another object and manages the li...
Definition expected:1250
json & at(std::string_view)
std::vector< json > array_t
Definition json.hpp:88
json(const T &value)
Definition json.hpp:239
json(const R &range)
Definition json.hpp:234
static void stringify_int(wpi::util::raw_ostream &, long long)
std::string to_string() const
json & operator=(json &&)
bool bool_value
Definition json.hpp:145
constexpr json(long long value)
Definition json.hpp:201
std::string string_value
Definition json.hpp:150
const array_t & get_array() const
json(const std::string &)
constexpr json(unsigned long long value)
Definition json.hpp:205
json value(size_t, json &&)
bool contains(std::string_view) const
Type
Definition json.hpp:92
@ Int
Definition json.hpp:95
@ Float
Definition json.hpp:97
@ String
Definition json.hpp:99
@ Array
Definition json.hpp:100
@ Object
Definition json.hpp:101
@ Null
Definition json.hpp:93
@ Bool
Definition json.hpp:94
@ Double
Definition json.hpp:98
@ Uint
Definition json.hpp:96
json & emplace_back(json &&value)
T get() const
Definition json.hpp:319
constexpr bool is_float() const
Definition json.hpp:280
long long long_value
Definition json.hpp:148
static void stringify_double(wpi::util::raw_ostream &, double)
json & operator=(const T &value)
Definition json.hpp:366
long long get_int() const
static json object(Args &&... args)
Definition json.hpp:347
json * lookup(std::string_view)
void erase(std::string_view)
constexpr json(std::same_as< bool > auto value)
Definition json.hpp:170
constexpr json(int value)
Definition json.hpp:174
json value(std::string_view, json &&)
std::string & get_string()
json(array_t &&value)
Definition json.hpp:224
json & operator=(const json &)
static json array(Args &&... args)
Definition json.hpp:339
static void stringify_uint(wpi::util::raw_ostream &, unsigned long long)
bool is_object() const
Definition json.hpp:300
const json & at(size_t) const
constexpr json(double value)
Definition json.hpp:216
double get_double() const
const json * lookup(std::string_view) const
constexpr bool is_double() const
Definition json.hpp:285
constexpr json(long value)
Definition json.hpp:186
json(object_t &&value)
Definition json.hpp:228
static void stringify_object(wpi::util::raw_ostream &, const object_t &, bool pretty=false, int indent=0)
void marshal(wpi::util::raw_ostream &os, bool pretty=false, int indent=0) const
float float_value
Definition json.hpp:146
double get_number() const
constexpr bool is_uint() const
Definition json.hpp:275
bool is_array() const
Definition json.hpp:295
static void stringify_string(wpi::util::raw_ostream &, std::string_view)
const json & at(std::string_view) const
const object_t & get_object() const
double double_value
Definition json.hpp:147
unsigned long long get_uint() const
json(std::string &&value)
Definition json.hpp:220
std::string to_string_pretty() const
constexpr bool is_null() const
Definition json.hpp:255
array_t array_value
Definition json.hpp:151
unsigned long long ulong_value
Definition json.hpp:149
constexpr bool is_number() const
Definition json.hpp:265
constexpr json(unsigned long value)
Definition json.hpp:190
constexpr bool is_bool() const
Definition json.hpp:260
static void stringify_float(wpi::util::raw_ostream &, float)
constexpr Type type() const
Definition json.hpp:250
constexpr json(const std::nullptr_t=nullptr)
Definition json.hpp:166
wpi::util::StringMap< json > object_t
Definition json.hpp:89
static void stringify_null(wpi::util::raw_ostream &)
constexpr json(float value)
Definition json.hpp:178
static json parse_or_throw(std::string_view)
static wpi::util::expected< json, const char * > parse(std::string_view)
bool is_string() const
Definition json.hpp:290
constexpr bool is_int() const
Definition json.hpp:270
constexpr json(unsigned value)
Definition json.hpp:182
object_t object_value
Definition json.hpp:152
json & operator[](std::string_view)
friend bool operator==(const json &lhs, const json &rhs)
json & operator[](size_t)
const std::string & get_string() const
static void stringify_bool(wpi::util::raw_ostream &, bool)
static void stringify_array(wpi::util::raw_ostream &, const array_t &, bool pretty=false, int indent=0)
Converts a string literal into a format string that will be parsed at compile time and converted into...
Definition printf.h:50
Definition StringMap.hpp:773
void apply_pairs_helper(F &&f, Tuple &&t, std::index_sequence< I... >)
Definition json.hpp:77
Definition raw_os_ostream.hpp:19
constexpr bool operator!=(const unexpected< E > &lhs, const unexpected< E > &rhs)
Definition expected:180
constexpr bool operator==(const unexpected< E > &lhs, const unexpected< E > &rhs)
Definition expected:176