| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkIndent.cxx.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:40 $ |
| 7 |
|
Version: $Revision: 1.4 $ |
| 8 |
|
|
| 9 |
|
Copyright (c) Insight Software Consortium. All rights reserved. |
| 10 |
|
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. |
| 11 |
|
|
| 12 |
|
Portions of this code are covered under the VTK copyright. |
| 13 |
|
See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details. |
| 14 |
|
|
| 15 |
|
This software is distributed WITHOUT ANY WARRANTY; without even |
| 16 |
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 17 |
IND |
*****PURPOSE. See the above copyright notices for more information. |
| 18 |
|
|
| 19 |
DEF |
=========================================================================*/ |
| 20 |
|
#include "itkIndent.h" |
| 21 |
|
#include "itkObjectFactory.h" |
| 22 |
|
|
| 23 |
|
#define ITK_STD_INDENT 2 |
| 24 |
|
#define ITK_NUMBER_OF_BLANKS 40 |
| 25 |
|
|
| 26 |
|
namespace itk |
| 27 |
|
{ |
| 28 |
|
|
| 29 |
|
static const char blanks[ITK_NUMBER_OF_BLANKS+1] = |
| 30 |
|
" "; |
| 31 |
|
|
| 32 |
|
/** |
| 33 |
|
* Instance creation. |
| 34 |
|
*/ |
| 35 |
|
Indent* |
| 36 |
|
Indent:: |
| 37 |
|
New() |
| 38 |
|
{ |
| 39 |
|
return new Self; |
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
|
| 43 |
|
/** |
| 44 |
|
* Determine the next indentation level. Keep indenting by two until the |
| 45 |
|
* max of forty. |
| 46 |
|
*/ |
| 47 |
|
Indent |
| 48 |
|
Indent |
| 49 |
|
::GetNextIndent() |
| 50 |
|
{ |
| 51 |
|
int indent = m_Indent + ITK_STD_INDENT; |
| 52 |
|
if ( indent > ITK_NUMBER_OF_BLANKS ) |
| 53 |
|
{ |
| 54 |
|
indent = ITK_NUMBER_OF_BLANKS; |
| 55 |
|
} |
| 56 |
|
return indent; |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
/** |
| 60 |
|
* Print out the indentation. Basically output a bunch of spaces. |
| 61 |
|
*/ |
| 62 |
|
std::ostream& |
| 63 |
|
operator<<(std::ostream& os, const Indent& ind) |
| 64 |
|
{ |
| 65 |
SEM |
os << blanks + (ITK_NUMBER_OF_BLANKS-ind.m_Indent) ; |
| 66 |
|
return os; |
| 67 |
|
} |
| 68 |
|
|
| 69 |
|
} // end namespace itk |
| 70 |
|
|