source: XMLIO_V2/dev/trunk/src/XMLIO/stdout_indent.hpp @ 79

Last change on this file since 79 was 79, checked in by ymipsl, 14 years ago

import dev/trunk

File size: 821 bytes
Line 
1#ifndef STDOUT_INDENT_HPP
2#define STDOUT_INDENT_HPP
3#include "xmlio_std.hpp"
4
5extern int iostreamIndexIndent ;
6
7ostream& iendl(ostream& o) ;
8ostream& inc_endl(ostream& o) ;
9ostream& dec_endl(ostream& o) ;
10
11inline ostream& IncIndent(ostream& o)
12{
13  ++o.iword(iostreamIndexIndent) ;
14  return o ;
15}
16
17inline ostream& DecIndent(ostream& o)
18{
19  if (o.iword(iostreamIndexIndent)>0)
20    --o.iword(iostreamIndexIndent) ;
21  return o ;
22}
23
24inline ostream& ResetIndent(ostream& o)
25{
26  o.iword(iostreamIndexIndent)=0 ;
27  return o ;
28}
29
30inline ostream& iendl(ostream& o)
31{
32  o<<'\n' ;
33  int mem=o.width(o.iword(iostreamIndexIndent)*2) ;
34  o<<"";
35  o.width(mem) ;
36  return o ;
37}
38
39inline ostream& inc_endl(ostream& o)
40{
41  return o<<IncIndent<<iendl ;
42}
43
44inline ostream& dec_endl(ostream& o)
45{
46  return o<<DecIndent<<iendl ;
47}
48
49
50#endif
51
52
53
54
Note: See TracBrowser for help on using the repository browser.