ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
IndentPrintWriter.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file IndentPrintWriter.cc
1
// Copyright FreeHEP, 2005.
2
3
#include <fstream>
4
5
#include "
cheprep/IndentPrintWriter.h
"
6
7
using namespace
std;
8
12
namespace
cheprep {
13
14
IndentPrintWriter::IndentPrintWriter(ostream* outstream,
int
level)
15
: out(outstream),
16
closed
(
false
),
17
indentLevel(level),
18
indented(
false
),
19
indentString(
" "
) {
20
}
21
22
IndentPrintWriter::~IndentPrintWriter
() {
23
}
24
25
void
IndentPrintWriter::close
() {
26
if
(!
closed
) {
27
out
->flush();
28
closed
=
true
;
29
}
30
}
31
32
IndentPrintWriter
&
IndentPrintWriter::operator<<
(
const
std::string &
s
) {
33
if
(!
indented
)
doIndent
();
34
*
out
<<
s
;
35
return
*
this
;
36
}
37
38
IndentPrintWriter
&
IndentPrintWriter::operator<<
(ostream& (*)(ostream&)) {
39
*
out
<< endl;
40
indented
=
false
;
41
return
*
this
;
42
}
43
44
void
IndentPrintWriter::println
(
const
string
&
s
) {
45
*
this
<< s << endl;
46
}
47
48
void
IndentPrintWriter::print
(
const
string
&
s
) {
49
*
this
<<
s
;
50
}
51
52
void
IndentPrintWriter::println
() {
53
*
out
<< endl;
54
indented
=
false
;
55
}
56
57
void
IndentPrintWriter::doIndent
() {
58
for
(
int
i=0; i<
indentLevel
; i++) {
59
*
out
<<
indentString
;
60
}
61
indented
=
true
;
62
}
63
64
void
IndentPrintWriter::indent
() {
65
indentLevel
++;
66
}
67
68
void
IndentPrintWriter::outdent
() {
69
indentLevel
--;
70
}
71
72
int
IndentPrintWriter::getIndent
()
const
{
73
return
indentLevel
;
74
}
75
76
void
IndentPrintWriter::setIndent
(
const
int
level) {
77
indentLevel
= level;
78
}
79
80
string
IndentPrintWriter::getIndentString
()
const
{
81
return
indentString
;
82
}
83
84
void
IndentPrintWriter::setIndentString
(
const
string
& anIndent) {
85
indentString
= anIndent;
86
}
87
88
}
// cheprep
geant4
tree
geant4-10.6-release
source
visualization
HepRep
src
IndentPrintWriter.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:55
using
1.8.2 with
ECCE GitHub integration