author | Michel Szarindar <Michel.Szarindar@Nokia.com> |
Thu, 18 Mar 2010 18:26:18 +0000 | |
changeset 1 | 82f11024044a |
parent 0 | 42188c7ea2d9 |
permissions | -rw-r--r-- |
1
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
1 |
/****************************************************************************** |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
2 |
* |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
3 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
4 |
* |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
5 |
* Permission to use, copy, modify, and distribute this software and its |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
6 |
* documentation under the terms of the GNU General Public License is hereby |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
7 |
* granted. No representations are made about the suitability of this software |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
8 |
* for any purpose. It is provided "as is" without express or implied warranty. |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
9 |
* See the GNU General Public License for more details. |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
10 |
* |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
11 |
*/ |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
12 |
|
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
13 |
|
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
14 |
|
0
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
15 |
#include "xmlwriter.h" |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
16 |
#include "message.h" |
1
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
17 |
#include "xmldita.h" |
0
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
18 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
19 |
char ILLEGAL_UNICODE_REPLACEMENT = ' '; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
20 |
/******************** XmlStream ********************/ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
21 |
XmlStream::XmlStream(const QString &fileName, const QString &aEncoding, const QString &aStandalone, const QString &doctypeStr) : mFile(fileName), \ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
22 |
mStreamP(0), \ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
23 |
mElemStack(), \ |
1
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
24 |
mInElement(false) |
0
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
25 |
{ |
1
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
26 |
mCanIndentList.setAutoDelete(true); |
0
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
27 |
mIsOpen = mFile.open(IO_WriteOnly); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
28 |
if (mIsOpen) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
29 |
mStreamP = new QTextStream(&mFile); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
30 |
if (aEncoding == "UTF-8") { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
31 |
mStreamP->setEncoding(QTextStream::UnicodeUTF8); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
32 |
} else if(aEncoding == "Latin1") { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
33 |
mStreamP->setEncoding(QTextStream::Latin1); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
34 |
} else if(aEncoding == "ISO-8859-1") { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
35 |
mStreamP->setEncoding(QTextStream::Latin1); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
36 |
} else { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
37 |
// No specific encoding set |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
38 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
39 |
*mStreamP << "<?xml version='1.0' encoding='" << aEncoding << "' standalone='" << aStandalone << "'?>"; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
40 |
if (doctypeStr.length() > 0) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
41 |
*mStreamP << "\n<!DOCTYPE " << doctypeStr << ">"; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
42 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
43 |
} else { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
44 |
mStreamP = 0; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
45 |
err("Cannot open file %s for writing!\n", fileName.data()); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
46 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
47 |
// Allow output |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
48 |
outputResume(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
49 |
/// Build text -> unicode map |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
50 |
unicodeCharTable.insert("copy", "A9"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
51 |
unicodeCharTable.insert("trade", "2122"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
52 |
unicodeCharTable.insert("reg", "AE"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
53 |
unicodeCharTable.insert("lsquo", "60"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
54 |
unicodeCharTable.insert("rsquo", "B4"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
55 |
unicodeCharTable.insert("ldquo", "201C"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
56 |
unicodeCharTable.insert("rdquo", "201D"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
57 |
unicodeCharTable.insert("ndash", "2013"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
58 |
unicodeCharTable.insert("mdash", "2014"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
59 |
unicodeCharTable.insert("Auml", "C4"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
60 |
unicodeCharTable.insert("Euml", "CB"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
61 |
unicodeCharTable.insert("Iuml", "CF"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
62 |
unicodeCharTable.insert("Ouml", "F6"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
63 |
unicodeCharTable.insert("Uuml", "FC"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
64 |
unicodeCharTable.insert("Yuml", "178"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
65 |
unicodeCharTable.insert("auml", "E4"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
66 |
unicodeCharTable.insert("euml", "EB"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
67 |
unicodeCharTable.insert("iuml", "EF"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
68 |
unicodeCharTable.insert("ouml", "F6"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
69 |
unicodeCharTable.insert("uuml", "FC"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
70 |
unicodeCharTable.insert("yuml", "FF"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
71 |
unicodeCharTable.insert("Aacute", "C1"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
72 |
unicodeCharTable.insert("Eacute", "C9"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
73 |
unicodeCharTable.insert("Iacute", "CD"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
74 |
unicodeCharTable.insert("Oacute", "D3"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
75 |
unicodeCharTable.insert("Uacute", "DA"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
76 |
unicodeCharTable.insert("Yacute", "DD"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
77 |
unicodeCharTable.insert("aacute", "E1"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
78 |
unicodeCharTable.insert("eacute", "E9"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
79 |
unicodeCharTable.insert("iacute", "ED"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
80 |
unicodeCharTable.insert("oacute", "F3"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
81 |
unicodeCharTable.insert("uacute", "FA"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
82 |
unicodeCharTable.insert("yacute", "FD"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
83 |
unicodeCharTable.insert("Agrave", "C0"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
84 |
unicodeCharTable.insert("Egrave", "C8"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
85 |
unicodeCharTable.insert("Igrave", "CC"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
86 |
unicodeCharTable.insert("Ograve", "D2"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
87 |
unicodeCharTable.insert("Ugrave", "F9"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
88 |
unicodeCharTable.insert("agrave", "E0"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
89 |
unicodeCharTable.insert("egrave", "E8"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
90 |
unicodeCharTable.insert("igrave", "EC"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
91 |
unicodeCharTable.insert("ograve", "F2"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
92 |
unicodeCharTable.insert("ugrave", "F9"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
93 |
//unicodeCharTable.insert("ygrave", ""); In doxygen documentation but code unknown or doesn't exist |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
94 |
unicodeCharTable.insert("Acirc", "C2"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
95 |
unicodeCharTable.insert("Ecirc", "CA"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
96 |
unicodeCharTable.insert("Icirc", "CE"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
97 |
unicodeCharTable.insert("Ocirc", "D4"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
98 |
unicodeCharTable.insert("Ucirc", "DB"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
99 |
unicodeCharTable.insert("acirc", "E2"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
100 |
unicodeCharTable.insert("ecirc", "EA"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
101 |
unicodeCharTable.insert("icirc", "EE"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
102 |
unicodeCharTable.insert("ocirc", "F4"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
103 |
unicodeCharTable.insert("ucirc", "FB"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
104 |
//unicodeCharTable.insert("ycirc", ""); In doxygen documentation but code unknown or doesn't exist |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
105 |
unicodeCharTable.insert("Atilde", "C3"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
106 |
unicodeCharTable.insert("Ntilde", "D1"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
107 |
unicodeCharTable.insert("Otilde", "D5"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
108 |
unicodeCharTable.insert("atilde", "E3"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
109 |
unicodeCharTable.insert("ntilde", "F1"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
110 |
unicodeCharTable.insert("otilde", "F5"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
111 |
unicodeCharTable.insert("szlig", "DF"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
112 |
unicodeCharTable.insert("Ccedil", "C7"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
113 |
unicodeCharTable.insert("ccedil", "E7"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
114 |
unicodeCharTable.insert("Aring", "C5"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
115 |
unicodeCharTable.insert("aring", "E5"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
116 |
unicodeCharTable.insert("Oslash", "D8"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
117 |
unicodeCharTable.insert("oslash", "F8"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
118 |
unicodeCharTable.insert("nbsp", "A0"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
119 |
unicodeCharTable.insert("AElig", "C6"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
120 |
unicodeCharTable.insert("aelig", "E6"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
121 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
122 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
123 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
124 |
void XmlStream::startElement(const QString& aElemName, const AttributeMap& aAttrs) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
125 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
126 |
if (mStreamP && mIsOpen && mCanWrite) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
127 |
if (mInElement) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
128 |
// Close existing element |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
129 |
*mStreamP << ">"; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
130 |
} else { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
131 |
mInElement = true; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
132 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
133 |
indent(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
134 |
// Write element name |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
135 |
*mStreamP << "<" << aElemName; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
136 |
// Attributes in sorted order |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
137 |
AttributeMapIter it = aAttrs.begin(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
138 |
while (it != aAttrs.end()){ |
1
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
139 |
QString attrVal = encodeText(it.data()); |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
140 |
#ifdef DITA_OT_BUG_ATTRIBUTE_VALUE_HACK |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
141 |
// DITA Open Toolkit error, it fails to re-encode files properly |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
142 |
// Replace "<" with "&lt;" |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
143 |
// Replace ">" with "&gt;" |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
144 |
int fIdx = 0; |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
145 |
QString toFind; |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
146 |
QString toReplace; |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
147 |
toFind = "<"; |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
148 |
toReplace = "&lt;"; |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
149 |
fIdx = attrVal.find(toFind, 0); |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
150 |
while (fIdx != -1) { |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
151 |
attrVal.replace(fIdx, toFind.length(), toReplace); |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
152 |
fIdx = attrVal.find(toFind, 0); |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
153 |
} |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
154 |
toFind = ">"; |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
155 |
toReplace = "&gt;"; |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
156 |
fIdx = attrVal.find(toFind, 0); |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
157 |
while (fIdx != -1) { |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
158 |
attrVal.replace(fIdx, toFind.length(), toReplace); |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
159 |
fIdx = attrVal.find(toFind, 0); |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
160 |
} |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
161 |
#endif |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
162 |
*mStreamP << " " << it.key() << "=\"" << attrVal << "\""; |
0
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
163 |
++it; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
164 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
165 |
// Update internals |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
166 |
mInElement = true; |
1
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
167 |
//mCanIndent = true; |
0
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
168 |
mElemStack.push(&aElemName); |
1
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
169 |
mCanIndentList.append(new bool(true)); |
0
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
170 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
171 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
172 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
173 |
void XmlStream::characters(const QString& aText) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
174 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
175 |
// If this test was not here then if passed an empty string the stream |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
176 |
// will end up writing <Element></Element> rather than <Element/> |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
177 |
if (aText.length() > 0) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
178 |
if (mStreamP && mIsOpen && mCanWrite) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
179 |
closeElementDeclIfOpen(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
180 |
*mStreamP << encodeText(aText); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
181 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
182 |
// Don't indent mixed content |
1
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
183 |
//mCanIndent = false; |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
184 |
setLastIndent(false); |
0
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
185 |
} |
1
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
186 |
#ifdef DITA_TRACE |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
187 |
#ifdef DITA_TRACE_TO_XML |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
188 |
// Useful for assertion crashes where otherwise the buffer would be lost |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
189 |
flush(*mStreamP); |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
190 |
#endif |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
191 |
#endif |
0
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
192 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
193 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
194 |
void XmlStream::characters(char c) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
195 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
196 |
if (mStreamP && mIsOpen && mCanWrite) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
197 |
closeElementDeclIfOpen(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
198 |
if (isLegalXmlChar(c)) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
199 |
if (mustEncodeChar(c)) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
200 |
*mStreamP << encodeChar(c); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
201 |
} else { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
202 |
*mStreamP << c; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
203 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
204 |
} else { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
205 |
*mStreamP << ILLEGAL_UNICODE_REPLACEMENT; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
206 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
207 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
208 |
// Don't indent mixed content |
1
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
209 |
//mCanIndent = false; |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
210 |
setLastIndent(false); |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
211 |
#ifdef DITA_TRACE |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
212 |
#ifdef DITA_TRACE_TO_XML |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
213 |
// Useful for assertion crashes where otherwise the buffer would be lost |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
214 |
flush(*mStreamP); |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
215 |
#endif |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
216 |
#endif |
0
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
217 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
218 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
219 |
XmlStream& XmlStream::operator<<(const QCString& s) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
220 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
221 |
characters(s); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
222 |
return *this; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
223 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
224 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
225 |
XmlStream& XmlStream::operator<<(const char* s) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
226 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
227 |
characters(s); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
228 |
return *this; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
229 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
230 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
231 |
XmlStream& XmlStream::operator<<(char c) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
232 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
233 |
characters(c); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
234 |
return *this; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
235 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
236 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
237 |
XmlStream& XmlStream::writeUnicode(const QCString& s) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
238 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
239 |
if (mStreamP && mIsOpen && mCanWrite) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
240 |
closeElementDeclIfOpen(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
241 |
if (unicodeCharTable.find(s)) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
242 |
*mStreamP << "&#x"; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
243 |
*mStreamP << unicodeCharTable[s]; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
244 |
*mStreamP << ";"; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
245 |
} else { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
246 |
// Write a warning as a comment |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
247 |
QString cmtTxt = "Can not write Unicode for Doxygen interpreted symbol: \""; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
248 |
cmtTxt += s; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
249 |
cmtTxt += "\""; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
250 |
comment(cmtTxt); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
251 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
252 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
253 |
// Don't indent mixed content |
1
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
254 |
//mCanIndent = false; |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
255 |
setLastIndent(false); |
0
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
256 |
return *this; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
257 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
258 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
259 |
void XmlStream::processingInstruction(const QString& aText) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
260 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
261 |
if (mStreamP && mIsOpen && mCanWrite) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
262 |
closeElementDeclIfOpen(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
263 |
*mStreamP << "<?" << aText << "?>"; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
264 |
} |
1
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
265 |
//mCanIndent = true; |
0
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
266 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
267 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
268 |
void XmlStream::comment(const QString& aText) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
269 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
270 |
if (mStreamP && mIsOpen && mCanWrite) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
271 |
closeElementDeclIfOpen(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
272 |
*mStreamP << "<!-- " << aText << " -->"; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
273 |
} |
1
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
274 |
//mCanIndent = true; |
0
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
275 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
276 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
277 |
void XmlStream::endElement(const QString& aElemName) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
278 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
279 |
if (mStreamP && mIsOpen && mCanWrite) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
280 |
if (mInElement) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
281 |
// Use minimal form |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
282 |
*mStreamP << "/>"; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
283 |
mInElement = false; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
284 |
mElemStack.pop(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
285 |
} else { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
286 |
indent(1); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
287 |
*mStreamP << "</" << *(mElemStack.pop()) << ">"; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
288 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
289 |
} |
1
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
290 |
mCanIndentList.removeLast(); |
0
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
291 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
292 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
293 |
void XmlStream::closeElementDeclIfOpen() |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
294 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
295 |
if (mStreamP && mIsOpen && mCanWrite) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
296 |
if (mInElement) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
297 |
*mStreamP << ">"; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
298 |
mInElement = false; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
299 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
300 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
301 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
302 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
303 |
void XmlStream::indent(unsigned int aInitVal) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
304 |
{ |
1
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
305 |
if (mStreamP && mIsOpen && canIndent() && mCanWrite) { |
0
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
306 |
*mStreamP << XML_OUTPUT_ENDL; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
307 |
for (unsigned int i = aInitVal; i < mElemStack.count(); i++) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
308 |
*mStreamP << XML_INDENT; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
309 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
310 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
311 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
312 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
313 |
/** Returns 1 if the character is in the legal unicode range |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
314 |
See: http://www.w3.org/TR/REC-xml/#charsets |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
315 |
*/ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
316 |
inline bool XmlStream::isLegalXmlChar(QChar c) const |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
317 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
318 |
ushort u = c.unicode(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
319 |
//printf("XmlStream::isLegalXmlChar() testing 0x%X\n", u); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
320 |
// This is what the code should be: |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
321 |
/* |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
322 |
bool result = (u == 0x09 || u == 0x0A || u == 0x0D || \ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
323 |
((u >= 0x20) && (u <= 0xD7FF)) || \ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
324 |
((u >= 0xE000) && (u <= 0xFFFD)) \ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
325 |
); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
326 |
*/ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
327 |
// An this is the kludge that prevents weird characters (e.g. 0xA0) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
328 |
// that appear in the source code from getting into the XML. |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
329 |
bool result = (u == 0x09 || u == 0x0A || u == 0x0D || \ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
330 |
((u >= 0x20) && (u <= 0x7F)) \ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
331 |
); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
332 |
if (!result) { |
1
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
333 |
msg("XmlStream::isLegalXmlChar() rejecting 0x%X\n", u); |
0
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
334 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
335 |
return result; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
336 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
337 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
338 |
QString XmlStream::encodeText(const QString& aStr) const |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
339 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
340 |
QCString result; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
341 |
//printf("XmlStream::encodeText() encoding \"%s\"\n", aStr.data()); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
342 |
for (unsigned int i=0; i < aStr.length(); ++i) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
343 |
if (isLegalXmlChar(aStr[i])) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
344 |
char c = aStr[i]; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
345 |
if (mustEncodeChar(c)) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
346 |
result += encodeChar(c); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
347 |
} else { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
348 |
result += c; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
349 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
350 |
} else { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
351 |
result += ILLEGAL_UNICODE_REPLACEMENT; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
352 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
353 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
354 |
return result; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
355 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
356 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
357 |
/** Converts a char to a QString using XML entity transformaiton */ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
358 |
QString XmlStream::encodeChar(char c) const |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
359 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
360 |
switch (c) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
361 |
case '<': return QString("<"); break; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
362 |
case '>': return QString(">"); break; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
363 |
case '&': return QString("&"); break; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
364 |
case '\'': return QString("'"); break; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
365 |
case '"': return QString("""); break; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
366 |
default: |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
367 |
QString s; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
368 |
s += c; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
369 |
return s; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
370 |
break; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
371 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
372 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
373 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
374 |
/** Returns true if a char needs to be converted using XML entity transformaiton */ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
375 |
bool XmlStream::mustEncodeChar(char c) const |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
376 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
377 |
switch (c) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
378 |
// Note fall through |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
379 |
case '<': |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
380 |
case '>': |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
381 |
case '&': |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
382 |
case '\'': |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
383 |
case '"': |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
384 |
return true; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
385 |
break; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
386 |
default: |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
387 |
break; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
388 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
389 |
return false; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
390 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
391 |
|
1
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
392 |
bool XmlStream::canIndent() |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
393 |
{ |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
394 |
bool *bP; |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
395 |
for (bP = mCanIndentList.first(); bP != 0; bP = mCanIndentList.next()) { |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
396 |
if (!*bP) { |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
397 |
return false; |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
398 |
} |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
399 |
} |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
400 |
return true; |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
401 |
} |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
402 |
|
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
403 |
void XmlStream::setLastIndent(bool theB) |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
404 |
{ |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
405 |
mCanIndentList.removeLast(); |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
406 |
mCanIndentList.append(new bool(theB)); |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
407 |
} |
82f11024044a
Contribution of a new version of ORB and CXX DITA plug-in bug 1461 bug 1621 bug 1962
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
0
diff
changeset
|
408 |
|
0
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
409 |
/// Suspend output |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
410 |
void XmlStream::outputSuspend() |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
411 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
412 |
mCanWrite = false; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
413 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
414 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
415 |
/// Resume output |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
416 |
void XmlStream::outputResume() |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
417 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
418 |
mCanWrite = true; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
419 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
420 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
421 |
void XmlStream::close() |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
422 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
423 |
if (mStreamP) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
424 |
// Ignore mCanWrite |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
425 |
outputResume(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
426 |
closeElementDeclIfOpen(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
427 |
while(mElemStack.count()){ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
428 |
endElement(mElemStack[mElemStack.count()-1]); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
429 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
430 |
// Delete the stream and close the file |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
431 |
delete mStreamP; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
432 |
mStreamP = 0; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
433 |
mFile.close(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
434 |
mIsOpen = false; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
435 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
436 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
437 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
438 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
439 |
XmlStream::~XmlStream() |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
440 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
441 |
try { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
442 |
close(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
443 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
444 |
catch(...) {} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
445 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
446 |
/******************** END: XmlStream ********************/ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
447 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
448 |
/******************** XmlElement ********************/ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
449 |
XmlElement::XmlElement(XmlStream& aStream, const QString& aElemName) : mStream(aStream), mElemName(aElemName) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
450 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
451 |
AttributeMap attrs; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
452 |
mStream.startElement(mElemName, attrs); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
453 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
454 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
455 |
XmlElement::XmlElement(XmlStream& aStream, const QString& aElemName, const QString& aAttr, const QString& aAttrValue) : mStream(aStream), mElemName(aElemName) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
456 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
457 |
AttributeMap attrs; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
458 |
attrs[aAttr] = aAttrValue; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
459 |
mStream.startElement(mElemName, attrs); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
460 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
461 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
462 |
XmlElement::XmlElement(XmlStream& aStream, const QString& aElemName, const QString& aAttr, char aAttrValue) : mStream(aStream), mElemName(aElemName) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
463 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
464 |
AttributeMap attrs; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
465 |
attrs[aAttr] = QChar(aAttrValue); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
466 |
mStream.startElement(mElemName, attrs); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
467 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
468 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
469 |
XmlElement::XmlElement(XmlStream& aStream, const QString& aElemName, AttributeMap& aAttrs) : mStream(aStream), mElemName(aElemName) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
470 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
471 |
mStream.startElement(mElemName, aAttrs); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
472 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
473 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
474 |
/* |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
475 |
// Parse an attribute string of the form "attr_0=value_0 attr_1=value_1" |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
476 |
XmlElement::XmlElement(XmlStream& aStream, const QString& aElemName, const QString& aAttrString) : mStream(aStream), mElemName(aElemName) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
477 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
478 |
AttributeMap attrMap; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
479 |
QString myStr = aAttrString.simplifyWhiteSpace(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
480 |
int s = 0; // Index of start of attr |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
481 |
int e = 0; // Index of '=' |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
482 |
int v = 0; // Index of end of value |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
483 |
while (s < (int) myStr.length()) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
484 |
e = s; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
485 |
v = s; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
486 |
e = myStr.find('=', s); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
487 |
if (e == -1) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
488 |
break; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
489 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
490 |
v = myStr.find(' ', s); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
491 |
if (v == -1) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
492 |
v = myStr.length(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
493 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
494 |
attrMap[myStr.mid(s, e-s)] = myStr.mid(e+1, v-(e+1)); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
495 |
s = v+1; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
496 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
497 |
mStream.startElement(mElemName, attrMap); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
498 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
499 |
*/ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
500 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
501 |
XmlElement::~XmlElement() |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
502 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
503 |
try { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
504 |
mStream.endElement(mElemName); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
505 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
506 |
catch(...) {} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
507 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
508 |
/******************** END: XmlElement ********************/ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
509 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
510 |
/******************** XmlElementStack ********************/ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
511 |
XmlElementStack::XmlElementStack(XmlStream& aStream) : mStream(aStream) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
512 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
513 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
514 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
515 |
void XmlElementStack::push(const QString& aElementName) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
516 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
517 |
mElemStack.push(new XmlElement(mStream, aElementName)); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
518 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
519 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
520 |
void XmlElementStack::push(const QString& aElementName, const QString& aAttr, const QString& aAttrValue) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
521 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
522 |
mElemStack.push(new XmlElement(mStream, aElementName, aAttr, aAttrValue)); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
523 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
524 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
525 |
void XmlElementStack::push(const QString& aElementName, AttributeMap& aAttrs) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
526 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
527 |
mElemStack.push(new XmlElement(mStream, aElementName, aAttrs)); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
528 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
529 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
530 |
void XmlElementStack::pop(const QString &aElementName) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
531 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
532 |
XmlElement *pElem = mElemStack.pop(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
533 |
if (pElem->getElemName() != aElementName) { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
534 |
err(pElem->getElemName() + " is not equal to " + aElementName +"\n"); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
535 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
536 |
ASSERT(pElem->getElemName() == aElementName); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
537 |
delete pElem; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
538 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
539 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
540 |
void XmlElementStack::pop() |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
541 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
542 |
XmlElement *pElem = mElemStack.pop(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
543 |
delete pElem; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
544 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
545 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
546 |
void XmlElementStack::pushpop(const QString &aElementName) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
547 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
548 |
mElemStack.push(new XmlElement(mStream, aElementName)); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
549 |
pop(aElementName); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
550 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
551 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
552 |
void XmlElementStack::pushpop(const QString &aElementName, const QString& aText) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
553 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
554 |
mElemStack.push(new XmlElement(mStream, aElementName)); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
555 |
mStream.characters(aText); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
556 |
pop(aElementName); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
557 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
558 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
559 |
bool XmlElementStack::isEmpty() const |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
560 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
561 |
return mElemStack.isEmpty(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
562 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
563 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
564 |
const XmlElement& XmlElementStack::peek() const |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
565 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
566 |
return *mElemStack.top(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
567 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
568 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
569 |
void XmlElementStack::addAttribute(const QString &name, const QString &value) |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
570 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
571 |
XmlElement *pElem = mElemStack.pop(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
572 |
QString elemenName = pElem->getElemName(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
573 |
delete pElem; |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
574 |
XmlElement *elem = new XmlElement(mStream, elemenName, name, value); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
575 |
mElemStack.push(elem); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
576 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
577 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
578 |
void XmlElementStack::close() |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
579 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
580 |
while(mElemStack.count()){ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
581 |
pop(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
582 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
583 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
584 |
|
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
585 |
XmlElementStack::~XmlElementStack() |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
586 |
{ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
587 |
try { |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
588 |
close(); |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
589 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
590 |
catch(...) {} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
591 |
} |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
592 |
/******************** END: XmlElementStack ********************/ |
42188c7ea2d9
Initial contribution of ORB delivering Feature bug 1460
szarinda <>
parents:
diff
changeset
|
593 |