Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
cheprep::IndentPrintWriter Class Reference

#include <IndentPrintWriter.h>

Public Member Functions

 IndentPrintWriter (std::ostream *out, int level=0)
 
virtual ~IndentPrintWriter ()
 
void close ()
 
IndentPrintWriteroperator<< (const std::string &s)
 
IndentPrintWriteroperator<< (std::ostream &(*pf)(std::ostream &))
 
void println (const std::string &s)
 
void print (const std::string &s)
 
void println ()
 
void indent ()
 
void outdent ()
 
int getIndent () const
 
void setIndent (const int level)
 
std::string getIndentString () const
 
void setIndentString (const std::string &indentString)
 

Detailed Description

Definition at line 21 of file IndentPrintWriter.h.

Constructor & Destructor Documentation

◆ IndentPrintWriter()

cheprep::IndentPrintWriter::IndentPrintWriter ( std::ostream *  out,
int  level = 0 
)

Definition at line 14 of file IndentPrintWriter.cc.

15 : out(outstream),
16 closed(false),
17 indentLevel(level),
18 indented(false),
19 indentString(" ") {
20}

◆ ~IndentPrintWriter()

cheprep::IndentPrintWriter::~IndentPrintWriter ( )
virtual

Definition at line 22 of file IndentPrintWriter.cc.

22 {
23}

Member Function Documentation

◆ close()

void cheprep::IndentPrintWriter::close ( )

Definition at line 25 of file IndentPrintWriter.cc.

25 {
26 if (!closed) {
27 out->flush();
28 closed = true;
29 }
30}

Referenced by cheprep::XMLWriter::close(), cheprep::XMLWriter::closeTag(), and cheprep::XMLWriter::~XMLWriter().

◆ getIndent()

int cheprep::IndentPrintWriter::getIndent ( ) const

Definition at line 72 of file IndentPrintWriter.cc.

72 {
73 return indentLevel;
74}

Referenced by cheprep::XMLWriter::printAttributes().

◆ getIndentString()

string cheprep::IndentPrintWriter::getIndentString ( ) const

Definition at line 80 of file IndentPrintWriter.cc.

80 {
81 return indentString;
82}

Referenced by cheprep::XMLWriter::openDoc().

◆ indent()

void cheprep::IndentPrintWriter::indent ( )

Definition at line 64 of file IndentPrintWriter.cc.

64 {
65 indentLevel++;
66}

Referenced by cheprep::XMLWriter::openTag(), and cheprep::XMLWriter::printAttributes().

◆ operator<<() [1/2]

IndentPrintWriter & cheprep::IndentPrintWriter::operator<< ( const std::string &  s)

Definition at line 32 of file IndentPrintWriter.cc.

32 {
33 if (!indented) doIndent();
34 *out << s;
35 return *this;
36}

◆ operator<<() [2/2]

IndentPrintWriter & cheprep::IndentPrintWriter::operator<< ( std::ostream &(*)(std::ostream &)  pf)

◆ outdent()

void cheprep::IndentPrintWriter::outdent ( )

Definition at line 68 of file IndentPrintWriter.cc.

68 {
69 indentLevel--;
70}

Referenced by cheprep::XMLWriter::closeTag(), and cheprep::XMLWriter::printAttributes().

◆ print()

void cheprep::IndentPrintWriter::print ( const std::string &  s)

Definition at line 48 of file IndentPrintWriter.cc.

48 {
49 *this << s;
50}

◆ println() [1/2]

void cheprep::IndentPrintWriter::println ( )

Definition at line 52 of file IndentPrintWriter.cc.

52 {
53 *out << endl;
54 indented = false;
55}

◆ println() [2/2]

void cheprep::IndentPrintWriter::println ( const std::string &  s)

Definition at line 44 of file IndentPrintWriter.cc.

44 {
45 *this << s << endl;
46}

◆ setIndent()

void cheprep::IndentPrintWriter::setIndent ( const int  level)

Definition at line 76 of file IndentPrintWriter.cc.

76 {
77 indentLevel = level;
78}

◆ setIndentString()

void cheprep::IndentPrintWriter::setIndentString ( const std::string &  indentString)

Definition at line 84 of file IndentPrintWriter.cc.

84 {
85 indentString = anIndent;
86}

Referenced by cheprep::XMLWriter::openDoc(), and cheprep::XMLWriter::XMLWriter().


The documentation for this class was generated from the following files: