5#ifndef ICE_UTIL_OUTPUT_UTIL_H
6#define ICE_UTIL_OUTPUT_UTIL_H
13namespace IceUtilInternal
29class ICE_API OutputBase :
private ::IceUtil::noncopyable
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;
86class 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;
114operator<<(Output& out,
const T& val)
116 std::ostringstream s;
124operator<<(Output& out,
const std::vector<T>& val)
126 for(
typename std::vector<T>::const_iterator p = val.begin(); p != val.end(); ++p)
135operator<<(Output& o,
const NextLine&)
143operator<<(Output& o,
const Separator&)
156operator<<(Output& o,
const StartBlock&)
169operator<<(Output& o,
const EndBlock&)
182operator<<(Output& o,
const StartPar&)
195operator<<(Output& o,
const EndPar&)
208operator<<(Output& o,
const StartAbrk&)
221operator<<(Output& o,
const EndAbrk&)
227ICE_API Output& operator<<(Output&, std::ios_base& (*)(std::ios_base&));
233class 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;
268operator<<(XMLOutput& out,
const T& val)
270 std::ostringstream s;
278operator<<(XMLOutput& o,
const NextLine&)
286operator<<(XMLOutput& o,
const Separator&)
299operator<<(XMLOutput& o,
const EndElement&)
309 StartElement(
const std::string&);
311 const std::string& getName()
const;
315 const std::string _name;
318typedef StartElement se;
322operator<<(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;
343typedef Attribute attr;
347operator<<(XMLOutput& o,
const Attribute& e)
349 o.attr(e.getName(), e.getValue());
365operator<<(XMLOutput& o,
const StartEscapes&)
373operator<<(XMLOutput& o,
const EndEscapes&)
379ICE_API XMLOutput& operator<<(XMLOutput&, std::ios_base& (*)(std::ios_base&));
#define ICE_API
Definition Config.h:197
#define ICE_GLOBAL_VAR_SUFFIX
Definition Config.h:185
long long Int64
Definition Config.h:342