From: Arvin Schnell Date: Wed, 2 Sep 2020 11:07:57 +0000 (+0200) Subject: - coding style X-Git-Tag: v0.8.14~27^2 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=ac615277dc488d7ddb548f1c53ad032f8d8eecd7;p=thirdparty%2Fsnapper.git - coding style --- 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) {