Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
QhpXmlWriter Class Reference

#include <qhpxmlwriter.h>

Public Member Functions

 QhpXmlWriter ()
 
 ~QhpXmlWriter ()
 
void setIndentLevel (int level)
 
void setCompressionEnabled (bool enabled)
 
void insert (QhpXmlWriter const &source)
 
void dumpTo (QFile &file)
 
void open (char const *elementName, char const *const *attributes=0)
 
void openClose (char const *elementName, char const *const *attributes=0)
 
void openCloseContent (char const *elementName, char const *content)
 
void close (char const *elementName)
 
void declaration (char const *version, char const *encoding)
 

Static Public Member Functions

static char * dupEscaped (const char *source)
 

Private Member Functions

void indent ()
 
void newLine ()
 
void openPureHelper (char const *elementName, char const *const *attributes, bool close)
 
void openPure (char const *elementName, char const *const *attributes=0)
 
void openClosePure (char const *elementName, char const *const *attributes=0)
 
void closePure (char const *elementName)
 

Private Attributes

QGString m_backend
 
FTextStream m_out
 
int m_indentLevel
 
bool m_curLineIndented
 
bool m_compress
 

Detailed Description

Definition at line 25 of file qhpxmlwriter.h.

Constructor & Destructor Documentation

QhpXmlWriter::QhpXmlWriter ( )

Definition at line 22 of file qhpxmlwriter.cpp.

23  : m_out(&m_backend), m_indentLevel(0),
24  m_curLineIndented(false), m_compress(false)
25 {
26 }
bool m_curLineIndented
Definition: qhpxmlwriter.h:59
FTextStream m_out
Definition: qhpxmlwriter.h:57
QGString m_backend
Definition: qhpxmlwriter.h:56
QhpXmlWriter::~QhpXmlWriter ( )

Definition at line 28 of file qhpxmlwriter.cpp.

29 {
30 }

Member Function Documentation

void QhpXmlWriter::close ( char const *  elementName)

Definition at line 79 of file qhpxmlwriter.cpp.

80 {
81  m_indentLevel--;
82  indent();
83  closePure(elementName);
84  newLine();
85 }
void closePure(char const *elementName)
void QhpXmlWriter::closePure ( char const *  elementName)
private

Definition at line 153 of file qhpxmlwriter.cpp.

154 {
155  m_out << "</" << elementName << ">";
156 }
FTextStream m_out
Definition: qhpxmlwriter.h:57
void QhpXmlWriter::declaration ( char const *  version,
char const *  encoding 
)

Definition at line 87 of file qhpxmlwriter.cpp.

88 {
89  m_out << "<?xml version=\"" << version << "\" encoding=\"" << encoding << "\"?>";
90  newLine();
91 }
FTextStream m_out
Definition: qhpxmlwriter.h:57
static QCString encoding
Definition: config.cpp:1052
void QhpXmlWriter::dumpTo ( QFile file)

Definition at line 47 of file qhpxmlwriter.cpp.

48 {
50 }
char * data() const
Definition: qgstring.h:42
uint length() const
Definition: qgstring.h:40
int writeBlock(const char *data, uint len)
Definition: qfile_unix.cpp:537
QGString m_backend
Definition: qhpxmlwriter.h:56
static char* QhpXmlWriter::dupEscaped ( const char *  source)
static
void QhpXmlWriter::indent ( )
private

Definition at line 93 of file qhpxmlwriter.cpp.

94 {
96  {
97  return;
98  }
99  for (int i = 0; i < m_indentLevel; i++)
100  {
101  m_out << " ";
102  }
103  m_curLineIndented = true;
104 }
bool m_curLineIndented
Definition: qhpxmlwriter.h:59
FTextStream m_out
Definition: qhpxmlwriter.h:57
void QhpXmlWriter::insert ( QhpXmlWriter const &  source)

Definition at line 42 of file qhpxmlwriter.cpp.

43 {
44  m_out << source.m_backend.data();
45 }
FTextStream m_out
Definition: qhpxmlwriter.h:57
void QhpXmlWriter::newLine ( )
private

