5 #ifndef ICE_UTIL_OUTPUT_UTIL_H
6 #define ICE_UTIL_OUTPUT_UTIL_H
13 namespace IceUtilInternal
34 OutputBase(std::ostream&);
35 OutputBase(
const std::string&);
36 virtual ~OutputBase();
41 void open(
const std::string&);
45 virtual void print(
const std::string&);
50 void useCurrentPosAsIndent();
55 virtual void newline();
58 bool operator!()
const;
67 std::stack<int> _indentSave;
86 class ICE_API Output :
public OutputBase
90 Output(
bool breakBeforeBlock =
true,
bool shortEmptyBlock =
false);
91 Output(std::ostream&,
bool =
true,
bool =
false);
92 Output(
const char*,
bool =
true,
bool =
false);
94 virtual void print(
const std::string&);
99 void spar(
char =
'(');
100 void epar(
char =
')');
104 std::string _blockStart;
105 std::string _blockEnd;
107 const bool _breakBeforeBlock;
108 const bool _shortEmptyBlock;
116 std::ostringstream s;
124 operator<<(Output& out,
const std::vector<T>& val)
126 for(
typename std::vector<T>::const_iterator p = val.begin(); p != val.end(); ++p)
233 class ICE_API XMLOutput :
public OutputBase
238 XMLOutput(std::ostream&);
239 XMLOutput(
const char*);
241 virtual void print(
const std::string&);
243 virtual void newline();
245 void startElement(
const std::string&);
247 void attr(
const std::string&,
const std::string&);
252 std::string currentElement()
const;
256 ::std::string escape(const ::std::string&)
const;
258 std::stack<std::string> _elementStack;
270 std::ostringstream s;
309 StartElement(
const std::string&);
311 const std::string& getName()
const;
315 const std::string _name;
318 typedef StartElement se;
322 operator<<(XMLOutput& o,
const StartElement& e)
324 o.startElement(e.getName());
332 Attribute(const ::std::string&, const ::std::string&);
334 const ::std::string& getName()
const;
335 const ::std::string& getValue()
const;
339 const ::std::string _name;
340 const ::std::string _value;
343 typedef Attribute attr;
349 o.attr(e.getName(), e.getValue());