20 class IndentBuffer :
public std::streambuf
23 IndentBuffer() : m_Sink(NULL), m_NewLine(
false), m_IndentLevel(0){}
38 void setSink(std::streambuf *sink)
47 virtual int overflow(
int c)
override;
52 std::streambuf *m_Sink;
54 unsigned int m_IndentLevel;
66 OB(
unsigned int level) : Level(level){}
79 CB(
unsigned int level) : Level(level){}
91 : m_CodeStream(codeStream), m_Level(s_NextLevel++)
105 static unsigned int s_NextLevel;
111 const unsigned int m_Level;
115 m_Braces.push_back(0);
124 m_Buffer.setSink(stream.rdbuf());
131 friend std::ostream&
operator << (std::ostream& s,
const OB &ob);
132 friend std::ostream&
operator << (std::ostream& s,
const CB &cb);
137 IndentBuffer m_Buffer;
138 std::vector<unsigned int> m_Braces;
~Scope()
Definition: codeStream.h:96
A close bracket marker.
Definition: codeStream.h:77
An open bracket marker.
Definition: codeStream.h:64
const unsigned int Level
Definition: codeStream.h:68
const unsigned int Level
Definition: codeStream.h:81
Helper class for generating code - automatically inserts brackets, indents etc.
Definition: codeStream.h:14
friend std::ostream & operator<<(std::ostream &s, const OB &ob)
Definition: codeStream.cc:46
OB(unsigned int level)
Definition: codeStream.h:66
CodeStream()
Definition: codeStream.h:114
Definition: codeStream.h:87
CB(unsigned int level)
Definition: codeStream.h:79
void setSink(std::ostream &stream)
Definition: codeStream.h:122
Scope(CodeStream &codeStream)
Definition: codeStream.h:90
CodeStream(std::ostream &stream)
Definition: codeStream.h:118