Doxygen
Loading...
Searching...
No Matches
PerlModOutput Class Reference
Collaboration diagram for PerlModOutput:

Public Member Functions

 PerlModOutput (bool pretty)
virtual ~PerlModOutput ()
void reset ()
void setPerlModOutputStream (PerlModOutputStream *os)
PerlModOutputcontinueBlock ()
PerlModOutputadd (char c)
PerlModOutputadd (const DString &s)
PerlModOutputadd (DString &s)
PerlModOutputadd (int n)
PerlModOutputadd (unsigned int n)
PerlModOutputaddQuoted (const DString &s)
PerlModOutputindent ()
PerlModOutputopen (char c, const DString &s=DString())
PerlModOutputclose (char c=0)
PerlModOutputaddField (const DString &s)
PerlModOutputaddFieldQuotedChar (const DString &field, char content)
PerlModOutputaddFieldQuotedString (const DString &field, const DString &content)
PerlModOutputaddFieldBoolean (const DString &field, bool content)
PerlModOutputopenList (const DString &s=DString())
PerlModOutputcloseList ()
PerlModOutputopenHash (const DString &s=DString())
PerlModOutputcloseHash ()

Public Attributes

bool m_pretty

Protected Member Functions

void incIndent ()
void decIndent ()
void iaddQuoted (const DString &)
void iaddFieldQuotedChar (const DString &, char)
void iaddFieldQuotedString (const DString &, const DString &)
void iaddField (const DString &)
void iopen (char, const DString &)
void iclose (char)

Private Attributes

PerlModOutputStreamm_stream
int m_indentation
bool m_blockstart
char m_spaces [PERLOUTPUT_MAX_INDENTATION *2+2]

Detailed Description

Definition at line 85 of file perlmodgen.cpp.

Constructor & Destructor Documentation

◆ PerlModOutput()

PerlModOutput::PerlModOutput ( bool pretty)
inline

Definition at line 91 of file perlmodgen.cpp.

92 : m_pretty(pretty), m_stream(nullptr), m_indentation(false), m_blockstart(true)
93 {
94 m_spaces[0] = 0;
95 }
char m_spaces[PERLOUTPUT_MAX_INDENTATION *2+2]
PerlModOutputStream * m_stream

References m_blockstart, m_indentation, m_pretty, m_spaces, and m_stream.

Referenced by add(), add(), add(), add(), add(), addField(), addFieldBoolean(), addFieldQuotedChar(), addFieldQuotedString(), addQuoted(), close(), closeHash(), closeList(), continueBlock(), indent(), open(), openHash(), and openList().

◆ ~PerlModOutput()

virtual PerlModOutput::~PerlModOutput ( )
inlinevirtual

Definition at line 97 of file perlmodgen.cpp.

97{ reset(); }

References reset().

Member Function Documentation

◆ add() [1/5]

◆ add() [2/5]

PerlModOutput & PerlModOutput::add ( const DString & s)
inline

Definition at line 118 of file perlmodgen.cpp.

118{ m_stream->add(s); return *this; }

References PerlModOutputStream::add(), m_stream, and PerlModOutput().

◆ add() [3/5]

PerlModOutput & PerlModOutput::add ( DString & s)
inline

Definition at line 119 of file perlmodgen.cpp.

119{ m_stream->add(s); return *this; }

References PerlModOutputStream::add(), m_stream, and PerlModOutput().

◆ add() [4/5]

PerlModOutput & PerlModOutput::add ( int n)
inline

Definition at line 120 of file perlmodgen.cpp.

120{ m_stream->add(n); return *this; }

References PerlModOutputStream::add(), m_stream, and PerlModOutput().

◆ add() [5/5]

PerlModOutput & PerlModOutput::add ( unsigned int n)
inline

Definition at line 121 of file perlmodgen.cpp.

121{ m_stream->add(n); return *this; }

References PerlModOutputStream::add(), m_stream, and PerlModOutput().

◆ addField()

PerlModOutput & PerlModOutput::addField ( const DString & s)
inline

Definition at line 137 of file perlmodgen.cpp.

