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.

112  : m_pretty(pretty), m_stream(0), m_indentation(false), m_blockstart(true)
113  {
114  m_spaces[0] = 0;
115  }
char m_spaces[PERLOUTPUT_MAX_INDENTATION *2+2]
Definition: perlmodgen.cpp:195
PerlModOutputStream * m_stream
Definition: perlmodgen.cpp:190
virtual PerlModOutput::~PerlModOutput ( )
inlinevirtual

Definition at line 117 of file perlmodgen.cpp.

117 { }

Member Function Documentation

PerlModOutput& PerlModOutput::add ( char  c)
inline

Definition at line 134 of file perlmodgen.cpp.

134 { m_stream->add(c); return *this; }
PerlModOutputStream * m_stream
Definition: perlmodgen.cpp:190
void add(char c)
Definition: perlmodgen.cpp:65
PerlModOutput& PerlModOutput::add ( const char *  s)
inline

Definition at line 135 of file perlmodgen.cpp.

135 { m_stream->add(s); return *this; }
PerlModOutputStream * m_stream
Definition: perlmodgen.cpp:190
void add(char c)
Definition: perlmodgen.cpp:65
static QCString * s
Definition: config.cpp:1042
PerlModOutput& PerlModOutput::add ( QCString s)
inline

Definition at line 136 of file perlmodgen.cpp.

136 { m_stream->add(s); return *this; }
PerlModOutputStream * m_stream
Definition: perlmodgen.cpp:190
void add(char c)
Definition: perlmodgen.cpp:65
PerlModOutput& PerlModOutput::add ( int  n)
inline

Definition at line 137 of file perlmodgen.cpp.

137 { m_stream->add(n); return *this; }
PerlModOutputStream * m_stream
Definition: perlmodgen.cpp:190
std::void_t< T > n
void add(char c)
Definition: perlmodgen.cpp:65
PerlModOutput& PerlModOutput::add ( unsigned int  n)
inline

Definition at line 138 of file perlmodgen.cpp.

138 { m_stream->add(n); return *this; }
PerlModOutputStream * m_stream
Definition: perlmodgen.cpp:190
std::void_t< T > n
void add(char c)
Definition: perlmodgen.cpp:65
PerlModOutput& PerlModOutput::addField ( const char *  s)
inline

Definition at line 154 of file perlmodgen.cpp.

154 { iaddField(s); return *this; }
void iaddField(const char *)
Definition: perlmodgen.cpp:238
static QCString * s
Definition: config.cpp:1042
PerlModOutput& PerlModOutput::addFieldBoolean ( const char *  field,
bool  content 
)
inline

Definition at line 163 of file perlmodgen.cpp.

164  {
165  return addFieldQuotedString(field, content ? "yes" : "no");
166  }
PerlModOutput & addFieldQuotedString(const char *field, const char *content)
Definition: perlmodgen.cpp:159
PerlModOutput& PerlModOutput::addFieldQuotedChar ( const char *  field,
char  content 
)
inline

Definition at line 155 of file perlmodgen.cpp.

156  {
157  iaddFieldQuotedChar(field, content); return *this;
158  }
void iaddFieldQuotedChar(const char *, char)
Definition: perlmodgen.cpp:245
PerlModOutput& PerlModOutput::addFieldQuotedString ( const char *  field,
const char *  content 
)
inline

Definition at line 159 of file perlmodgen.cpp.

160  {
161  iaddFieldQuotedString(field, content); return *this;
162  }
void iaddFieldQuotedString(const char *, const char *)
Definition: perlmodgen.cpp:255
PerlModOutput& PerlModOutput::addQuoted ( const char *  s)
inline

Definition at line 140 of file perlmodgen.cpp.

140 { iaddQuoted(s); return *this; }
void iaddQuoted(const char *)
Definition: perlmodgen.cpp:228
static QCString * s
Definition: config.cpp:1042
PerlModOutput& PerlModOutput::close ( char  c = 0)
inline

Definition at line 152 of file perlmodgen.cpp.

152 { iclose(c); return *this; }
void iclose(char)
Definition: perlmodgen.cpp:276
PerlModOutput& PerlModOutput::closeHash ( )
inline

Definition at line 170 of file perlmodgen.cpp.

170 { close('}'); return *this; }
PerlModOutput & close(char c=0)
Definition: perlmodgen.cpp:152
PerlModOutput& PerlModOutput::closeList ( )
inline

