mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-18 04:52:22 +02:00
Fixed nested object in arrays bug
This commit is contained in:
@ -20,17 +20,34 @@ namespace ArduinoJson
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(const Printable& nestedObject)
|
void add(const Printable& value)
|
||||||
{
|
{
|
||||||
if (count < capacity)
|
addIfPossible<const Printable&>(value);
|
||||||
items[count++] = nestedObject;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
void add(bool value)
|
||||||
void add(T value)
|
|
||||||
{
|
{
|
||||||
if (count < capacity)
|
addIfPossible<bool>(value);
|
||||||
items[count++] = value;
|
}
|
||||||
|
|
||||||
|
void add(int value)
|
||||||
|
{
|
||||||
|
addIfPossible<long>(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void add(long value)
|
||||||
|
{
|
||||||
|
addIfPossible<long>(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void add(double value)
|
||||||
|
{
|
||||||
|
addIfPossible<double>(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void add(const char* value)
|
||||||
|
{
|
||||||
|
addIfPossible<const char*>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int DIGITS>
|
template<int DIGITS>
|
||||||
@ -49,6 +66,13 @@ namespace ArduinoJson
|
|||||||
private:
|
private:
|
||||||
JsonValue* items;
|
JsonValue* items;
|
||||||
int capacity, count;
|
int capacity, count;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void addIfPossible(T value)
|
||||||
|
{
|
||||||
|
if (count < capacity)
|
||||||
|
items[count++] = value;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user