Fix for UBSan build
[platform/upstream/doxygen.git] / src / qhpxmlwriter.h
1 /*
2  * Copyright (C) 2008 by Sebastian Pipping.
3  * Copyright (C) 2008 Dimitri van Heesch.
4  *
5  * Permission to use, copy, modify, and distribute this software and its
6  * documentation under the terms of the GNU General Public License is hereby 
7  * granted. No representations are made about the suitability of this software 
8  * for any purpose. It is provided "as is" without express or implied warranty.
9  * See the GNU General Public License for more details.
10  *
11  * Documents produced by Doxygen are derivative works derived from the
12  * input used in their production; they are not affected by this license.
13  *
14  * Sebastian Pipping <sebastian@pipping.org>
15  */
16
17 #ifndef QHPXMLWRITER_H
18 #define QHPXMLWRITER_H
19
20 #include <qstring.h>
21 #include "ftextstream.h"
22
23 class QFile;
24
25 class QhpXmlWriter
26 {
27   public:
28     QhpXmlWriter();
29    ~QhpXmlWriter();
30
31     void setIndentLevel(int level);
32     void setCompressionEnabled(bool enabled);
33     void insert(QhpXmlWriter const & source);
34     void dumpTo(QFile & file);
35     void open(char const * elementName,
36               char const * const * attributes = 0);
37     void openClose(char const * elementName,
38                    char const * const * attributes = 0);
39     void openCloseContent(char const * elementName, char const * content);
40     void close(char const * elementName);
41
42     static char * dupEscaped(const char * source);
43
44   private:
45     void indent();
46     void newLine();
47     void openPureHelper(char const * elementName,
48                         char const * const * attributes, bool close);
49     void openPure(char const * elementName,
50                   char const * const * attributes = 0);
51     void openClosePure(char const * elementName,
52                        char const * const * attributes = 0);
53     void closePure(char const * elementName);
54
55     QGString m_backend;
56     FTextStream m_out;
57     int  m_indentLevel;
58     bool m_curLineIndented;
59     bool m_compress;
60
61 };
62
63 #endif // QHPXMLWRITER_H