top | up | prev | next

CodeFormatter Class

Writes indented text to a stream.

Definition at line 15 of CodeFormatter.hpp

Constructors

CodeFormatter(std::ostream& stream_)

Member Functions

void BeginContent()
int CurrentIndent() const
void DecIndent()
void EndContent()
void Flush()
void IncIndent()
int Indent() const
int IndentSize() const
int Line() const
void NewLine()
bool PreserveSpace() const
void ResetStart()
void SetIndentSize(int indentSize_)
void SetLine(int line_)
void SetLogging()
void SetPreserveSpace(bool preserveSpace_)
void SetStart()
void SetStartText(const std::string& startText_)
bool Start() const
const std::string& StartText() const
void Write(const std::string& text)
void WriteLine()
void WriteLine(const std::string& text)
CodeFormatter& operator<<(StandardEndLine manip)

Typedefs

std::basic_ostream<char, std::char_traits<char>> CoutType

Member Variables

bool atBeginningOfLine
int contentCount
int indent
int indentSize
int line
bool logging
bool preserveSpace
bool start
std::string startText
std::ostream& stream

Constructor Details

CodeFormatter Constructor

soulng::util::CodeFormatter::CodeFormatter(std::ostream& stream_)

Definition at line 18 of CodeFormatter.hpp :
18 : stream(stream_)indent(0)indentSize(4)atBeginningOfLine(true)line(1)start(false)preserveSpace(false)contentCount(0)logging(false) {}


Member Function Details

BeginContent Member Function

void soulng::util::CodeFormatter::BeginContent()

Definition at line 46 of CodeFormatter.hpp :
46 { ++contentCount; }

Called by: soulng::util::JsonObject::Write


CurrentIndent Member Function

int soulng::util::CodeFormatter::CurrentIndent() const

Definition at line 22 of CodeFormatter.hpp :
22 { return indentSize * indent; }


DecIndent Member Function

void soulng::util::CodeFormatter::DecIndent()

Definition at line 32 of CodeFormatter.hpp :
33 {
34     --indent;
35 }


Called by: soulng::util::JsonArray::Write , soulng::util::JsonObject::Write


EndContent Member Function

void soulng::util::CodeFormatter::EndContent()

Definition at line 47 of CodeFormatter.hpp :
47 { --contentCount; }

Called by: soulng::util::JsonObject::Write


Flush Member Function

void soulng::util::CodeFormatter::Flush()

Definition at line 142 of CodeFormatter.cpp :
143 {
144     stream.flush();
145 }


Declaration at line 27 of CodeFormatter.hpp

Called by: soulng::util::CodeFormatter::operator<<


IncIndent Member Function

void soulng::util::CodeFormatter::IncIndent()

Definition at line 28 of CodeFormatter.hpp :
29 {
30     ++indent;
31 }


Called by: soulng::util::JsonArray::Write , soulng::util::JsonObject::Write


Indent Member Function

int soulng::util::CodeFormatter::Indent() const

Definition at line 19 of CodeFormatter.hpp :
19 { return indent; }


IndentSize Member Function

int soulng::util::CodeFormatter::IndentSize() const

Definition at line 20 of CodeFormatter.hpp :
20 { return indentSize; }


Line Member Function

int soulng::util::CodeFormatter::Line() const

Definition at line 36 of CodeFormatter.hpp :
36 { return line; }


NewLine Member Function

void soulng::util::CodeFormatter::NewLine()

Definition at line 135 of CodeFormatter.cpp :
136 {
137     stream << "\n";
138     atBeginningOfLine = true;
139     ++line;
140 }


Declaration at line 25 of CodeFormatter.hpp

Called by: soulng::util::CodeFormatter::WriteLine , soulng::util::CodeFormatter::WriteLine


PreserveSpace Member Function

bool soulng::util::CodeFormatter::PreserveSpace() const

Definition at line 43 of CodeFormatter.hpp :
43 { return preserveSpace; }


ResetStart Member Function

void soulng::util::CodeFormatter::ResetStart()

Definition at line 40 of CodeFormatter.hpp :
40 { start = false; }


SetIndentSize Member Function

void soulng::util::CodeFormatter::SetIndentSize(int indentSize_)

Definition at line 21 of CodeFormatter.hpp :
21 { indentSize = indentSize_; }


SetLine Member Function

void soulng::util::CodeFormatter::SetLine(int line_)

Definition at line 37 of CodeFormatter.hpp :
37 { line = line_; }


SetLogging Member Function

void soulng::util::CodeFormatter::SetLogging()

Definition at line 45 of CodeFormatter.hpp :
45 { logging = true; }


SetPreserveSpace Member Function

void soulng::util::CodeFormatter::SetPreserveSpace(bool preserveSpace_)

Definition at line 44 of CodeFormatter.hpp :
44 { preserveSpace = preserveSpace_; }


SetStart Member Function

void soulng::util::CodeFormatter::SetStart()

Definition at line 39 of CodeFormatter.hpp :
39 { start = true; }


SetStartText Member Function

void soulng::util::CodeFormatter::SetStartText(const std::string& startText_)

Definition at line 41 of CodeFormatter.hpp :
41 { startText = startText_; }


Start Member Function

bool soulng::util::CodeFormatter::Start() const

Definition at line 38 of CodeFormatter.hpp :
38 { return start; }


StartText Member Function

const std::string& soulng::util::CodeFormatter::StartText() const

Definition at line 42 of CodeFormatter.hpp :
42 { return startText; }


Write Member Function

void soulng::util::CodeFormatter::Write(const std::string& text)

Definition at line 109 of CodeFormatter.cpp
Declaration at line 23 of CodeFormatter.hpp

Called by: soulng::util::CodeFormatter::WriteLine , soulng::util::JsonObject::Write , soulng::util::JsonValue::Write


WriteLine Member Function

void soulng::util::CodeFormatter::WriteLine()

Definition at line 26 of CodeFormatter.hpp :
26 { NewLine(); }

Calls: soulng::util::CodeFormatter::NewLine

Called by: soulng::util::CodeFormatter::operator<< , soulng::util::JsonArray::Write , soulng::util::JsonObject::Write


WriteLine Member Function

void soulng::util::CodeFormatter::WriteLine(const std::string& text)

Definition at line 129 of CodeFormatter.cpp :
130 {
131     Write(text);
132     NewLine();
133 }


Declaration at line 24 of CodeFormatter.hpp

Calls: soulng::util::CodeFormatter::NewLine , soulng::util::CodeFormatter::Write

Called by: soulng::util::JsonArray::Write , soulng::util::JsonObject::Write


operator<< Member Function

CodeFormatter & soulng::util::CodeFormatter::operator<<(StandardEndLine manip)

Definition at line 147 of CodeFormatter.cpp :
148 {
149     WriteLine();
150     Flush();
151     return *this;
152 }


Declaration at line 50 of CodeFormatter.hpp

Calls: soulng::util::CodeFormatter::Flush , soulng::util::CodeFormatter::WriteLine


top | up | prev | next