diff --git a/Cantera/src/base/stringUtils.h b/Cantera/src/base/stringUtils.h index 5abfdcac7..dec5455e4 100755 --- a/Cantera/src/base/stringUtils.h +++ b/Cantera/src/base/stringUtils.h @@ -18,6 +18,14 @@ namespace Cantera { class ThermoPhase; std::string fp2str(double x, std::string fmt); + + //! Convert a double into a c++ string + /*! + * The default format to use is equivalent to the default + * format used by printf's %g formatting. + * + * @param x double to be converted + */ std::string fp2str(double x); std::string int2str(int n, std::string fmt); std::string int2str(int n); diff --git a/Cantera/src/base/xml.cpp b/Cantera/src/base/xml.cpp index b0d91048b..0bb3f9c69 100755 --- a/Cantera/src/base/xml.cpp +++ b/Cantera/src/base/xml.cpp @@ -300,7 +300,9 @@ namespace Cantera { if (!p) m_root = this; else m_root = &p->root(); } - + + + XML_Node::~XML_Node() { if (m_locked) @@ -525,7 +527,7 @@ namespace Cantera { } } - void XML_Node::copyUnion(XML_Node *node_dest) { + void XML_Node::copyUnion(XML_Node *node_dest) const { XML_Node *sc, *dc; int ndc, idc; node_dest->addValue(m_value); @@ -569,7 +571,7 @@ namespace Cantera { } } - void XML_Node::copy(XML_Node *node_dest) { + void XML_Node::copy(XML_Node *node_dest) const { XML_Node *sc, *dc; int ndc; node_dest->addValue(m_value); diff --git a/Cantera/src/base/xml.h b/Cantera/src/base/xml.h index 1247124c1..c77f78898 100755 --- a/Cantera/src/base/xml.h +++ b/Cantera/src/base/xml.h @@ -19,7 +19,7 @@ #include #include #include -//using namespace std; + #include "ctexceptions.h" #include "ct_defs.h" @@ -62,6 +62,11 @@ namespace Cantera { public: XML_Node(std::string nm = "--", XML_Node* p = 0, int n = 0); + private: + XML_Node(const XML_Node &right); + XML_Node& operator=(const XML_Node &right); + + public: virtual ~XML_Node(); void addComment(std::string comment); XML_Node& addChild(XML_Node& node); @@ -126,8 +131,11 @@ namespace Cantera { return (m_attribs.find(a) != m_attribs.end()); } - - std::string name() const { return m_name; } + //! 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; } std::string id() const { if (hasAttrib("id")) return attrib("id"); else return ""; @@ -167,8 +175,8 @@ namespace Cantera { void write(std::ostream& s, int level = 0) const; XML_Node& root() const { return *m_root; } void setRoot(XML_Node& root) { m_root = &root; } - void copyUnion(XML_Node *node_dest); - void copy(XML_Node *node_dest); + void copyUnion(XML_Node *node_dest) const; + void copy(XML_Node *node_dest) const; void lock() {m_locked = true;} void unlock() {m_locked = false; } @@ -177,7 +185,14 @@ namespace Cantera { protected: - std::string m_name; + //! XML node name of the node. + /*! + * For example, if we were in the XML_Node where + * + * + * Then, this string would be equal to "phase" + */ + std::string m_name; std::string m_value; std::map m_childindex; std::map m_attribs;