forked from bblanchon/ArduinoJson
Minor changes
This commit is contained in:
@ -34,7 +34,7 @@ void JsonNode::writeTo(JsonWriter& writer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonNode::addChildToContainer(JsonNode* childToAdd)
|
void JsonNode::addChild(JsonNode* childToAdd)
|
||||||
{
|
{
|
||||||
if (type != JSON_ARRAY && type != JSON_OBJECT) return;
|
if (type != JSON_ARRAY && type != JSON_OBJECT) return;
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ void JsonNode::addChildToContainer(JsonNode* childToAdd)
|
|||||||
lastChild->next = childToAdd;
|
lastChild->next = childToAdd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonNode::removeChildFromContainer(JsonNode* childToRemove)
|
void JsonNode::removeChild(JsonNode* childToRemove)
|
||||||
{
|
{
|
||||||
if (type != JSON_ARRAY && type != JSON_OBJECT) return;
|
if (type != JSON_ARRAY && type != JSON_OBJECT) return;
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public:
|
|||||||
|
|
||||||
void setAsDouble(double value, int decimals)
|
void setAsDouble(double value, int decimals)
|
||||||
{
|
{
|
||||||
type = (JsonNodeType) (JSON_DOUBLE_0_DECIMALS + decimals);
|
type = static_cast<JsonNodeType>(JSON_DOUBLE_0_DECIMALS + decimals);
|
||||||
content.asDouble = value;
|
content.asDouble = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ public:
|
|||||||
|
|
||||||
double getAsDouble()
|
double getAsDouble()
|
||||||
{
|
{
|
||||||
return type > JSON_DOUBLE_0_DECIMALS ? content.asDouble : 0;
|
return type >= JSON_DOUBLE_0_DECIMALS ? content.asDouble : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long getAsInteger()
|
long getAsInteger()
|
||||||
@ -144,9 +144,9 @@ public:
|
|||||||
return type == JSON_KEY_VALUE ? content.asKey.value : 0;
|
return type == JSON_KEY_VALUE ? content.asKey.value : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addChildToContainer(JsonNode* childToAdd);
|
void addChild(JsonNode* childToAdd);
|
||||||
|
|
||||||
void removeChildFromContainer(JsonNode* childToRemove);
|
void removeChild(JsonNode* childToRemove);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JsonNode* next;
|
JsonNode* next;
|
||||||
|
@ -51,13 +51,13 @@ bool JsonContainer::operator==(const JsonContainer & other) const
|
|||||||
void JsonContainer::addChild(JsonNode* childToAdd)
|
void JsonContainer::addChild(JsonNode* childToAdd)
|
||||||
{
|
{
|
||||||
if (_node)
|
if (_node)
|
||||||
_node->addChildToContainer(childToAdd);
|
_node->addChild(childToAdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonContainer::removeChild(JsonNode* childToRemove)
|
void JsonContainer::removeChild(JsonNode* childToRemove)
|
||||||
{
|
{
|
||||||
if (_node)
|
if (_node)
|
||||||
_node->removeChildFromContainer(childToRemove);
|
_node->removeChild(childToRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t JsonContainer::size() const
|
size_t JsonContainer::size() const
|
||||||
|
Reference in New Issue
Block a user