64template <
typename Signature>
67template <
typename R,
typename... Args>
72 static constexpr fl::size argCount() {
return sizeof...(Args); }
82 result.setError(
"arguments must be a JSON array");
86 fl::size count = jsonArgs.
size();
87 if (count !=
sizeof...(Args)) {
88 result.setError(
"argument count mismatch: expected " +
99 template <fl::size... Is>
100 static void convertArgs(
const json& jsonArgs, args_tuple& tuple,
101 TypeConversionResult&
result, index_sequence<Is...>) {
103 int dummy[] = {0, (convertArg<Is>(jsonArgs, tuple,
result), 0)...};
107 template <fl::size I>
108 static void convertArg(
const json& jsonArgs, args_tuple& tuple, TypeConversionResult&
result) {
109 if (
result.hasError())
return;
112 using StorageType =
typename fl::tuple_element<I, args_tuple>::type;
116 TypeConversionResult convResult =
fl::get<1>(convTuple);
121 for (fl::size i = 0; i < convResult.warnings().size(); i++) {
124 if (convResult.hasError()) {
145 result.setError(
"arguments must be a JSON array");
149 if (jsonArgs.
size() != 0) {
150 result.setError(
"argument count mismatch: expected 0, got " +
static constexpr fl::size argCount()
static fl::tuple< args_tuple, TypeConversionResult > convert(const json &jsonArgs)
bool is_array() const FL_NOEXCEPT
size_t size() const FL_NOEXCEPT
FastLED's Elegant JSON Library: fl::json
string to_string(T value) FL_NOEXCEPT
constexpr int type_rank< T >::value
tuple< typename fl::decay< Ts >::type... > make_tuple(Ts &&... args) FL_NOEXCEPT
expected< T, E > result
Alias for expected (Rust-style naming)
typename make_index_sequence_impl< N >::type make_index_sequence
pair_element< I, T1, T2 >::type & get(pair< T1, T2 > &p) FL_NOEXCEPT
Base definition for an LED controller.
fl::ConstSpanWrapper< T > type
fl::ConstSpanWrapper< double > type
typename fl::remove_cv< typename fl::remove_reference< T >::type >::type type
fl::ConstSpanWrapper< float > type
fl::ConstSpanWrapper< int > type
fl::ConstSpanWrapper< fl::string > type
static fl::tuple< T, TypeConversionResult > convert(const json &j)