Indenter.cpp
Go to the documentation of this file.
1 // (C) Copyright Renaud Detry 2007-2015.
2 // Distributed under the GNU General Public License and under the
3 // BSD 3-Clause License (See accompanying file LICENSE.txt).
4 
5 /** @file */
6 
7 #include <iostream>
8 #include <nuklei/Indenter.h>
9 
10 namespace nuklei {
11 
12  int Indenter::level = -1;
13 
14  Indenter::Indenter(std::ostream &out, std::string step) :
15 
16  out(out), step(step)
17 
18  { level++; };
19 
20  Indenter::~Indenter() { level--; };
21 
22 
23  int Indenter::main(int argc, char ** argv)
24  {
25  Indenter idt0(std::cout);
26 
27  idt0 << "This is a level 0 display." << std::endl;
28 
29  {
30  Indenter idt1 = Indenter();
31  idt1 << "This is a level " << 1 << " display." << std::endl;
32  } // End of block, idt1 is destructed.
33 
34  idt0 << "Back to level 0." << std::endl;
35 
36  return 0;
37  }
38 
39 }
Public namespace.
Definition: Color.cpp:9
© Copyright 2007-2013 Renaud Detry.
Distributed under the terms of the GNU General Public License (GPL).
(See accompanying file LICENSE.txt or copy at http://www.gnu.org/copyleft/gpl.html.)
Revised Sun Sep 13 2020 19:10:06.