diff --git a/include/cantera/base/ctml.h b/include/cantera/base/ctml.h index 50b245a88..cac708661 100644 --- a/include/cantera/base/ctml.h +++ b/include/cantera/base/ctml.h @@ -212,7 +212,7 @@ void addFloatArray(Cantera::XML_Node& node, const std::string& titleString, * parameter. The default is the special double, * Cantera::Undef, which means to ignore the entry. */ -void addNamedFloatArray(Cantera::XML_Node& parentNode, const std::string& name, const int n, +void addNamedFloatArray(Cantera::XML_Node& parentNode, const std::string& name, const size_t n, const doublereal* const vals, const std::string units = "", const std::string type = "", const doublereal minval = Cantera::Undef, diff --git a/include/cantera/base/xml.h b/include/cantera/base/xml.h index fff9e3732..22406c8ca 100644 --- a/include/cantera/base/xml.h +++ b/include/cantera/base/xml.h @@ -280,6 +280,9 @@ public: void addAttribute(const std::string& attrib, const doublereal value, const std::string& fmt="%g"); + //! Add an unsigned integer attribute + void addAttribute(const std::string& attrib, size_t value); + //! The operator[] is overloaded to provide a lookup capability //! on attributes for the current XML element. /*! diff --git a/src/base/ctml.cpp b/src/base/ctml.cpp index 06c70a156..e6d04e16d 100644 --- a/src/base/ctml.cpp +++ b/src/base/ctml.cpp @@ -95,13 +95,13 @@ void addFloatArray(Cantera::XML_Node& node, const std::string& title, const size } } -void addNamedFloatArray(Cantera::XML_Node& node, const std::string& name, const int n, +void addNamedFloatArray(Cantera::XML_Node& node, const std::string& name, const size_t n, const doublereal* const vals, const std::string units, const std::string type, const doublereal minval, const doublereal maxval) { std::string v = ""; - for (int i = 0; i < n; i++) { + for (size_t i = 0; i < n; i++) { v += fp2str(vals[i],FP_Format); if (i == n-1) { v += "\n"; diff --git a/src/base/xml.cpp b/src/base/xml.cpp index b6839f039..7487c61d5 100644 --- a/src/base/xml.cpp +++ b/src/base/xml.cpp @@ -501,6 +501,11 @@ void XML_Node::addAttribute(const std::string& attrib_, m_attribs[attrib_] = fp2str(value_, fmt); } +void XML_Node::addAttribute(const std::string& attrib_, const size_t value_) +{ + m_attribs[attrib_] = int2str(value_); +} + std::string XML_Node::operator[](const std::string& attr) const { return attrib(attr);