137{ iaddField(s); return *this; }
void iaddField(const DString &)

References iaddField(), and PerlModOutput().

Referenced by addPerlModDocBlock(), and PerlModDocVisitor::enterText().

◆ addFieldBoolean()

PerlModOutput & PerlModOutput::addFieldBoolean ( const DString & field,
bool content )
inline

Definition at line 146 of file perlmodgen.cpp.

147 {
148 return addFieldQuotedString(field, content ? "yes" : "no");
149 }
PerlModOutput & addFieldQuotedString(const DString &field, const DString &content)

References addFieldQuotedString(), and PerlModOutput().

Referenced by PerlModGenerator::addIncludeInfo(), PerlModGenerator::generatePerlModForMember(), and PerlModDocVisitor::operator()().

◆ addFieldQuotedChar()

PerlModOutput & PerlModOutput::addFieldQuotedChar ( const DString & field,
char content )
inline

Definition at line 138 of file perlmodgen.cpp.

139 {
140 iaddFieldQuotedChar(field, content); return *this;
141 }
void iaddFieldQuotedChar(const DString &, char)

References iaddFieldQuotedChar(), and PerlModOutput().

Referenced by PerlModDocVisitor::operator()().

◆ addFieldQuotedString()

PerlModOutput & PerlModOutput::addFieldQuotedString ( const DString & field,
const DString & content )
inline

◆ addQuoted()

PerlModOutput & PerlModOutput::addQuoted ( const DString & s)
inline

◆ close()

PerlModOutput & PerlModOutput::close ( char c = 0)
inline

Definition at line 135 of file perlmodgen.cpp.

135{ iclose(c); return *this; }
void iclose(char)

References iclose(), and PerlModOutput().

Referenced by closeHash(), and closeList().

◆ closeHash()

◆ closeList()

◆ continueBlock()

PerlModOutput & PerlModOutput::continueBlock ( )
inline

Definition at line 107 of file perlmodgen.cpp.

108 {
109 if (m_blockstart)
110 m_blockstart = false;
111 else
112 m_stream->add(',');
113 indent();
114 return *this;
115 }
PerlModOutput & indent()

References PerlModOutputStream::add(), indent(), m_blockstart, m_stream, and PerlModOutput().

Referenced by iaddField(), and iopen().

◆ decIndent()

void PerlModOutput::decIndent ( )
protected

Definition at line 204 of file perlmodgen.cpp.

205{
208 m_spaces[m_indentation * 2] = 0;
209}
#define PERLOUTPUT_MAX_INDENTATION

References m_indentation, m_spaces, and PERLOUTPUT_MAX_INDENTATION.

Referenced by iclose().

◆ iaddField()

void PerlModOutput::iaddField ( const DString & s)
protected

Definition at line 226 of file perlmodgen.cpp.

227{
229 m_stream->add(s);
230 m_stream->add(m_pretty ? " => " : "=>");
231}
PerlModOutput & continueBlock()

References PerlModOutputStream::add(), continueBlock(), m_pretty, and m_stream.

Referenced by addField(), iaddFieldQuotedChar(), iaddFieldQuotedString(), and iopen().

◆ iaddFieldQuotedChar()

void PerlModOutput::iaddFieldQuotedChar ( const DString & field,
char content )
protected

Definition at line 233 of file perlmodgen.cpp.

234{
235 iaddField(field);
236 m_stream->add('\'');
237 if ((content == '\'') || (content == '\\'))
238 m_stream->add('\\');
239 m_stream->add(content);
240 m_stream->add('\'');
241}

References PerlModOutputStream::add(), iaddField(), and m_stream.

Referenced by addFieldQuotedChar().

◆ iaddFieldQuotedString()

void PerlModOutput::iaddFieldQuotedString ( const DString & field,
const DString & content )
protected

Definition at line 243 of file perlmodgen.cpp.

244{
245 if (content == nullptr)
246 return;
247 iaddField(field);
248 m_stream->add('\'');
249 iaddQuoted(content);
250 m_stream->add('\'');
251}

References PerlModOutputStream::add(), iaddField(), iaddQuoted(), and m_stream.

Referenced by addFieldQuotedString().

