161 for (
const auto& item : vec) {
183 if (
this != &other) {
190 if (
this != &other) {
232 for (
const auto& item : vec) {
262 template<
typename IntType>
270 return mValue->as_float();
275 return mValue->as_double();
278 template<
typename FloatType>
286 return mValue->as_string();
307 template<
typename T,
typename OutputIt>
313 template<
typename Container>
315 return mValue ?
mValue->copy_to_output_iterator(out) : 0;
370 return mValue->as_string();
377 return mValue->clone_array();
384 auto ptr =
mValue->as_object();
495 if (!
mValue)
return typename json_value::template array_iterator<T>();
501 if (!
mValue)
return typename json_value::template array_iterator<T>();
507 if (!
mValue)
return typename json_value::template array_iterator<T>();
513 if (!
mValue)
return typename json_value::template array_iterator<T>();
527 for (
auto it =
begin(); it !=
end(); ++it) {
529 result.push_back(keyValue.first);
549 auto arr =
mValue->clone_array();
555 auto arrPtr =
mValue->as_array();
558 if (idx >= arrPtr->size()) {
559 for (
size_t i = arrPtr->size(); i <= idx; i++) {
563 return json((*arrPtr)[idx]);
565 return json(
nullptr);
570 return json(
nullptr);
573 auto arrPtr =
mValue->as_array();
575 if (idx < arrPtr->
size()) {
576 return json((*arrPtr)[idx]);
578 return json(
nullptr);
581 if (
auto p =
mValue->data.ptr<fl::vector<i16>>()) {
582 if (idx < p->
size())
return json(
static_cast<i64>((*p)[idx]));
583 }
else if (
auto p =
mValue->data.ptr<fl::vector<u8>>()) {
584 if (idx < p->
size())
return json(
static_cast<i64>((*p)[idx]));
585 }
else if (
auto p =
mValue->data.ptr<fl::vector<float>>()) {
586 if (idx < p->
size())
return json((*p)[idx]);
588 return json(
nullptr);
599 if (objPtr->find(key) == objPtr->end()) {
603 return json((*objPtr)[key]);
607 return json(
nullptr);
612 return json(
nullptr);
618 if (!objPtr)
return json(
nullptr);
619 auto it = objPtr->find(key);
620 if (it != objPtr->end()) {
621 return json(it->second);
623 return json(
nullptr);
642 if (!
mValue)
return fallback;
643 return (*
mValue) | fallback;
686 return json(
nullptr);
712 (*objPtr)[key] =
value.mValue;
727 template<typename T, typename = fl::enable_if_t<fl::is_same<T, char>::value>>
732 template<
typename IntType>
757 auto arr =
mValue->clone_array();
766 ptr->push_back(
value.mValue);
Back insert iterator - an output iterator that inserts elements at the end of a container.
static const_iterator from_object_iterator(const iterator &other) FL_NOEXCEPT
static const_iterator from_iterator(json_object::const_iterator iter) FL_NOEXCEPT
fl::enable_if< fl::is_integral< T >::value &&!fl::is_same< T, bool >::value, T >::type get_default_value() const FL_NOEXCEPT
void push_back(const json &value) FL_NOEXCEPT
size_t copy_to_output_iterator(OutputIt out) const FL_NOEXCEPT
friend json_value::const_iterator begin(const json &j) FL_NOEXCEPT
void set(const fl::string &key, float value) FL_NOEXCEPT
json(const fl::shared_ptr< json_value > &value) FL_NOEXCEPT
json(float f) FL_NOEXCEPT
fl::shared_ptr< json_value > mValue
const json_array * as_array() const FL_NOEXCEPT
fl::vector< fl::string > getObjectKeys() const FL_NOEXCEPT
static fl::string normalize_json_string(const char *jsonStr) FL_NOEXCEPT
const json_value * internal_value() const FL_NOEXCEPT
json(const char *s) FL_NOEXCEPT
fl::optional< i64 > as_int() const FL_NOEXCEPT
static json fromValue(const json_value &value) FL_NOEXCEPT
json(json_object o) FL_NOEXCEPT
fl::optional< T > as() const FL_NOEXCEPT
static json create_array() FL_NOEXCEPT
fl::string serialize() const FL_NOEXCEPT
bool is_generic_array() const FL_NOEXCEPT
json(const fl::string &s) FL_NOEXCEPT
fl::optional< double > as_double() const FL_NOEXCEPT
fl::string to_string_native() const FL_NOEXCEPT
bool is_array() const FL_NOEXCEPT
friend json_value::const_iterator end(const json &j) FL_NOEXCEPT
static json create_object() FL_NOEXCEPT
const json_object * as_object() const FL_NOEXCEPT
void set_value(const fl::shared_ptr< json_value > &value) FL_NOEXCEPT
bool is_float() const FL_NOEXCEPT
static json createArray() FL_NOEXCEPT
bool is_null() const FL_NOEXCEPT
void set(const fl::string &key, T value) FL_NOEXCEPT
fl::optional< json_object > clone_object() const FL_NOEXCEPT
bool is_bytes() const FL_NOEXCEPT
fl::optional< bool > as_bool() const FL_NOEXCEPT
T operator|(const T &fallback) const FL_NOEXCEPT
bool is_int() const FL_NOEXCEPT
fl::optional< float > as_float() const FL_NOEXCEPT
void set(const fl::string &key, double value) FL_NOEXCEPT
size_t get_size() const FL_NOEXCEPT
fl::optional< json_array > clone_array() const FL_NOEXCEPT
bool has_value() const FL_NOEXCEPT
fl::optional< T > try_as() const FL_NOEXCEPT
bool is_number() const FL_NOEXCEPT
bool is_object() const FL_NOEXCEPT
size_t size() const FL_NOEXCEPT
void set(const fl::string &key, const char *value) FL_NOEXCEPT
fl::string to_string() const FL_NOEXCEPT
json_value::iterator begin() FL_NOEXCEPT
void set(const fl::string &key, const fl::string &value) FL_NOEXCEPT
T as_or(const T &fallback) const FL_NOEXCEPT
bool is_string() const FL_NOEXCEPT
bool is_audio() const FL_NOEXCEPT
fl::enable_if< fl::is_integral< T >::value &&!fl::is_same< T, bool >::value, fl::optional< T > >::type as_impl() const FL_NOEXCEPT
bool is_bool() const FL_NOEXCEPT
fl::vector< fl::string > keys() const FL_NOEXCEPT
fl::string to_string_native_public() const FL_NOEXCEPT
json & operator=(const json &other) FL_NOEXCEPT
json(json_array a) FL_NOEXCEPT
json operator[](size_t idx) FL_NOEXCEPT
static json createObject() FL_NOEXCEPT
size_t copy_to(fl::span< T > out) const FL_NOEXCEPT
json_value::iterator end() FL_NOEXCEPT
bool contains(size_t idx) const FL_NOEXCEPT
size_t getSize() const FL_NOEXCEPT
T value() const FL_NOEXCEPT
bool is_floats() const FL_NOEXCEPT
fl::vector< fl::string > get_object_keys() const FL_NOEXCEPT
bool is_double() const FL_NOEXCEPT
static json from_char(char c) FL_NOEXCEPT
void set(const fl::string &key, i64 value) FL_NOEXCEPT
fl::optional< fl::string > as_string() const FL_NOEXCEPT
static fl::string normalizeJsonString(const char *jsonStr) FL_NOEXCEPT
json_value::template array_iterator< T > end_array() FL_NOEXCEPT
void set(const fl::string &key, const json &value) FL_NOEXCEPT
json(double d) FL_NOEXCEPT
static json parse(const fl::string &txt) FL_NOEXCEPT
static json object() FL_NOEXCEPT
json_value::template array_iterator< T > begin_array() FL_NOEXCEPT
static json array() FL_NOEXCEPT
decltype(nullptr) nullptr_t
constexpr remove_reference< T >::type && move(T &&t) FL_NOEXCEPT
volatile size_t g_json_stack_base
constexpr int type_rank< T >::value
volatile size_t g_json_max_stack_depth
back_insert_iterator< Container > back_inserter(Container &c) FL_NOEXCEPT
Helper function to create a back_insert_iterator.
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT
fl::vector< fl::shared_ptr< json_value > > json_array
expected< T, E > result
Alias for expected (Rust-style naming)
constexpr nullopt_t nullopt
fl::flat_map< fl::string, fl::shared_ptr< json_value >, fl::StringFastLess > json_object
Base definition for an LED controller.
json_value::iterator iterator
static fl::shared_ptr< json_value > parse2(const fl::string &txt) FL_NOEXCEPT
json_value::const_iterator const_iterator