From faf1d3690f6e23aaac7e1e96d3afc549c39b6c79 Mon Sep 17 00:00:00 2001 From: Dave Goodwin Date: Sun, 3 Oct 2004 08:24:13 +0000 Subject: [PATCH] removed class XML_Writer --- Cantera/src/xml.h | 95 ++--------------------------------------------- 1 file changed, 3 insertions(+), 92 deletions(-) diff --git a/Cantera/src/xml.h b/Cantera/src/xml.h index d9fc544da..2729ad6e4 100755 --- a/Cantera/src/xml.h +++ b/Cantera/src/xml.h @@ -75,6 +75,8 @@ namespace Cantera { void writeHeader(ostream& s); string value() const { return m_value; } string value(string loc) const { return child(loc).value(); } + void setLineNumber(int n) {m_linenum = n;} + int lineNumber() const {return m_linenum;} doublereal fp_value() const { return atof(m_value.c_str()); } @@ -175,98 +177,7 @@ namespace Cantera { int m_nchildren; int m_n; bool m_iscomment; - }; - - - ////////////////////// XML_Writer ////////////////////////// - - class XML_Writer { - public: - XML_Writer(ostream& output) : - m_s(output), _indent(" "), _level(0) {} - virtual ~XML_Writer() {} - ostream& m_s; - - string _indent; - int _level; - - ostream& output() { return m_s; } - - inline string XML_filter(string name) { - int ns = static_cast(name.size()); - string nm(name); - for (int m = 0; m < ns; m++) - if (name[m] == ' ' - || name[m] == '(' - || name[m] == ')') - nm[m] = '_'; - return nm; - } - - /** - * XML_comment() - * - * Add a comment element to the current XML output file - * Comment elements start with - * Comments are indented according to the current lvl, - * _level - * - * input - * --------- - * s : Output stream containing the XML file - * comment : Reference to a string containing the comment - */ - inline void XML_comment(ostream& s, const string& comment) { - for (int n = 0; n < _level; n++) s << _indent; - s << "" << endl; - } - - inline void XML_open(ostream& s, const string& tag, const string p = "") { - for (int n = 0; n < _level; n++) s << _indent; - _level++; - s << "<" << XML_filter(tag) << p << ">" << endl; - } - - inline void XML_close(ostream& s, const string& tag) { - _level--; - for (int n = 0; n < _level; n++) s << _indent; - s << "" << endl; - } - - template - void XML_item(ostream& s, const string& tag, T value) { - for (int n = 0; n < _level; n++) s << _indent; - s << "<" << XML_filter(tag) << ">" - << value << "" << endl; - } - - template - void XML_writeVector(ostream& s, const string& indent, - const string& name, int vsize, iter v) { - int ni; - for (ni = 0; ni < _level; ni++) s << _indent; - s << "<" << XML_filter(name) << "> "; - - int n = vsize; - int n5 = n/5; - int i, j, k = 0; - for (j = 0; j < n5; j++) { - for (i = 0; i < 5; i++) { - s << v[k] << (k < n - 1 ? ", " : ""); - k++; - } - if (j < n5-1) { - s << endl; - for (ni = 0; ni < _level; ni++) s << _indent; - } - } - for (i = k; i < n; i++) { - s << v[k] << (k < n - 1 ? ", " : ""); - k++; - } - - s << "" << endl; - } + int m_linenum; };