My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes | List of all members
PerlModOutput Class Reference

Public Member Functions

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

Public Attributes

bool m_pretty
 

Protected Member Functions

void iopenSave ()
 
void icloseSave (QCString &)
 
void incIndent ()
 
void decIndent ()
 
void iaddQuoted (const char *)
 
void iaddFieldQuotedChar (const char *, char)
 
void iaddFieldQuotedString (const char *, const char *)
 
void iaddField (const char *)
 
void iopen (char, const char *)
 
void iclose (char)
 

Private Attributes

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

Detailed Description

Definition at line 105 of file perlmodgen.cpp.

Constructor & Destructor Documentation

PerlModOutput::PerlModOutput ( bool  pretty)
inline

Definition at line 111 of file perlmodgen.cpp.

References m_spaces.

: m_pretty(pretty), m_stream(0), m_indentation(false), m_blockstart(true)
{
m_spaces[0] = 0;
}
virtual PerlModOutput::~PerlModOutput ( )
inlinevirtual

Definition at line 117 of file perlmodgen.cpp.

{ }

Member Function Documentation

PerlModOutput& PerlModOutput::add ( char  c)
inline
PerlModOutput& PerlModOutput::add ( const char *  s)
inline

Definition at line 135 of file perlmodgen.cpp.

References PerlModOutputStream::add(), and m_stream.

{ m_stream->add(s); return *this; }
PerlModOutput& PerlModOutput::add ( QCString &  s)
inline

Definition at line 136 of file perlmodgen.cpp.

References PerlModOutputStream::add(), and m_stream.

{ m_stream->add(s); return *this; }
PerlModOutput& PerlModOutput::add ( int  n)
inline

Definition at line 137 of file perlmodgen.cpp.

References PerlModOutputStream::add(), and m_stream.

{ m_stream->add(n); return *this; }
PerlModOutput& PerlModOutput::add ( unsigned int  n)
inline

Definition at line 138 of file perlmodgen.cpp.

References PerlModOutputStream::add(), and m_stream.

{ m_stream->add(n); return *this; }
PerlModOutput& PerlModOutput::addField ( const char *  s)
inline

Definition at line 154 of file perlmodgen.cpp.

References iaddField().

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

{ iaddField(s); return *this; }
PerlModOutput& PerlModOutput::addFieldBoolean ( const char *  field,
bool  content 
)
inline
PerlModOutput& PerlModOutput::addFieldQuotedChar ( const char *  field,
char  content 
)
inline

Definition at line 155 of file perlmodgen.cpp.

References iaddFieldQuotedChar().

Referenced by PerlModDocVisitor::visit().

{
iaddFieldQuotedChar(field, content); return *this;
}
PerlModOutput& PerlModOutput::addFieldQuotedString ( const char *  field,
const char *  content 
)
inline
PerlModOutput& PerlModOutput::addQuoted ( const char *  s)
inline

Definition at line 140 of file perlmodgen.cpp.

References iaddQuoted().

Referenced by PerlModDocVisitor::visit(), and PerlModDocVisitor::visitPre().

{ iaddQuoted(s); return *this; }
PerlModOutput& PerlModOutput::close ( char  c = 0)
inline

Definition at line 152 of file perlmodgen.cpp.

References iclose().

Referenced by closeHash(), and closeList().

{ iclose(c); return *this; }
PerlModOutput& PerlModOutput::closeHash ( )
inline
PerlModOutput& PerlModOutput::closeList ( )
inline
PerlModOutput& PerlModOutput::closeSave ( QCString &  s)
inline

Definition at line 122 of file perlmodgen.cpp.

References icloseSave().

{ icloseSave(s); return *this; }
PerlModOutput& PerlModOutput::continueBlock ( )
inline

Definition at line 124 of file perlmodgen.cpp.

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

Referenced by iaddField(), and iopen().

{
m_blockstart = false;
else
m_stream->add(',');
indent();
return *this;
}
void PerlModOutput::decIndent ( )
protected

Definition at line 221 of file perlmodgen.cpp.

References m_indentation, m_spaces, and PERLOUTPUT_MAX_INDENTATION.

Referenced by iclose().

