From e8c33462c6da366878be2f1bd7c05f8fe7f5ae5a Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Mon, 29 Dec 2008 21:19:28 +0000 Subject: [PATCH] doxygen update --- Cantera/src/base/xml.cpp | 18 ++++++------ Cantera/src/base/xml.h | 62 +++++++++++++++++++++++++++++----------- 2 files changed, 55 insertions(+), 25 deletions(-) diff --git a/Cantera/src/base/xml.cpp b/Cantera/src/base/xml.cpp index 93969e668..ce131471c 100755 --- a/Cantera/src/base/xml.cpp +++ b/Cantera/src/base/xml.cpp @@ -122,7 +122,7 @@ namespace Cantera { // Returns string 'aline' stripped of leading and trailing white // space. // @todo why is this a class method? - string XML_Reader::strip(const string& aline) { + std::string XML_Reader::strip(const std::string& aline) const { int len = static_cast(aline.size()); int i, j, ll; for (i = len-1; i >= 0; i--) { @@ -142,7 +142,7 @@ namespace Cantera { /// quotes, and returns this substring (without the quotes) if /// found. If not, an empty string is returned. /// @todo why is this a class method? - string XML_Reader::inquotes(const string& aline) { + std::string XML_Reader::inquotes(const std::string& aline) const { int len = static_cast(aline.size()); int i, j; for (i = len-1; i >= 0; i--) @@ -158,8 +158,8 @@ namespace Cantera { * which is not immediately preceded by the backslash character * '\' */ - static string::size_type findUnbackslashed(string s, const char q, - string::size_type istart = 0) { + static string::size_type findUnbackslashed(std::string s, const char q, + std::string::size_type istart = 0) { string::size_type iloc, icurrent, len; icurrent = istart; len = s.size(); @@ -185,7 +185,7 @@ namespace Cantera { * type. Quotes may be commented out by preceding with a * backslash character, '\\'. */ - int XML_Reader::findQuotedString(const string& s, string &rstring) { + int XML_Reader::findQuotedString(const string& s, std::string &rstring) const { const char q1 = '\''; const char q2 = '"'; rstring = ""; @@ -225,8 +225,8 @@ namespace Cantera { * parseTag parses XML tags, i.e., the XML elements that are * inbetween angle brackets. */ - void XML_Reader::parseTag(string tag, string& name, - map& attribs) { + void XML_Reader::parseTag(std::string tag, std::string& name, + std::map& attribs) const { string::size_type iloc; string attr, val; string s = strip(tag); @@ -260,7 +260,7 @@ namespace Cantera { } } - string XML_Reader::readTag(map& attribs) { + std::string XML_Reader::readTag(std::map& attribs) { string name, tag = ""; bool incomment = false; char ch = '-'; @@ -298,7 +298,7 @@ namespace Cantera { } } - string XML_Reader::readValue() { + std::string XML_Reader::readValue() { string tag = ""; char ch, lastch; ch = '\n'; diff --git a/Cantera/src/base/xml.h b/Cantera/src/base/xml.h index a1538dcaa..61f3b40f2 100755 --- a/Cantera/src/base/xml.h +++ b/Cantera/src/base/xml.h @@ -5,7 +5,7 @@ * manipulate CTML data files. */ -/* $Author$ +/* * $Revision$ * $Date$ */ @@ -30,9 +30,10 @@ namespace Cantera { - /** - * Class XML_Reader is designed for internal use. - * This function reads an XML file into an XML_Node object. + //! Class XML_Reader reads an XML file into an XML_Node object. + /*! + * + * Class XML_Reader is designed for internal use. */ class XML_Reader { public: @@ -44,12 +45,6 @@ namespace Cantera { */ XML_Reader(std::istream& input); - //! Input Stream containing the XML file - std::istream& m_s; - - //! Line count - int m_line; - //! Read a single character from the input stream //! and return it /*! @@ -73,13 +68,13 @@ namespace Cantera { * * @todo why is this a class method? */ - std::string strip(const std::string& aline); + std::string strip(const std::string& aline) const; /// Looks for a substring within 'aline' enclosed in double /// quotes, and returns this substring (without the quotes) if /// found. If not, an empty string is returned. /// @todo why is this a class method? - std::string inquotes(const std::string& aline); + std::string inquotes(const std::string& aline) const; /** * Searches a string for the first occurrence of a valid @@ -88,12 +83,47 @@ namespace Cantera { * type. Quotes may be commented out by preceding with a * backslash character, '\\'. */ - int findQuotedString(const std::string& aline, std::string &rstring); - - void parseTag(std::string line, std::string& name, - std::map& attribs); + int findQuotedString(const std::string& aline, std::string &rstring) const; + + //! parseTag parses XML tags, i.e., the XML elements that are + //! inbetween angle brackets. + /*! + * @param tag Tag to be parsed - input + * + * @param name Output string containing name + * of the XML + * @param attribs map of attribute name and + * attribute value - output + */ + void parseTag(std::string tag, std::string& name, + std::map& attribs) const; + + //! Reads an XML tag into a string + /*! + * This function advances the input streams pointer + * + * @param attribs map of attribute name and + * attribute value - output + * + * @return Output string containing name + * of the XML + */ std::string readTag(std::map& attribs); + + //! Return the value portion of an XML element + /*! + * This function advances the input streams pointer + */ std::string readValue(); + + protected: + //! Input Stream containing the XML file + std::istream& m_s; + + public: + //! Line count + int m_line; + };