fix8  version 1.4.0
Open Source C++ FIX Framework
xml.cpp File Reference
#include "precomp.hpp"
#include <fix8/f8includes.hpp>

Go to the source code of this file.

Functions

ostream & operator<< (ostream &os, const XmlElement &en)
 

Function Documentation

ostream& operator<< ( std::ostream &  os,
const XmlElement en 
)

Inserter friend.

Parameters
osstream to send to
enXmlElement REFErence
Returns
stream

Definition at line 71 of file xml.cpp.

References XmlElement::attrs_, XmlElement::children_, XmlElement::decl_, XmlElement::depth_, XmlElement::ordchildren_, spacer, XmlElement::tag_, XmlElement::txtline_, and XmlElement::value_.

72 {
73  const string spacer(en.depth_ * 3, ' ');
74  if (en.decl_)
75  os << *en.decl_ << endl;
76  os << spacer << en.tag_;
77 
78  if (en.value_)
79  os << "=\"" << *en.value_ << '\"';
80 
81  if (en.attrs_)
82  {
83  os << " [";
84  bool first(true);
85  for (XmlElement::XmlAttrs::iterator itr(en.attrs_->begin()); itr != en.attrs_->end(); ++itr)
86  {
87  if (first)
88  first = false;
89  else
90  os << ' ';
91  os << itr->first << "=\"" << itr->second << '"';
92  }
93  os << ']';
94  }
95 
96  if (en.txtline_)
97  os << " #" << en.txtline_;
98  os << endl;
99 
100  if (en.children_)
101  {
102  os << spacer << '{' << endl;
103  for (XmlElement::XmlSet::iterator itr(en.ordchildren_->begin()); itr != en.ordchildren_->end(); ++itr)
104  os << **itr;
105  os << spacer << '}' << endl;
106  }
107 
108  return os;
109 }
XmlSet * ordchildren_
Set of all child elements in file order.
Definition: xml.hpp:91
XmlSubEls * children_
simple n-ary tree
Definition: xml.hpp:87
int depth_
Definition: xml.hpp:63
string spacer
Definition: f8c.cpp:96
std::string * value_
Definition: xml.hpp:62
XmlAttrs * attrs_
Definition: xml.hpp:76
std::string * decl_
Definition: xml.hpp:62
int txtline_
Definition: xml.hpp:63
std::string tag_
Definition: xml.hpp:62