From ac615277dc488d7ddb548f1c53ad032f8d8eecd7 Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Wed, 2 Sep 2020 13:07:57 +0200 Subject: [PATCH] - coding style --- snapper/XmlFile.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/snapper/XmlFile.cc b/snapper/XmlFile.cc index ee5d9b85..09823ae1 100644 --- a/snapper/XmlFile.cc +++ b/snapper/XmlFile.cc @@ -109,6 +109,7 @@ namespace snapper { if (node != NULL) node = node->children; + for (const xmlNode* cur_node = node; cur_node; cur_node = cur_node->next) { if (strcmp(name, (const char*) cur_node->name) == 0) @@ -128,6 +129,7 @@ namespace snapper if (node != NULL) node = node->children; + for (const xmlNode* cur_node = node; cur_node; cur_node = cur_node->next) { if (cur_node->type == XML_ELEMENT_NODE && @@ -140,6 +142,7 @@ namespace snapper return ret; } + bool getValue(const xmlNode* node, string& value) { @@ -147,16 +150,18 @@ namespace snapper if (tmp == nullptr) return false; - value = (const char *) tmp; + value = (const char*) tmp; xmlFree(tmp); return true; } + bool getChildValue(const xmlNode* node, const char* name, string& value) { if (node != NULL) node = node->children; + for (const xmlNode* cur_node = node; cur_node; cur_node = cur_node->next) { if (cur_node->type == XML_ELEMENT_NODE && @@ -186,18 +191,20 @@ namespace snapper return true; } + bool getAttributeValue(const xmlNode* node, const char* name, string& value) { - xmlChar* tmp = xmlGetNoNsProp(node, (const xmlChar *) name); + xmlChar* tmp = xmlGetNoNsProp(node, (const xmlChar*) name); if (tmp == nullptr) return false; - value = (const char *) tmp; + value = (const char*) tmp; xmlFree(tmp); return true; } + bool getAttributeValue(const xmlNode* node, const char* name, bool& value) { @@ -209,6 +216,7 @@ namespace snapper return true; } + void setChildValue(xmlNode* node, const char* name, const char* value) { -- 2.47.3