diff --git a/srcs/Internals/JsonNode.cpp b/srcs/Internals/JsonNode.cpp index a15ec897..95dbfa91 100644 --- a/srcs/Internals/JsonNode.cpp +++ b/srcs/Internals/JsonNode.cpp @@ -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; @@ -52,7 +52,7 @@ void JsonNode::addChildToContainer(JsonNode* childToAdd) lastChild->next = childToAdd; } -void JsonNode::removeChildFromContainer(JsonNode* childToRemove) +void JsonNode::removeChild(JsonNode* childToRemove) { if (type != JSON_ARRAY && type != JSON_OBJECT) return; diff --git a/srcs/Internals/JsonNode.h b/srcs/Internals/JsonNode.h index d680653e..bccfad63 100644 --- a/srcs/Internals/JsonNode.h +++ b/srcs/Internals/JsonNode.h @@ -86,7 +86,7 @@ public: void setAsDouble(double value, int decimals) { - type = (JsonNodeType) (JSON_DOUBLE_0_DECIMALS + decimals); + type = static_cast(JSON_DOUBLE_0_DECIMALS + decimals); content.asDouble = value; } @@ -111,7 +111,7 @@ public: double getAsDouble() { - return type > JSON_DOUBLE_0_DECIMALS ? content.asDouble : 0; + return type >= JSON_DOUBLE_0_DECIMALS ? content.asDouble : 0; } long getAsInteger() @@ -144,9 +144,9 @@ public: 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: JsonNode* next; diff --git a/srcs/JsonContainer.cpp b/srcs/JsonContainer.cpp index b66f9ad4..3157437d 100644 --- a/srcs/JsonContainer.cpp +++ b/srcs/JsonContainer.cpp @@ -51,13 +51,13 @@ bool JsonContainer::operator==(const JsonContainer & other) const void JsonContainer::addChild(JsonNode* childToAdd) { if (_node) - _node->addChildToContainer(childToAdd); + _node->addChild(childToAdd); } void JsonContainer::removeChild(JsonNode* childToRemove) { if (_node) - _node->removeChildFromContainer(childToRemove); + _node->removeChild(childToRemove); } size_t JsonContainer::size() const