From ea3bb0af90a78279270fed49d8fe1f0125b7d7c9 Mon Sep 17 00:00:00 2001 From: Thanasis Mattas Date: Fri, 3 May 2019 22:01:54 +0300 Subject: [PATCH] Some documentation corrections at xml.h --- include/cantera/base/xml.h | 33 +++++++++++++-------------------- src/base/xml.cpp | 12 ++++++------ 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/include/cantera/base/xml.h b/include/cantera/base/xml.h index e9811fff0..68123798b 100644 --- a/include/cantera/base/xml.h +++ b/include/cantera/base/xml.h @@ -306,8 +306,7 @@ public: * * @param attr String containing the attribute to be searched for. * @return If a match is found, the attribute value is returned as a - * string. If no match is found, the empty string is - * returned. + * string. If no match is found, the empty string is returned. */ std::string attrib(const std::string& attr) const; @@ -364,9 +363,6 @@ public: bool hasAttrib(const std::string& a) const; //! Returns the name of the XML node - /*! - * The name is the XML node is the XML node name - */ std::string name() const { return m_name; } @@ -393,7 +389,7 @@ public: //! Return an unchangeable reference to the vector of children of the current node /*! - * Each of the individual XML_Node child pointers, however, is to a + * Each of the individual XML_Node child pointers, however, is pointing to a * changeable XML node object. */ const std::vector& children() const; @@ -408,9 +404,9 @@ public: //! Boolean function indicating whether a comment bool isComment() const; - //! Require that the current XML node have an attribute named by the first - //! argument, a, and that this attribute have the the string value listed - //! in the second argument, v. + //! Require that the current XML node has an attribute named by the first + //! argument, a, and that this attribute has the string value listed in + //! the second argument, v. /*! * @param a attribute name * @param v required value of the attribute @@ -440,15 +436,15 @@ public: XML_Node* findNameID(const std::string& nameTarget, const std::string& idTarget) const; - //! This routine carries out a search for an XML node based - //! on both the XML element name and the attribute ID and an integer index. + //! This routine carries out a search for an XML node based on the XML + //! element name, the attribute ID and an integer index. /*! * If exact matches are found for all fields, the pointer * to the matching XML Node is returned. The search is only carried out on * the current element and the child elements of the current element. * * The "id" attribute may be defaulted by setting it to "". In this case the - * pointer to the first XML element matching the name only is returned. + * pointer to the first XML element matching the name and the Index is returned. * * @param nameTarget Name of the XML Node that is being searched for * @param idTarget "id" attribute of the XML Node that the routine @@ -461,14 +457,11 @@ public: const std::string& idTarget, const int index) const; //! This routine carries out a recursive search for an XML node based - //! on the XML element attribute, "id" + //! on the XML element attribute "id" /*! * If exact match is found, the pointer to the matching XML Node is * returned. If not, 0 is returned. * - * The ID attribute may be defaulted by setting it to "". In this case the - * pointer to the first XML element matching the name only is returned. - * * @param id "id" attribute of the XML Node that the routine looks for * @param depth Depth of the search. * @returns the pointer to the XML node that fits the criteria @@ -704,14 +697,14 @@ protected: //! Search an XML_Node tree for a named phase XML_Node /*! - * Search for a phase Node matching a name. + * Search for a phase Node matching an id. * * @param root Starting XML_Node* pointer for the search - * @param phaseName Name of the phase to search for + * @param phaseId id of the phase to search for * @returns the XML_Node pointer if the phase is found. If the phase is not - * found, it returns 0 + * found, it returns 0 */ -XML_Node* findXMLPhase(XML_Node* root, const std::string& phaseName); +XML_Node* findXMLPhase(XML_Node* root, const std::string& phaseId); } diff --git a/src/base/xml.cpp b/src/base/xml.cpp index 140513776..d4d692770 100644 --- a/src/base/xml.cpp +++ b/src/base/xml.cpp @@ -1036,17 +1036,17 @@ void XML_Node::setRoot(const XML_Node& newRoot) } XML_Node* findXMLPhase(XML_Node* root, - const std::string& idtarget) + const std::string& phaseId) { XML_Node* scResult = 0; if (!root) { return 0; } if (root->name() == "phase") { - if (idtarget == "") { + if (phaseId == "") { return root; } - if (idtarget == root->id()) { + if (phaseId == root->id()) { return root; } } @@ -1055,17 +1055,17 @@ XML_Node* findXMLPhase(XML_Node* root, for (size_t n = 0; n < root->nChildren(); n++) { XML_Node* sc = vsc[n]; if (sc->name() == "phase") { - if (idtarget == "") { + if (phaseId == "") { return sc; } - if (idtarget == sc->id()) { + if (phaseId == sc->id()) { return sc; } } } for (size_t n = 0; n < root->nChildren(); n++) { XML_Node* sc = vsc[n]; - scResult = findXMLPhase(sc, idtarget); + scResult = findXMLPhase(sc, phaseId); if (scResult) { return scResult; }