Last change
on this file since 2013 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
|
Rev | Line | |
---|
[219] | 1 | #include "indent.hpp" |
---|
[313] | 2 | #include <ostream> |
---|
| 3 | #include <iostream> |
---|
[219] | 4 | |
---|
[313] | 5 | using namespace std ; |
---|
[219] | 6 | |
---|
[335] | 7 | namespace xios |
---|
[219] | 8 | { |
---|
[313] | 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 | } |
---|
[219] | 26 | |
---|
[313] | 27 | Cindent Cindent::operator++(int) |
---|
| 28 | { |
---|
| 29 | return Cindent(incSize) ; |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | Cindent Cindent::operator--(int) |
---|
| 33 | { |
---|
| 34 | return Cindent(-incSize) ; |
---|
| 35 | } |
---|
[219] | 36 | |
---|
[313] | 37 | Cindent Cindent::operator+=(int i) |
---|
| 38 | { |
---|
| 39 | return Cindent(incSize*i) ; |
---|
| 40 | } |
---|
[219] | 41 | |
---|
[313] | 42 | Cindent Cindent::operator-=(int i) |
---|
| 43 | { |
---|
| 44 | return Cindent(-incSize*i) ; |
---|
| 45 | } |
---|
[219] | 46 | |
---|
[313] | 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.