Definition at line 106 of file qhpxmlwriter.cpp.

107 {
108  if (!m_compress)
109  {
110  m_out << "\n";
111  m_curLineIndented = false;
112  }
113 }
bool m_curLineIndented
Definition: qhpxmlwriter.h:59
FTextStream m_out
Definition: qhpxmlwriter.h:57
void QhpXmlWriter::open ( char const *  elementName,
char const *const *  attributes = 0 
)

Definition at line 52 of file qhpxmlwriter.cpp.

54 {
55  indent();
56  openPure(elementName, attributes);
57  newLine();
58  m_indentLevel++;
59 }
void openPure(char const *elementName, char const *const *attributes=0)
void QhpXmlWriter::openClose ( char const *  elementName,
char const *const *  attributes = 0 
)

Definition at line 61 of file qhpxmlwriter.cpp.

63 {
64  indent();
65  openClosePure(elementName, attributes);
66  newLine();
67 }
void openClosePure(char const *elementName, char const *const *attributes=0)
void QhpXmlWriter::openCloseContent ( char const *  elementName,
char const *  content 
)

Definition at line 69 of file qhpxmlwriter.cpp.

71 {
72  indent();
73  openPure(elementName);
74  m_out << convertToXML(content);
75  closePure(elementName);
76  newLine();
77 }
QCString convertToXML(const char *s)
Definition: util.cpp:5717
void closePure(char const *elementName)
FTextStream m_out
Definition: qhpxmlwriter.h:57
void openPure(char const *elementName, char const *const *attributes=0)
void QhpXmlWriter::openClosePure ( char const *  elementName,
char const *const *  attributes = 0 
)
private

Definition at line 147 of file qhpxmlwriter.cpp.

149 {
150  openPureHelper(elementName, attributes, true);
151 }
void openPureHelper(char const *elementName, char const *const *attributes, bool close)
void QhpXmlWriter::openPure ( char const *  elementName,
char const *const *  attributes = 0 
)
private

Definition at line 141 of file qhpxmlwriter.cpp.

143 {
144  openPureHelper(elementName, attributes, false);
145 }
void openPureHelper(char const *elementName, char const *const *attributes, bool close)
void QhpXmlWriter::openPureHelper ( char const *  elementName,
char const *const *  attributes,
bool  close 
)
private

Definition at line 115 of file qhpxmlwriter.cpp.

117 {
118  m_out << "<" << elementName;
119  if (attributes)
120  {
121  for (char const * const * walker = attributes;
122  walker[0]; walker += 2)
123  {
124  char const * const key = walker[0];
125  char const * const value = walker[1];
126  if (!value)
127  {
128  continue;
129  }
130  m_out << " " << key << "=\"" << convertToXML(value) << "\"";
131  }
132  }
133 
134  if (close)
135  {
136  m_out << " /";
137  }
138  m_out << ">";
139 }
QCString convertToXML(const char *s)
Definition: util.cpp:5717
void close(char const *elementName)
FTextStream m_out
Definition: qhpxmlwriter.h:57
def key(type, name=None)
Definition: graph.py:13
void QhpXmlWriter::setCompressionEnabled ( bool  enabled)

Definition at line 37 of file qhpxmlwriter.cpp.

38 {
39  m_compress = enabled;
40 }
void QhpXmlWriter::setIndentLevel ( int  level)

Definition at line 32 of file qhpxmlwriter.cpp.

Member Data Documentation

QGString QhpXmlWriter::m_backend
private

Definition at line 56 of file qhpxmlwriter.h.

bool QhpXmlWriter::m_compress
private

Definition at line 60 of file qhpxmlwriter.h.

bool QhpXmlWriter::m_curLineIndented
private

Definition at line 59 of file qhpxmlwriter.h.

int QhpXmlWriter::m_indentLevel
private

Definition at line 58 of file qhpxmlwriter.h.

FTextStream QhpXmlWriter::m_out
private

Definition at line 57 of file qhpxmlwriter.h.


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