Chameleon

Chameleon Svn Source Tree

Root/branches/xZenu/src/util/doxygen/src/indexlog.cpp

Source at commit 1322 created 9 years 5 months ago.
By meklort, Add doxygen to utils folder
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#include "indexlog.h"
18#include "message.h"
19#include "config.h"
20
21#include <qstring.h>
22#include <qfile.h>
23
24
25IndexLog::IndexLog()
26{
27}
28
29IndexLog::~IndexLog()
30{
31}
32
33void IndexLog::initialize()
34{
35 char const * const attributes[] =
36 { "xmlns",
37 "http://doxygen.org/xmlns/indexlog/1/0/",
38 NULL
39 };
40 m_out.open("log", attributes);
41
42 openMethodCall("initialize");
43 closeMethodCall();
44}
45
46void IndexLog::finalize()
47{
48 openMethodCall("finalize");
49 closeMethodCall();
50 m_out.close("log");
51 QCString fileName = Config_getString("HTML_OUTPUT")+"/index.log.xml";
52 QFile file(fileName);
53 if (!file.open(IO_WriteOnly))
54 {
55 err("Could not open file %s for writing\n", fileName.data());
56 exit(1);
57 }
58 m_out.dumpTo(file);
59 file.flush();
60 file.close();
61}
62
63void IndexLog::incContentsDepth()
64{
65 openMethodCall("incContentsDepth");
66 closeMethodCall();
67}
68
69void IndexLog::decContentsDepth()
70{
71 openMethodCall("decContentsDepth");
72 closeMethodCall();
73}
74
75void IndexLog::addContentsItem(bool isDir, char const * name,
76 char const * ref, char const * file,
77 char const * anchor)
78{
79 openMethodCall("addContentsItem");
80 addBoolParameter("isDir", isDir);
81 addStringParameter("name", name);
82 addStringParameter("ref", ref);
83 addStringParameter("file", file);
84 addStringParameter("anchor", anchor);
85 closeMethodCall();
86}
87
88void IndexLog::addIndexItem(char const * level1, char const * level2,
89 char const * contRef, char const * memRef,
90 char const * anchor, const MemberDef * md)
91{
92 openMethodCall("addIndexItem");
93 addStringParameter("level1", level1);
94 addStringParameter("level2", level2);
95 addStringParameter("contRef", contRef);
96 addStringParameter("memRef", memRef);
97 addStringParameter("anchor", anchor);
98 addMemberDefParameter("md", md);
99 closeMethodCall();
100}
101
102void IndexLog::addIndexFile(char const * name)
103{
104 openMethodCall("addIndexFile");
105 addStringParameter("name", name);
106 closeMethodCall();
107}
108
109void IndexLog::openMethodCall(char const * methodName)
110{
111 m_out.setCompressionEnabled(true);
112 m_out.open("call");
113 m_out.openCloseContent("method", methodName);
114}
115
116void IndexLog::addPrimitiveParameter(char const * parameterName,
117 char const * value)
118{
119 m_out.open("param");
120 m_out.openCloseContent("name", parameterName);
121 if (value != NULL)
122 {
123 m_out.openCloseContent("value", value);
124 }
125 m_out.close("param");
126}
127
128void IndexLog::addBoolParameter(char const * parameterName, bool value)
129{
130 addPrimitiveParameter(parameterName, value ? "true" : "false");
131}
132
133void IndexLog::addStringParameter(char const * parameterName,
134 char const * value)
135{
136 addPrimitiveParameter(parameterName, value);
137}
138
139void IndexLog::addMemberDefParameter(char const * parameterName,
140 const MemberDef * /*value*/)
141{
142 m_out.open("param");
143 m_out.openCloseContent("name", parameterName);
144 m_out.close("param");
145}
146
147void IndexLog::closeMethodCall()
148{
149 m_out.setCompressionEnabled(false);
150 m_out.close("call");
151}
152
153

Archive Download this file

Revision: 1322