From 09236f42f80fd92ff717496771e616ef57203260 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Fri, 2 Jan 2009 21:46:31 +0000 Subject: [PATCH] Doxygen updates --- Cantera/src/base/ctml.cpp | 38 +++++++++++++++++++++++++++++++++----- Cantera/src/base/ctml.h | 34 ++++++++++++++++++++++++++++++---- Cantera/src/base/xml.cpp | 32 ++++++++++++++++++++++++++------ Cantera/src/base/xml.h | 9 +++------ 4 files changed, 92 insertions(+), 21 deletions(-) diff --git a/Cantera/src/base/ctml.cpp b/Cantera/src/base/ctml.cpp index 83629c6ba..015d3d38b 100755 --- a/Cantera/src/base/ctml.cpp +++ b/Cantera/src/base/ctml.cpp @@ -120,11 +120,39 @@ namespace ctml { if (maxval != Undef) f.addAttribute("max",maxval); } - void addString(XML_Node& node, string title, string val, - string type) { - XML_Node& f = node.addChild("string",val); - f.addAttribute("title",title); - if (type != "") f.addAttribute("type",type); + // This function adds a child node with the name string with a string value + // to the current node + /* + * This function will add a child node to the current XML node, with the + * name "string". It will have a title attribute, and the body + * of the XML node will be filled out with the valueString argument verbatim. + * + * Example: + * + * Code snipet: + * @verbatum + const XML_Node &node; + addString(XML_Node& node, std::string titleString, std::string valueString, + std::string typeString); + @endverbatum + * + * Creates the following the snippet in the XML file: + * @verbatum + + valueString + <\string> + @endverbatum + * + * @param node reference to the XML_Node object of the parent XML element + * @param valueString Value string to be used in the new XML node. + * @param titleString String name of the title attribute + * @param typeString String type. This is an optional parameter. + */ + void addString(XML_Node& node, std::string titleString, std::string valueString, + std::string typeString) { + XML_Node& f = node.addChild("string", valueString); + f.addAttribute("title", titleString); + if (typeString != "") f.addAttribute("type", typeString); } XML_Node* getByTitle(XML_Node& node, string title) { diff --git a/Cantera/src/base/ctml.h b/Cantera/src/base/ctml.h index 1bd5d5c6a..8aa6c2a76 100755 --- a/Cantera/src/base/ctml.h +++ b/Cantera/src/base/ctml.h @@ -64,10 +64,36 @@ namespace ctml { doublereal minval = Cantera::Undef, doublereal maxval = Cantera::Undef); - void addString(Cantera::XML_Node& node, - std::string title, - std::string val, - std::string type=""); + //! This function adds a child node with the name string with a string value + //! to the current node + /*! + * This function will add a child node to the current XML node, with the + * name "string". It will have a title attribute, and the body + * of the XML node will be filled out with the valueString argument verbatim. + * + * Example: + * + * Code snipet: + * @verbatum + const XML_Node &node; + addString(XML_Node& node, std::string titleString, std::string valueString, + std::string typeString); + @endverbatum + * + * Creates the following the snippet in the XML file: + * @verbatum + + valueString + <\string> + @endverbatum + * + * @param node reference to the XML_Node object of the parent XML element + * @param valueString Value string to be used in the new XML node. + * @param titleString String name of the title attribute + * @param typeString String type. This is an optional parameter. + */ + void addString(Cantera::XML_Node& node, std::string titleString, + std::string valueString, std::string typeString=""); void getFloatArray(const Cantera::XML_Node& node, Cantera::vector_fp& v, bool convert=true, std::string type="", diff --git a/Cantera/src/base/xml.cpp b/Cantera/src/base/xml.cpp index ce131471c..697d910c7 100755 --- a/Cantera/src/base/xml.cpp +++ b/Cantera/src/base/xml.cpp @@ -686,17 +686,37 @@ namespace Cantera { m_parent = p; return p; } + + // Tests whether the current node has a child node with a particular name + /* + * @param ch Name of the child node to test + * + * @return Returns true if the child node exists, false otherwise. + */ + bool XML_Node::hasChild(const std::string ch) const { + return (m_childindex.find(ch) != m_childindex.end()); + } + + // Tests whether the current node has an attribute with a particular name + /* + * @param a Name of the attribute to test + * + * @return Returns true if the attribute exists, false otherwise. + */ + bool XML_Node::hasAttrib(std::string a) const { + return (m_attribs.find(a) != m_attribs.end()); + } - //! return a reference to the n'th child of the current node - /*! + // 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 - /*! + // 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. * @@ -706,8 +726,8 @@ namespace Cantera { return m_children; } - //! return the number of children - /*! + // return the number of children + /* * */ int XML_Node::nChildren() const { diff --git a/Cantera/src/base/xml.h b/Cantera/src/base/xml.h index 61f3b40f2..2c145cbf5 100755 --- a/Cantera/src/base/xml.h +++ b/Cantera/src/base/xml.h @@ -363,6 +363,7 @@ namespace Cantera { std::map& attribs(); public: + //! Set the line number /*! * @param n the member data m_linenum is set to n @@ -393,9 +394,7 @@ namespace Cantera { * * @return Returns true if the child node exists, false otherwise. */ - bool hasChild(const std::string ch) const { - return (m_childindex.find(ch) != m_childindex.end()); - } + bool hasChild(const std::string ch) const; //! Tests whether the current node has an attribute with a particular name /*! @@ -403,9 +402,7 @@ namespace Cantera { * * @return Returns true if the attribute exists, false otherwise. */ - bool hasAttrib(std::string a) const { - return (m_attribs.find(a) != m_attribs.end()); - } + bool hasAttrib(std::string a) const; //! Returns the name of the XML node /*!