From e48f46cd1a5ac54f2d26e2c4eb7dc625321e0652 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Sat, 1 Nov 2008 00:55:22 +0000 Subject: [PATCH] Doxygen update. moved attribs() to be a private function. --- Cantera/src/base/xml.cpp | 64 +++++++++++++++++++++++++++++++++- Cantera/src/base/xml.h | 75 ++++++++++++++++++++++++++++++---------- 2 files changed, 119 insertions(+), 20 deletions(-) diff --git a/Cantera/src/base/xml.cpp b/Cantera/src/base/xml.cpp index e6d53d5ec..9dc0cbaa0 100755 --- a/Cantera/src/base/xml.cpp +++ b/Cantera/src/base/xml.cpp @@ -536,6 +536,14 @@ namespace Cantera { return m_value; } + // Overloaded parenthesis operator returns the value of the Node + /* + * @return Returns the value of the node as a string. + */ + std::string XML_Node::operator()() const { + return m_value; + } + // Return the value of an XML node as a double /* * This accesses the value string, and then tries to @@ -563,6 +571,16 @@ namespace Cantera { return child(cname).value(); } + //! Overloaded parenthesis operator with one augment + //! returns the value of an XML child node as a string + /*! + * @param cname Name of the child node to the current + * node, for which you want the value + */ + std::string XML_Node::operator()(std::string loc) const { + return value(loc); + } + // Add or modify an attribute of the current node /* * This functions fills in the m_value field of the current node @@ -628,6 +646,15 @@ namespace Cantera { return ""; } + // Returns a changeable value of the attributes map for the current node + /* + * Note this is a simple accessor routine. And, it is a private function. + * It's used in some internal copy and assignment routines + */ + std::map& XML_Node::attribs() { + return m_attribs; + } + // Set the line number /* * @param n the member data m_linenum is set to n @@ -644,6 +671,41 @@ namespace Cantera { return m_linenum; } + // Returns a pointer to the parent node of the current node + XML_Node* XML_Node::parent() const { + return m_parent; + } + + // Sets the pointer for the parent node of the current node + /* + * @param p Pointer to the parent node + * + * @return Returns the pointer p + */ + XML_Node* XML_Node::setParent(XML_Node * const p) { + m_parent = p; + return p; + } + + //! return a reference to the n'th child of the current node + /*! + * @param n Number of the child to return + */ + XML_Node& XML_Node::child(const int n) const { + return *m_children[n]; + } + + //! 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 changeable xml node object. + * + * @param n Number of the child to return + */ + const std::vector& XML_Node::children() const { + return m_children; + } + /* * This routine carries out a search for an XML node based * on both the xml element name and the attribute ID. @@ -1060,7 +1122,7 @@ namespace Cantera { XML_Node * findXMLPhase(XML_Node *root, - const string &idtarget) { + const std::string &idtarget) { XML_Node *scResult = 0; XML_Node *sc; if (!root) return 0; diff --git a/Cantera/src/base/xml.h b/Cantera/src/base/xml.h index 1ab785678..fa131d42d 100755 --- a/Cantera/src/base/xml.h +++ b/Cantera/src/base/xml.h @@ -15,20 +15,18 @@ #ifndef CT_XML_H #define CT_XML_H +#include "ctexceptions.h" +#include "ct_defs.h" +#include "stringUtils.h" +#include "global.h" + +#include #include #include #include - -#include "ctexceptions.h" -#include "ct_defs.h" -#include "stringUtils.h" -#include -#include "global.h" - #define XML_INDENT 4 - namespace Cantera { @@ -235,6 +233,13 @@ namespace Cantera { */ std::string value() const; + + //! Overloaded parenthesis operator returns the value of the Node + /*! + * @return Returns the value of the node as a string. + */ + std::string operator()() const; + //! Return the value of an XML child node as a string /*! * @param cname Name of the child node to the current @@ -242,6 +247,14 @@ namespace Cantera { */ std::string value(const std::string cname) const; + //! Overloaded parenthesis operator with one augment + //! returns the value of an XML child node as a string + /*! + * @param cname Name of the child node to the current + * node, for which you want the value + */ + std::string operator()(std::string loc) const; + //! Return the value of an XML node as a single double /*! * This accesses the value string, and then tries to @@ -311,6 +324,15 @@ namespace Cantera { */ std::string attrib(const std::string attr) const; + private: + //! Returns a changeable value of the attributes map for the current node + /*! + * Note this is a simple accessor routine. And, it is a private function. + * It's used in some internal copy and assignment routines + */ + std::map& attribs(); + + public: //! Set the line number /*! * @param n the member data m_linenum is set to n @@ -323,15 +345,17 @@ namespace Cantera { */ int lineNumber() const; - std::string operator()() const { return m_value; } - std::string operator()(std::string loc) const { return value(loc); } + + //! Returns a pointer to the parent node of the current node + XML_Node* parent() const; - - std::map& attribs() { return m_attribs; } - - XML_Node* parent() const { return m_parent; } - - XML_Node* setParent(XML_Node* p) { m_parent = p; return p; } + //! Sets the pointer for the parent node of the current node + /*! + * @param p Pointer to the parent node + * + * @return Returns the pointer p + */ + XML_Node* setParent(XML_Node * const p); //! Tests whether the current node has a child node with a particular name /*! @@ -366,10 +390,21 @@ namespace Cantera { */ std::string id() const; + //! Return a changeable reference to the n'th child of the current node + /*! + * @param n Number of the child to return + */ + XML_Node& child(const int n) const; + + //! 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 changeable xml node object. + * + * @param n Number of the child to return + */ + const std::vector& children() const; - XML_Node& child(int n) const { return *m_children[n]; } - std::vector& children() { return m_children; } - const std::vector& children() const { return m_children; } int nChildren() const { return m_nchildren; } void build(std::istream& f); @@ -446,6 +481,8 @@ namespace Cantera { int m_nchildren; bool m_iscomment; int m_linenum; + + };