28 mValue =
static_cast<T
>(raw);
44 mValue =
static_cast<T
>(raw);
50 if (raw !=
static_cast<float>(
mValue)) {
61 mValue =
static_cast<T
>(parsed);
64 mResult.setError(
"cannot parse string '" + str +
"' as integer");
70 mResult.setError(
"cannot convert null to integer");
75 mResult.setError(
"cannot convert object to integer");
80 mResult.setError(
"cannot convert array to integer");
85 mResult.setError(
"cannot convert array to integer");
89 mResult.setError(
"cannot convert array to integer");
93 mResult.setError(
"cannot convert array to integer");
131 if (str ==
"true" || str ==
"1" || str ==
"yes") {
133 mResult.addWarning(
"string '" + str +
"' parsed as bool true");
134 }
else if (str ==
"false" || str ==
"0" || str ==
"no") {
136 mResult.addWarning(
"string '" + str +
"' parsed as bool false");
138 mResult.setError(
"cannot parse string '" + str +
"' as bool");
144 mResult.setError(
"cannot convert null to bool");
149 mResult.setError(
"cannot convert object to bool");
154 mResult.setError(
"cannot convert array to bool");
159 mResult.setError(
"cannot convert array to bool");
163 mResult.setError(
"cannot convert array to bool");
167 mResult.setError(
"cannot convert array to bool");
188 mValue =
static_cast<T
>(raw);
193 mValue =
static_cast<T
>(raw);
195 if (
sizeof(T) < 8 && (raw > 16777216 || raw < -16777216)) {
214 mValue =
static_cast<T
>(parsed);
218 mResult.setError(
"cannot parse string '" + str +
"' as float");
224 mResult.setError(
"cannot convert null to float");
229 mResult.setError(
"cannot convert object to float");
234 mResult.setError(
"cannot convert array to float");
239 mResult.setError(
"cannot convert array to float");
243 mResult.setError(
"cannot convert array to float");
247 mResult.setError(
"cannot convert array to float");
273 mResult.addWarning(
"int " +
mValue +
" converted to string");
280 mResult.addWarning(
"float " +
mValue +
" converted to string");
285 mValue = b ?
"true" :
"false";
286 mResult.addWarning(
"bool converted to string '" +
mValue +
"'");
292 mResult.addWarning(
"null converted to string 'null'");
297 mResult.setError(
"cannot convert object to string");
302 mResult.setError(
"cannot convert array to string");
307 mResult.setError(
"cannot convert array to string");
311 mResult.setError(
"cannot convert array to string");
315 mResult.setError(
"cannot convert array to string");
const char * c_str() const FL_NOEXCEPT
Compile-time linker keep-alive hook for a single fl::Bus.
decltype(nullptr) nullptr_t
string to_string(T value) FL_NOEXCEPT
constexpr int type_rank< T >::value
constexpr T * end(T(&array)[N]) FL_NOEXCEPT
fl::vector< fl::shared_ptr< json_value > > json_array
fl::flat_map< fl::string, fl::shared_ptr< json_value >, fl::StringFastLess > json_object
double strtod(const char *str, char **endptr)
long strtol(const char *str, char **endptr, int base)
Base definition for an LED controller.
void operator()(const json_array &)
void operator()(const bool &b)
void operator()(const fl::nullptr_t &)
void operator()(const fl::string &str)
void operator()(const json_object &)
void operator()(const fl::vector< float > &)
TypeConversionResult mResult
void operator()(const fl::vector< i16 > &)
void accept(const U &value)
JsonToBoolVisitor() FL_NOEXCEPT
void operator()(const i64 &raw)
void operator()(const float &raw)
void operator()(const fl::vector< u8 > &)
void operator()(const json_array &)
void operator()(const fl::vector< u8 > &)
void operator()(const fl::vector< i16 > &)
void operator()(const fl::string &str)
void operator()(const i64 &raw)
void operator()(const fl::nullptr_t &)
TypeConversionResult mResult
void accept(const U &value)
void operator()(const bool &b)
JsonToFloatVisitor() FL_NOEXCEPT
void operator()(const float &raw)
void operator()(const fl::vector< float > &)
void operator()(const json_object &)
void operator()(const json_object &)
TypeConversionResult mResult
void operator()(const i64 &raw)
void operator()(const bool &b)
JsonToIntegerVisitor() FL_NOEXCEPT
void operator()(const fl::vector< i16 > &)
void operator()(const float &raw)
void operator()(const fl::nullptr_t &)
void operator()(const fl::vector< u8 > &)
void operator()(const fl::vector< float > &)
void accept(const U &value)
void operator()(const json_array &)
void operator()(const fl::string &str)
void operator()(const fl::vector< u8 > &)
void operator()(const fl::vector< float > &)
JsonToStringVisitor() FL_NOEXCEPT
void operator()(const bool &b)
void operator()(const i64 &raw)
void operator()(const fl::vector< i16 > &)
void operator()(const json_array &)
void accept(const U &value)
void operator()(const fl::nullptr_t &)
TypeConversionResult mResult
void operator()(const float &raw)
void operator()(const json_object &)
void operator()(const fl::string &str)