◆ iaddQuoted()

void PerlModOutput::iaddQuoted ( const DString & str)
protected

Definition at line 211 of file perlmodgen.cpp.

212{
213 if (str.empty()) return;
214 const char *s = str.data();
215 char c = 0;
216 while ((c = *s++) != 0)
217 {
218 if ((c == '\'') || (c == '\\'))
219 {
220 m_stream->add('\\');
221 }
222 m_stream->add(c);
223 }
224}
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition dstring.h:157

References PerlModOutputStream::add(), DString::data(), DString::empty(), and m_stream.

Referenced by addQuoted(), and iaddFieldQuotedString().

◆ iclose()

void PerlModOutput::iclose ( char c)
protected

Definition at line 264 of file perlmodgen.cpp.

265{
266 decIndent();
267 indent();
268 if (c != 0)
269 m_stream->add(c);
270 m_blockstart = false;
271}

References PerlModOutputStream::add(), decIndent(), indent(), m_blockstart, and m_stream.

Referenced by close().

◆ incIndent()

void PerlModOutput::incIndent ( )
protected

Definition at line 194 of file perlmodgen.cpp.

195{
197 {
198 char *s = &m_spaces[m_indentation * 2];
199 *s++ = ' '; *s++ = ' '; *s = 0;
200 }
202}

References m_indentation, m_spaces, and PERLOUTPUT_MAX_INDENTATION.

Referenced by iopen().

◆ indent()

PerlModOutput & PerlModOutput::indent ( )
inline

Definition at line 125 of file perlmodgen.cpp.

126 {
127 if (m_pretty) {
128 m_stream->add('\n');
130 }
131 return *this;
132 }

References PerlModOutputStream::add(), m_pretty, m_spaces, m_stream, and PerlModOutput().

Referenced by continueBlock(), and iclose().

◆ iopen()

void PerlModOutput::iopen ( char c,
const DString & s )
protected

Definition at line 253 of file perlmodgen.cpp.

254{
255 if (s != nullptr)
256 iaddField(s);
257 else
259 m_stream->add(c);
260 incIndent();
261 m_blockstart = true;
262}

References PerlModOutputStream::add(), continueBlock(), iaddField(), incIndent(), m_blockstart, and m_stream.

Referenced by open().

◆ open()

PerlModOutput & PerlModOutput::open ( char c,
const DString & s = DString() )
inline

Definition at line 134 of file perlmodgen.cpp.

134{ iopen(c, s); return *this; }
void iopen(char, const DString &)

References iopen(), and PerlModOutput().

Referenced by openHash(), and openList().

◆ openHash()

◆ openList()

◆ reset()

void PerlModOutput::reset ( )
inline

Definition at line 100 of file perlmodgen.cpp.

100{ m_stream=nullptr; }

References m_stream, and reset().

Referenced by PerlModGenerator::generatePerlModOutput(), reset(), and ~PerlModOutput().

◆ setPerlModOutputStream()

void PerlModOutput::setPerlModOutputStream ( PerlModOutputStream * os)
inline

Definition at line 102 of file perlmodgen.cpp.

102{ m_stream = os; }

References m_stream.

Referenced by PerlModGenerator::generatePerlModOutput().

Member Data Documentation

◆ m_blockstart

bool PerlModOutput::m_blockstart
private

Definition at line 175 of file perlmodgen.cpp.

Referenced by continueBlock(), iclose(), iopen(), and PerlModOutput().

◆ m_indentation

int PerlModOutput::m_indentation
private

Definition at line 174 of file perlmodgen.cpp.

Referenced by decIndent(), incIndent(), and PerlModOutput().

◆ m_pretty

bool PerlModOutput::m_pretty

Definition at line 89 of file perlmodgen.cpp.

Referenced by iaddField(), indent(), and PerlModOutput().

◆ m_spaces

char PerlModOutput::m_spaces[PERLOUTPUT_MAX_INDENTATION *2+2]
private

Definition at line 177 of file perlmodgen.cpp.

Referenced by decIndent(), incIndent(), indent(), and PerlModOutput().

◆ m_stream


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