void PerlModOutput::iaddField ( const char *  s)
protected
void PerlModOutput::iaddFieldQuotedChar ( const char *  field,
char  content 
)
protected

Definition at line 245 of file perlmodgen.cpp.

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

Referenced by addFieldQuotedChar().

{
iaddField(field);
m_stream->add('\'');
if ((content == '\'') || (content == '\\'))
m_stream->add('\\');
m_stream->add(content);
m_stream->add('\'');
}
void PerlModOutput::iaddFieldQuotedString ( const char *  field,
const char *  content 
)
protected

Definition at line 255 of file perlmodgen.cpp.

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

Referenced by addFieldQuotedString().

{
if (content == 0)
return;
iaddField(field);
m_stream->add('\'');
iaddQuoted(content);
m_stream->add('\'');
}
void PerlModOutput::iaddQuoted ( const char *  s)
protected

Definition at line 228 of file perlmodgen.cpp.

References PerlModOutputStream::add(), and m_stream.

Referenced by addQuoted(), and iaddFieldQuotedString().

{
char c;
while ((c = *s++) != 0) {
if ((c == '\'') || (c == '\\'))
m_stream->add('\\');
}
}
void PerlModOutput::iclose ( char  c)
protected

Definition at line 276 of file perlmodgen.cpp.

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

Referenced by close().

{
indent();
if (c != 0)
m_stream->add(c);
m_blockstart = false;
}
void PerlModOutput::icloseSave ( QCString &  s)
protected

Definition at line 204 of file perlmodgen.cpp.

References PerlModOutputStream::m_s, m_saved, and m_stream.

Referenced by closeSave().

{
s = m_stream->m_s;
delete m_stream;
m_stream = m_saved.pop();
}
void PerlModOutput::incIndent ( )
protected

Definition at line 211 of file perlmodgen.cpp.

References m_indentation, m_spaces, and PERLOUTPUT_MAX_INDENTATION.

Referenced by iopen().

{
{
char *s = &m_spaces[m_indentation * 2];
*s++ = ' '; *s++ = ' '; *s = 0;
}
}
PerlModOutput& PerlModOutput::indent ( )
inline

Definition at line 142 of file perlmodgen.cpp.

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

Referenced by continueBlock(), and iclose().

{
if (m_pretty) {
m_stream->add('\n');
}
return *this;
}
void PerlModOutput::iopen ( char  c,
const char *  s 
)
protected

Definition at line 265 of file perlmodgen.cpp.

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

Referenced by open().

{
if (s != 0)
else
m_blockstart = true;
}
void PerlModOutput::iopenSave ( )
protected

Definition at line 198 of file perlmodgen.cpp.

References m_saved, and m_stream.

Referenced by openSave().

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

Definition at line 151 of file perlmodgen.cpp.

References iopen().

Referenced by openHash(), and openList().

{ iopen(c, s); return *this; }
PerlModOutput& PerlModOutput::openHash ( const char *  s = 0)
inline
PerlModOutput& PerlModOutput::openList ( const char *  s = 0)
inline
PerlModOutput& PerlModOutput::openSave ( )
inline

Definition at line 121 of file perlmodgen.cpp.

References iopenSave().

{ iopenSave(); return *this; }
void PerlModOutput::setPerlModOutputStream ( PerlModOutputStream os)
inline

Definition at line 119 of file perlmodgen.cpp.

References m_stream.

Referenced by PerlModGenerator::generatePerlModOutput().

{ m_stream = os; }

Member Data Documentation

bool PerlModOutput::m_blockstart
private

Definition at line 192 of file perlmodgen.cpp.

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

int PerlModOutput::m_indentation
private

Definition at line 191 of file perlmodgen.cpp.

Referenced by decIndent(), and incIndent().

bool PerlModOutput::m_pretty

Definition at line 109 of file perlmodgen.cpp.

Referenced by iaddField(), and indent().

QStack<PerlModOutputStream> PerlModOutput::m_saved
private

Definition at line 194 of file perlmodgen.cpp.

Referenced by icloseSave(), and iopenSave().

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

Definition at line 195 of file perlmodgen.cpp.

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

PerlModOutputStream* PerlModOutput::m_stream
private

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