Definition at line 168 of file perlmodgen.cpp.

168 { close(']'); return *this; }
PerlModOutput & close(char c=0)
Definition: perlmodgen.cpp:152
PerlModOutput& PerlModOutput::closeSave ( QCString s)
inline

Definition at line 122 of file perlmodgen.cpp.

122 { icloseSave(s); return *this; }
void icloseSave(QCString &)
Definition: perlmodgen.cpp:204
PerlModOutput& PerlModOutput::continueBlock ( )
inline

Definition at line 124 of file perlmodgen.cpp.

125  {
126  if (m_blockstart)
127  m_blockstart = false;
128  else
129  m_stream->add(',');
130  indent();
131  return *this;
132  }
PerlModOutput & indent()
Definition: perlmodgen.cpp:142
PerlModOutputStream * m_stream
Definition: perlmodgen.cpp:190
void add(char c)
Definition: perlmodgen.cpp:65
void PerlModOutput::decIndent ( )
protected

Definition at line 221 of file perlmodgen.cpp.

222 {
223  m_indentation--;
225  m_spaces[m_indentation * 2] = 0;
226 }
#define PERLOUTPUT_MAX_INDENTATION
Definition: perlmodgen.cpp:47
char m_spaces[PERLOUTPUT_MAX_INDENTATION *2+2]
Definition: perlmodgen.cpp:195
void PerlModOutput::iaddField ( const char *  s)
protected

Definition at line 238 of file perlmodgen.cpp.

239 {
240  continueBlock();
241  m_stream->add(s);
242  m_stream->add(m_pretty ? " => " : "=>");
243 }
PerlModOutputStream * m_stream
Definition: perlmodgen.cpp:190
PerlModOutput & continueBlock()
Definition: perlmodgen.cpp:124
void add(char c)
Definition: perlmodgen.cpp:65
static QCString * s
Definition: config.cpp:1042
void PerlModOutput::iaddFieldQuotedChar ( const char *  field,
char  content 
)
protected

Definition at line 245 of file perlmodgen.cpp.

246 {
247  iaddField(field);
248  m_stream->add('\'');
249  if ((content == '\'') || (content == '\\'))
250  m_stream->add('\\');
251  m_stream->add(content);
252  m_stream->add('\'');
253 }
PerlModOutputStream * m_stream
Definition: perlmodgen.cpp:190
void iaddField(const char *)
Definition: perlmodgen.cpp:238
void add(char c)
Definition: perlmodgen.cpp:65
void PerlModOutput::iaddFieldQuotedString ( const char *  field,
const char *  content 
)
protected

Definition at line 255 of file perlmodgen.cpp.

256 {
257  if (content == 0)
258  return;
259  iaddField(field);
260  m_stream->add('\'');
261  iaddQuoted(content);
262  m_stream->add('\'');
263 }
void iaddQuoted(const char *)
Definition: perlmodgen.cpp:228
PerlModOutputStream * m_stream
Definition: perlmodgen.cpp:190
void iaddField(const char *)
Definition: perlmodgen.cpp:238
void add(char c)
Definition: perlmodgen.cpp:65
void PerlModOutput::iaddQuoted ( const char *  s)
protected

Definition at line 228 of file perlmodgen.cpp.

229 {
230  char c;
231  while ((c = *s++) != 0) {
232  if ((c == '\'') || (c == '\\'))
233  m_stream->add('\\');
234  m_stream->add(c);
235  }
236 }
PerlModOutputStream * m_stream
Definition: perlmodgen.cpp:190
void add(char c)
Definition: perlmodgen.cpp:65
static QCString * s
Definition: config.cpp:1042
void PerlModOutput::iclose ( char  c)
protected

Definition at line 276 of file perlmodgen.cpp.

277 {
278  decIndent();
279  indent();
280  if (c != 0)
281  m_stream->add(c);
282  m_blockstart = false;
283 }
PerlModOutput & indent()
Definition: perlmodgen.cpp:142
PerlModOutputStream * m_stream
Definition: perlmodgen.cpp:190
void decIndent()
Definition: perlmodgen.cpp:221
void add(char c)
Definition: perlmodgen.cpp:65
void PerlModOutput::icloseSave ( QCString s)
protected

Definition at line 204 of file perlmodgen.cpp.

