Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
IndentPrintWriter.h
Go to the documentation of this file.
1// Copyright FreeHEP, 2005.
2#ifndef CHEPREP_INDENTPRINTWRITER_H
3#define CHEPREP_INDENTPRINTWRITER_H 1
4
5#include "cheprep/config.h"
6
7#include <iostream>
8#include <string>
9
10/**
11 * A PrintWriter that keeps track of an indentation level
12 * and indents the output appropriately.
13 *
14 * <b>Warning:</b> Only print and println methods taking strings have been overriden,
15 * print, println methods taking other arguments may not be indented properly.
16 *
17 * @author Mark Donszelmann
18 */
19namespace cheprep {
20
22
23 public:
24 IndentPrintWriter(std::ostream* out, int level = 0);
25 virtual ~IndentPrintWriter();
26
27 void close();
28 IndentPrintWriter& operator<< (const std::string & s);
29 IndentPrintWriter& operator<< (std::ostream& (*pf)(std::ostream&));
30 void println(const std::string & s);
31 void print(const std::string & s);
32 void println();
33 void indent();
34 void outdent();
35 int getIndent() const;
36 void setIndent(const int level);
37 std::string getIndentString() const;
38 void setIndentString(const std::string & indentString);
39
40 private:
41 void doIndent();
42
43 std::ostream* out;
44 bool closed;
45 int indentLevel;
46 bool indented;
47 std::string indentString;
48};
49
50} // cheprep
51
52
53#endif
54
void setIndent(const int level)
IndentPrintWriter & operator<<(const std::string &s)
void print(const std::string &s)
std::string getIndentString() const
void setIndentString(const std::string &indentString)