mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-17 12:32:17 +02:00
Test that JsonArray can contain doubles
This commit is contained in:
@ -11,4 +11,31 @@ JsonValue JsonArray::operator[](int index) const
|
||||
}
|
||||
|
||||
return JsonValue();
|
||||
}
|
||||
|
||||
void JsonArray::add(char const* value)
|
||||
{
|
||||
JsonNode* node = createNode(JSON_STRING);
|
||||
if (!node) return;
|
||||
|
||||
node->content.asString = value;
|
||||
addChild(node);
|
||||
}
|
||||
|
||||
void JsonArray::add(double value, int decimals)
|
||||
{
|
||||
JsonNode* node = createNode((JsonNodeType)(JSON_DOUBLE_0_DECIMALS + decimals));
|
||||
if (!node) return;
|
||||
|
||||
node->content.asDouble = value;
|
||||
addChild(node);
|
||||
}
|
||||
|
||||
void JsonArray::add(long value)
|
||||
{
|
||||
JsonNode* node = createNode(JSON_INTEGER);
|
||||
if (!node) return;
|
||||
|
||||
node->content.asInteger = value;
|
||||
addChild(node);
|
||||
}
|
Reference in New Issue
Block a user