Last change
on this file since 2328 was
501,
checked in by ymipsl, 10 years ago
|
Add licence copyright to all file ond directory src using the command :
svn propset -R copyright -F header_licence src
XIOS is now officialy under CeCILL licence
YM
|
-
Property copyright set to
Software name : XIOS (Xml I/O Server) http://forge.ipsl.jussieu.fr/ioserver Creation date : January 2009 Licence : CeCCIL version2 see license file in root directory : Licence_CeCILL_V2-en.txt or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement) CNRS/IPSL (Institut Pierre Simon Laplace) Project Manager : Yann Meurdesoif yann.meurdesoif@cea.fr
|
File size:
1.2 KB
|
Line | |
---|
1 | #include "indent.hpp" |
---|
2 | #include <ostream> |
---|
3 | #include <iostream> |
---|
4 | |
---|
5 | using namespace std ; |
---|
6 | |
---|
7 | namespace xios |
---|
8 | { |
---|
9 | Cindent iendl ; |
---|
10 | Cindent ireset(0,true) ; |
---|
11 | int Cindent::defaultIncSize=2 ; |
---|
12 | int Cindent::index=ios::xalloc() ; |
---|
13 | |
---|
14 | Cindent::Cindent(int i,bool r) : offset(i), reset(r), incSize(defaultIncSize) |
---|
15 | { } |
---|
16 | |
---|
17 | Cindent Cindent::operator++() |
---|
18 | { |
---|
19 | return Cindent(incSize) ; |
---|
20 | } |
---|
21 | |
---|
22 | Cindent Cindent::operator--() |
---|
23 | { |
---|
24 | return Cindent(-incSize) ; |
---|
25 | } |
---|
26 | |
---|
27 | Cindent Cindent::operator++(int) |
---|
28 | { |
---|
29 | return Cindent(incSize) ; |
---|
30 | } |
---|
31 | |
---|
32 | Cindent Cindent::operator--(int) |
---|
33 | { |
---|
34 | return Cindent(-incSize) ; |
---|
35 | } |
---|
36 | |
---|
37 | Cindent Cindent::operator+=(int i) |
---|
38 | { |
---|
39 | return Cindent(incSize*i) ; |
---|
40 | } |
---|
41 | |
---|
42 | Cindent Cindent::operator-=(int i) |
---|
43 | { |
---|
44 | return Cindent(-incSize*i) ; |
---|
45 | } |
---|
46 | |
---|
47 | ostream& Cindent::iendl(ostream& o) const |
---|
48 | { |
---|
49 | if (reset) |
---|
50 | { |
---|
51 | o.iword(index)=0 ; |
---|
52 | return o ; |
---|
53 | } |
---|
54 | else |
---|
55 | { |
---|
56 | o.iword(index)+=offset ; |
---|
57 | if (o.iword(index)<0) o.iword(index)=0 ; |
---|
58 | o<<"\n" ; |
---|
59 | int mem=o.width(o.iword(index)) ; |
---|
60 | o<<""; |
---|
61 | o.width(mem) ; |
---|
62 | return o ; |
---|
63 | } |
---|
64 | } |
---|
65 | |
---|
66 | ostream& operator <<(ostream& o, const Cindent& indent) |
---|
67 | { |
---|
68 | return indent.iendl(o) ; |
---|
69 | } |
---|
70 | |
---|
71 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.