17 XML_Writer(std::ostream& output_) :
18 m_s(output_), _indent(
" "), _level(0) {}
19 virtual ~XML_Writer() {}
25 std::ostream& output() {
29 inline std::string XML_filter(
const std::string& name) {
30 int ns =
static_cast<int>(name.size());
32 for (
int m = 0; m < ns; m++)
54 inline void XML_comment(std::ostream& s,
const std::string& comment) {
55 for (
int n = 0; n < _level; n++) {
58 s <<
"<!--" << comment <<
"-->" << std::endl;
61 inline void XML_open(std::ostream& s,
const std::string& tag,
const std::string& p =
"") {
62 for (
int n = 0; n < _level; n++) {
66 s <<
"<" << XML_filter(tag) << p <<
">" << std::endl;
69 inline void XML_close(std::ostream& s,
const std::string& tag) {
71 for (
int n = 0; n < _level; n++) {
74 s <<
"</" << XML_filter(tag) <<
">" << std::endl;
78 void XML_item(std::ostream& s,
const std::string& tag, T value) {
79 for (
int n = 0; n < _level; n++) {
82 s <<
"<" << XML_filter(tag) <<
">"
83 << value <<
"</" << tag <<
">" << std::endl;
87 void XML_writeVector(std::ostream& s,
const std::string& indent,
88 const std::string& name,
int vsize, iter v) {
90 for (ni = 0; ni < _level; ni++) {
93 s <<
"<" << XML_filter(name) <<
"> ";
98 for (j = 0; j < n5; j++) {
99 for (i = 0; i < 5; i++) {
100 s << v[k] << (k < n - 1 ?
", " :
"");
105 for (ni = 0; ni < _level; ni++) {
110 for (i = k; i < n; i++) {
111 s << v[k] << (k < n - 1 ?
", " :
"");
115 s <<
"</" << XML_filter(name) <<
">" << std::endl;