Formated code with clang-format

This commit is contained in:
Benoit Blanchon
2014-10-23 19:54:00 +02:00
parent 888fdc1d54
commit 9175046f35
52 changed files with 2002 additions and 2638 deletions

View File

@ -10,69 +10,62 @@
using namespace ArduinoJson;
using namespace ArduinoJson::Internals;
JsonValue JsonObject::operator[](char const* key)
{
JsonNode* node = getOrCreateNodeAt(key);
return JsonValue(node);
JsonValue JsonObject::operator[](char const *key) {
JsonNode *node = getOrCreateNodeAt(key);
return JsonValue(node);
}
void JsonObject::remove(char const* key)
{
for (JsonNodeIterator it = beginChildren(); it != endChildren(); ++it)
{
const char* childKey = it->getAsObjectKey();
void JsonObject::remove(char const *key) {
for (JsonNodeIterator it = beginChildren(); it != endChildren(); ++it) {
const char *childKey = it->getAsObjectKey();
if (!strcmp(childKey, key))
{
removeChild(*it);
}
if (!strcmp(childKey, key)) {
removeChild(*it);
}
}
}
JsonArray JsonObject::createNestedArray(char const* key)
{
JsonNode* node = getOrCreateNodeAt(key);
JsonArray JsonObject::createNestedArray(char const *key) {
JsonNode *node = getOrCreateNodeAt(key);
if (node)
node->setAsArray(_node->getContainerBuffer());
if (node)
node->setAsArray(_node->getContainerBuffer());
return JsonArray(node);
return JsonArray(node);
}
JsonObject JsonObject::createNestedObject(char const* key)
{
JsonNode* node = getOrCreateNodeAt(key);
if (node)
node->setAsObject(_node->getContainerBuffer());
JsonObject JsonObject::createNestedObject(char const *key) {
JsonNode *node = getOrCreateNodeAt(key);
return JsonObject(node);
if (node)
node->setAsObject(_node->getContainerBuffer());
return JsonObject(node);
}
JsonNode* JsonObject::getOrCreateNodeAt(const char* key)
{
for (JsonNodeIterator it = beginChildren(); it != endChildren(); ++it)
{
const char* childKey = it->getAsObjectKey();
JsonNode *JsonObject::getOrCreateNodeAt(const char *key) {
for (JsonNodeIterator it = beginChildren(); it != endChildren(); ++it) {
const char *childKey = it->getAsObjectKey();
if (!strcmp(childKey, key))
return it->getAsObjectValue();
}
JsonNode* newValueNode = createNode();
if (!newValueNode) return 0;
JsonNode* newKeyNode = createNode();
if (!newKeyNode) return 0;
if (!strcmp(childKey, key))
return it->getAsObjectValue();
}
newKeyNode->setAsObjectKeyValue(key, newValueNode);
JsonNode *newValueNode = createNode();
if (!newValueNode)
return 0;
addChild(newKeyNode);
JsonNode *newKeyNode = createNode();
if (!newKeyNode)
return 0;
return newValueNode;
newKeyNode->setAsObjectKeyValue(key, newValueNode);
addChild(newKeyNode);
return newValueNode;
}
JsonObjectIterator JsonObject::begin()
{
return JsonObjectIterator(_node->getContainerChild());
JsonObjectIterator JsonObject::begin() {
return JsonObjectIterator(_node->getContainerChild());
}