205 {
206  s = m_stream->m_s;
207  delete m_stream;
208  m_stream = m_saved.pop();
209 }
QStack< PerlModOutputStream > m_saved
Definition: perlmodgen.cpp:194
PerlModOutputStream * m_stream
Definition: perlmodgen.cpp:190
type * pop()
Definition: qstack.h:59
void PerlModOutput::incIndent ( )
protected

Definition at line 211 of file perlmodgen.cpp.

212 {
214  {
215  char *s = &m_spaces[m_indentation * 2];
216  *s++ = ' '; *s++ = ' '; *s = 0;
217  }
218  m_indentation++;
219 }
#define PERLOUTPUT_MAX_INDENTATION
Definition: perlmodgen.cpp:47
char m_spaces[PERLOUTPUT_MAX_INDENTATION *2+2]
Definition: perlmodgen.cpp:195
static QCString * s
Definition: config.cpp:1042
PerlModOutput& PerlModOutput::indent ( )
inline

Definition at line 142 of file perlmodgen.cpp.

143  {
144  if (m_pretty) {
145  m_stream->add('\n');
147  }
148  return *this;
149  }
char m_spaces[PERLOUTPUT_MAX_INDENTATION *2+2]
Definition: perlmodgen.cpp:195
PerlModOutputStream * m_stream
Definition: perlmodgen.cpp:190
void add(char c)
Definition: perlmodgen.cpp:65
void PerlModOutput::iopen ( char  c,
const char *  s 
)
protected

Definition at line 265 of file perlmodgen.cpp.

266 {
267  if (s != 0)
268  iaddField(s);
269  else
270  continueBlock();
271  m_stream->add(c);
272  incIndent();
273  m_blockstart = true;
274 }
void incIndent()
Definition: perlmodgen.cpp:211
PerlModOutputStream * m_stream
Definition: perlmodgen.cpp:190
PerlModOutput & continueBlock()
Definition: perlmodgen.cpp:124
void iaddField(const char *)
Definition: perlmodgen.cpp:238
void add(char c)
Definition: perlmodgen.cpp:65
static QCString * s
Definition: config.cpp:1042
void PerlModOutput::iopenSave ( )
protected

Definition at line 198 of file perlmodgen.cpp.

199 {
202 }
QStack< PerlModOutputStream > m_saved
Definition: perlmodgen.cpp:194
void push(const type *d)
Definition: qstack.h:58
PerlModOutputStream * m_stream
Definition: perlmodgen.cpp:190
PerlModOutput& PerlModOutput::open ( char  c,
const char *  s = 0 
)
inline

Definition at line 151 of file perlmodgen.cpp.

151 { iopen(c, s); return *this; }
static QCString * s
Definition: config.cpp:1042
void iopen(char, const char *)
Definition: perlmodgen.cpp:265
PerlModOutput& PerlModOutput::openHash ( const char *  s = 0)
inline

Definition at line 169 of file perlmodgen.cpp.

169 { open('{', s); return *this; }
PerlModOutput & open(char c, const char *s=0)
Definition: perlmodgen.cpp:151
static QCString * s
Definition: config.cpp:1042
PerlModOutput& PerlModOutput::openList ( const char *  s = 0)
inline

Definition at line 167 of file perlmodgen.cpp.

167 { open('[', s); return *this; }
PerlModOutput & open(char c, const char *s=0)
Definition: perlmodgen.cpp:151
static QCString * s
Definition: config.cpp:1042
PerlModOutput& PerlModOutput::openSave ( )
inline

Definition at line 121 of file perlmodgen.cpp.

121 { iopenSave(); return *this; }
void iopenSave()
Definition: perlmodgen.cpp:198
void PerlModOutput::setPerlModOutputStream ( PerlModOutputStream os)
inline

Definition at line 119 of file perlmodgen.cpp.

119 { m_stream = os; }
PerlModOutputStream * m_stream
Definition: perlmodgen.cpp:190

Member Data Documentation

bool PerlModOutput::m_blockstart
private

Definition at line 192 of file perlmodgen.cpp.

int PerlModOutput::m_indentation
private

Definition at line 191 of file perlmodgen.cpp.

bool PerlModOutput::m_pretty

Definition at line 109 of file perlmodgen.cpp.

QStack<PerlModOutputStream> PerlModOutput::m_saved
private

Definition at line 194 of file perlmodgen.cpp.

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

Definition at line 195 of file perlmodgen.cpp.

PerlModOutputStream* PerlModOutput::m_stream
private

Definition at line 190 of file perlmodgen.cpp.


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