author | zecke <zecke> | 2004-09-10 11:09:28 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-09-10 11:09:28 (UTC) |
commit | e64d9e9682e0afefc4fbebe7ba9737e0f86e3ed7 (patch) (unidiff) | |
tree | b3a931b24a7ad2f22ae8c774b0fc2e9eb69c0934 | |
parent | d7743f52d37979b3a3f95e8e85fdaad742e1f3c1 (diff) | |
download | opie-e64d9e9682e0afefc4fbebe7ba9737e0f86e3ed7.zip opie-e64d9e9682e0afefc4fbebe7ba9737e0f86e3ed7.tar.gz opie-e64d9e9682e0afefc4fbebe7ba9737e0f86e3ed7.tar.bz2 |
Fix warnings of '//' inside the comment
-rw-r--r-- | library/backend/stringutil.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/library/backend/stringutil.cpp b/library/backend/stringutil.cpp index b5fbd3e..f1ad1b9 100644 --- a/library/backend/stringutil.cpp +++ b/library/backend/stringutil.cpp | |||
@@ -1,414 +1,414 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include <qtopia/stringutil.h> | 21 | #include <qtopia/stringutil.h> |
22 | #include <qregexp.h> | 22 | #include <qregexp.h> |
23 | #include <qstringlist.h> | 23 | #include <qstringlist.h> |
24 | 24 | ||
25 | namespace Qtopia | 25 | namespace Qtopia |
26 | { | 26 | { |
27 | 27 | ||
28 | 28 | ||
29 | 29 | ||
30 | /* | 30 | /* |
31 | Very, very simple Latin-1 only collation guaranteed to displease anyone | 31 | Very, very simple Latin-1 only collation guaranteed to displease anyone |
32 | who actually uses the non-ASCII characters. | 32 | who actually uses the non-ASCII characters. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | static const char collationHack[] = { | 35 | static const char collationHack[] = { |
36 | 0x00, //C-@ | 36 | 0x00, //C-@ |
37 | 0x01, //C-A | 37 | 0x01, //C-A |
38 | 0x02, //C-B | 38 | 0x02, //C-B |
39 | 0x03, //C-C | 39 | 0x03, //C-C |
40 | 0x04, //C-D | 40 | 0x04, //C-D |
41 | 0x05, //C-E | 41 | 0x05, //C-E |
42 | 0x06, //C-F | 42 | 0x06, //C-F |
43 | 0x07, //C-G | 43 | 0x07, //C-G |
44 | 0x08, //C-H | 44 | 0x08, //C-H |
45 | 0x09, //C-I | 45 | 0x09, //C-I |
46 | 0x0a, //C-J | 46 | 0x0a, //C-J |
47 | 0x0b, //C-K | 47 | 0x0b, //C-K |
48 | 0x0c, //C-L | 48 | 0x0c, //C-L |
49 | 0x0d, //C-M | 49 | 0x0d, //C-M |
50 | 0x0e, //C-N | 50 | 0x0e, //C-N |
51 | 0x0f, //C-O | 51 | 0x0f, //C-O |
52 | 0x10, //C-P | 52 | 0x10, //C-P |
53 | 0x11, //C-Q | 53 | 0x11, //C-Q |
54 | 0x12, //C-R | 54 | 0x12, //C-R |
55 | 0x13, //C-S | 55 | 0x13, //C-S |
56 | 0x14, //C-T | 56 | 0x14, //C-T |
57 | 0x15, //C-U | 57 | 0x15, //C-U |
58 | 0x16, //C-V | 58 | 0x16, //C-V |
59 | 0x17, //C-W | 59 | 0x17, //C-W |
60 | 0x18, //C-X | 60 | 0x18, //C-X |
61 | 0x19, //C-Y | 61 | 0x19, //C-Y |
62 | 0x1a, //C-Z | 62 | 0x1a, //C-Z |
63 | 0x1b, //C-[ | 63 | 0x1b, //C-[ |
64 | 0x1c, //C-\ | 64 | 0x1c, /* C-\ */ |
65 | 0x1d, //C-] | 65 | 0x1d, //C-] |
66 | 0x1e, //C-^ | 66 | 0x1e, //C-^ |
67 | 0x1f, //C-_ | 67 | 0x1f, //C-_ |
68 | ' ', // | 68 | ' ', // |
69 | '!', //! | 69 | '!', //! |
70 | '"', //" | 70 | '"', //" |
71 | '#', //# | 71 | '#', //# |
72 | '$', //$ | 72 | '$', //$ |
73 | '%', //% | 73 | '%', //% |
74 | '&', //& | 74 | '&', //& |
75 | '\'', //' | 75 | '\'', //' |
76 | '(', //( | 76 | '(', //( |
77 | ')', //) | 77 | ')', //) |
78 | '*', //* | 78 | '*', //* |
79 | '+', //+ | 79 | '+', //+ |
80 | ',', //, | 80 | ',', //, |
81 | '-', //- | 81 | '-', //- |
82 | '.', //. | 82 | '.', //. |
83 | '/', /// | 83 | '/', /// |
84 | 0x80, //0 | 84 | 0x80, //0 |
85 | 0x81, //1 | 85 | 0x81, //1 |
86 | 0x82, //2 | 86 | 0x82, //2 |
87 | 0x83, //3 | 87 | 0x83, //3 |
88 | 0x84, //4 | 88 | 0x84, //4 |
89 | 0x85, //5 | 89 | 0x85, //5 |
90 | 0x86, //6 | 90 | 0x86, //6 |
91 | 0x87, //7 | 91 | 0x87, //7 |
92 | 0x88, //8 | 92 | 0x88, //8 |
93 | 0x89, //9 | 93 | 0x89, //9 |
94 | ':', //: | 94 | ':', //: |
95 | ';', //; | 95 | ';', //; |
96 | '<', //< | 96 | '<', //< |
97 | '=', //= | 97 | '=', //= |
98 | '>', //> | 98 | '>', //> |
99 | '?', //? | 99 | '?', //? |
100 | '@', //@ | 100 | '@', //@ |
101 | 'A', //A | 101 | 'A', //A |
102 | 'B', //B | 102 | 'B', //B |
103 | 'C', //C | 103 | 'C', //C |
104 | 'D', //D | 104 | 'D', //D |
105 | 'E', //E | 105 | 'E', //E |
106 | 'F', //F | 106 | 'F', //F |
107 | 'G', //G | 107 | 'G', //G |
108 | 'H', //H | 108 | 'H', //H |
109 | 'I', //I | 109 | 'I', //I |
110 | 'J', //J | 110 | 'J', //J |
111 | 'K', //K | 111 | 'K', //K |
112 | 'L', //L | 112 | 'L', //L |
113 | 'M', //M | 113 | 'M', //M |
114 | 'N', //N | 114 | 'N', //N |
115 | 'O', //O | 115 | 'O', //O |
116 | 'P', //P | 116 | 'P', //P |
117 | 'Q', //Q | 117 | 'Q', //Q |
118 | 'R', //R | 118 | 'R', //R |
119 | 'S', //S | 119 | 'S', //S |
120 | 'T', //T | 120 | 'T', //T |
121 | 'U', //U | 121 | 'U', //U |
122 | 'V', //V | 122 | 'V', //V |
123 | 'W', //W | 123 | 'W', //W |
124 | 'X', //X | 124 | 'X', //X |
125 | 'Y', //Y | 125 | 'Y', //Y |
126 | 'Z', //Z | 126 | 'Z', //Z |
127 | '[', //[ | 127 | '[', //[ |
128 | '\\', //\ | 128 | '\\', /* \ */ |
129 | ']', //] | 129 | ']', //] |
130 | '^', //^ | 130 | '^', //^ |
131 | '_', //_ | 131 | '_', //_ |
132 | '`', //` | 132 | '`', //` |
133 | 'A', //a | 133 | 'A', //a |
134 | 'B', //b | 134 | 'B', //b |
135 | 'C', //c | 135 | 'C', //c |
136 | 'D', //d | 136 | 'D', //d |
137 | 'E', //e | 137 | 'E', //e |
138 | 'F', //f | 138 | 'F', //f |
139 | 'G', //g | 139 | 'G', //g |
140 | 'H', //h | 140 | 'H', //h |
141 | 'I', //i | 141 | 'I', //i |
142 | 'J', //j | 142 | 'J', //j |
143 | 'K', //k | 143 | 'K', //k |
144 | 'L', //l | 144 | 'L', //l |
145 | 'M', //m | 145 | 'M', //m |
146 | 'N', //n | 146 | 'N', //n |
147 | 'O', //o | 147 | 'O', //o |
148 | 'P', //p | 148 | 'P', //p |
149 | 'Q', //q | 149 | 'Q', //q |
150 | 'R', //r | 150 | 'R', //r |
151 | 'S', //s | 151 | 'S', //s |
152 | 'T', //t | 152 | 'T', //t |
153 | 'U', //u | 153 | 'U', //u |
154 | 'V', //v | 154 | 'V', //v |
155 | 'W', //w | 155 | 'W', //w |
156 | 'X', //x | 156 | 'X', //x |
157 | 'Y', //y | 157 | 'Y', //y |
158 | 'Z', //z | 158 | 'Z', //z |
159 | '{', //{ | 159 | '{', //{ |
160 | '|', //| | 160 | '|', //| |
161 | '}', //} | 161 | '}', //} |
162 | '~', //~ | 162 | '~', //~ |
163 | '', // | 163 | '', // |
164 | 0x80, //C-M-@ | 164 | 0x80, //C-M-@ |
165 | 0x81, //C-M-A | 165 | 0x81, //C-M-A |
166 | 0x82, //C-M-B | 166 | 0x82, //C-M-B |
167 | 0x83, //C-M-C | 167 | 0x83, //C-M-C |
168 | 0x84, //C-M-D | 168 | 0x84, //C-M-D |
169 | 0x85, //C-M-E | 169 | 0x85, //C-M-E |
170 | 0x86, //C-M-F | 170 | 0x86, //C-M-F |
171 | 0x87, //C-M-G | 171 | 0x87, //C-M-G |
172 | 0x88, //C-M-H | 172 | 0x88, //C-M-H |
173 | 0x89, //C-M-I | 173 | 0x89, //C-M-I |
174 | 0x8a, //C-M-J | 174 | 0x8a, //C-M-J |
175 | 0x8b, //C-M-K | 175 | 0x8b, //C-M-K |
176 | 0x8c, //C-M-L | 176 | 0x8c, //C-M-L |
177 | 0x8d, //C-M-M | 177 | 0x8d, //C-M-M |
178 | 0x8e, //C-M-N | 178 | 0x8e, //C-M-N |
179 | 0x8f, //C-M-O | 179 | 0x8f, //C-M-O |
180 | 0x90, //C-M-P | 180 | 0x90, //C-M-P |
181 | 0x91, //C-M-Q | 181 | 0x91, //C-M-Q |
182 | 0x92, //C-M-R | 182 | 0x92, //C-M-R |
183 | 0x93, //C-M-S | 183 | 0x93, //C-M-S |
184 | 0x94, //C-M-T | 184 | 0x94, //C-M-T |
185 | 0x95, //C-M-U | 185 | 0x95, //C-M-U |
186 | 0x96, //C-M-V | 186 | 0x96, //C-M-V |
187 | 0x97, //C-M-W | 187 | 0x97, //C-M-W |
188 | 0x98, //C-M-X | 188 | 0x98, //C-M-X |
189 | 0x99, //C-M-Y | 189 | 0x99, //C-M-Y |
190 | 0x9a, //C-M-Z | 190 | 0x9a, //C-M-Z |
191 | 0x9b, //C-M-[ | 191 | 0x9b, //C-M-[ |
192 | 0x9c, //C-M-\ | 192 | 0x9c, /* C-M-\ */ |
193 | 0x9d, //C-M-] | 193 | 0x9d, //C-M-] |
194 | 0x9e, //C-M-^ | 194 | 0x9e, //C-M-^ |
195 | 0x9f, //C-M-_ | 195 | 0x9f, //C-M-_ |
196 | ' ', // | 196 | ' ', // |
197 | '¡', //¡ | 197 | '¡', //¡ |
198 | '¢', //¢ | 198 | '¢', //¢ |
199 | '£', //£ | 199 | '£', //£ |
200 | '¤', //¤ | 200 | '¤', //¤ |
201 | '¥', //¥ | 201 | '¥', //¥ |
202 | '¦', //¦ | 202 | '¦', //¦ |
203 | '§', //§ | 203 | '§', //§ |
204 | '¨', //¨ | 204 | '¨', //¨ |
205 | '©', //© | 205 | '©', //© |
206 | 'A', //ª | 206 | 'A', //ª |
207 | '«', //« | 207 | '«', //« |
208 | '¬', //¬ | 208 | '¬', //¬ |
209 | '', // | 209 | '', // |
210 | '®', //® | 210 | '®', //® |
211 | '¯', //¯ | 211 | '¯', //¯ |
212 | 'O', //° | 212 | 'O', //° |
213 | '±', //± | 213 | '±', //± |
214 | '²', //² | 214 | '²', //² |
215 | '³', //³ | 215 | '³', //³ |
216 | '´', //´ | 216 | '´', //´ |
217 | 'µ', //µ | 217 | 'µ', //µ |
218 | 'P', //¶ | 218 | 'P', //¶ |
219 | '·', //· | 219 | '·', //· |
220 | '¸', //¸ | 220 | '¸', //¸ |
221 | '¹', //¹ | 221 | '¹', //¹ |
222 | 'O', //º | 222 | 'O', //º |
223 | '»', //» | 223 | '»', //» |
224 | '¼', //¼ | 224 | '¼', //¼ |
225 | '½', //½ | 225 | '½', //½ |
226 | '¾', //¾ | 226 | '¾', //¾ |
227 | '¿', //¿ | 227 | '¿', //¿ |
228 | 'A', //À | 228 | 'A', //À |
229 | 'A', //Á | 229 | 'A', //Á |
230 | 'A', //Â | 230 | 'A', //Â |
231 | 'A', //Ã | 231 | 'A', //Ã |
232 | 'A', //Ä | 232 | 'A', //Ä |
233 | 'A', //Å | 233 | 'A', //Å |
234 | 'A', //Æ | 234 | 'A', //Æ |
235 | 'C', //Ç | 235 | 'C', //Ç |
236 | 'E', //È | 236 | 'E', //È |
237 | 'E', //É | 237 | 'E', //É |
238 | 'E', //Ê | 238 | 'E', //Ê |
239 | 'E', //Ë | 239 | 'E', //Ë |
240 | 'I', //Ì | 240 | 'I', //Ì |
241 | 'I', //Í | 241 | 'I', //Í |
242 | 'I', //Î | 242 | 'I', //Î |
243 | 'I', //Ï | 243 | 'I', //Ï |
244 | 'D', //Ð | 244 | 'D', //Ð |
245 | 'N', //Ñ | 245 | 'N', //Ñ |
246 | 'O', //Ò | 246 | 'O', //Ò |
247 | 'O', //Ó | 247 | 'O', //Ó |
248 | 'O', //Ô | 248 | 'O', //Ô |
249 | 'O', //Õ | 249 | 'O', //Õ |
250 | 'O', //Ö | 250 | 'O', //Ö |
251 | '×', //× | 251 | '×', //× |
252 | 'O', //Ø | 252 | 'O', //Ø |
253 | 'U', //Ù | 253 | 'U', //Ù |
254 | 'U', //Ú | 254 | 'U', //Ú |
255 | 'U', //Û | 255 | 'U', //Û |
256 | 'U', //Ü | 256 | 'U', //Ü |
257 | 'Y', //Ý | 257 | 'Y', //Ý |
258 | 'T', //Þ | 258 | 'T', //Þ |
259 | 'S', //ß | 259 | 'S', //ß |
260 | 'A', //à | 260 | 'A', //à |
261 | 'A', //á | 261 | 'A', //á |
262 | 'A', //â | 262 | 'A', //â |
263 | 'A', //ã | 263 | 'A', //ã |
264 | 'A', //ä | 264 | 'A', //ä |
265 | 'A', //å | 265 | 'A', //å |
266 | 'A', //æ | 266 | 'A', //æ |
267 | 'C', //ç | 267 | 'C', //ç |
268 | 'E', //è | 268 | 'E', //è |
269 | 'E', //é | 269 | 'E', //é |
270 | 'E', //ê | 270 | 'E', //ê |
271 | 'E', //ë | 271 | 'E', //ë |
272 | 'I', //ì | 272 | 'I', //ì |
273 | 'I', //í | 273 | 'I', //í |
274 | 'I', //î | 274 | 'I', //î |
275 | 'I', //ï | 275 | 'I', //ï |
276 | 'D', //ð | 276 | 'D', //ð |
277 | 'N', //ñ | 277 | 'N', //ñ |
278 | 'O', //ò | 278 | 'O', //ò |
279 | 'O', //ó | 279 | 'O', //ó |
280 | 'O', //ô | 280 | 'O', //ô |
281 | 'O', //õ | 281 | 'O', //õ |
282 | 'O', //ö | 282 | 'O', //ö |
283 | '÷', //÷ | 283 | '÷', //÷ |
284 | 'O', //ø | 284 | 'O', //ø |
285 | 'U', //ù | 285 | 'U', //ù |
286 | 'U', //ú | 286 | 'U', //ú |
287 | 'U', //û | 287 | 'U', //û |
288 | 'U', //ü | 288 | 'U', //ü |
289 | 'Y', //ý | 289 | 'Y', //ý |
290 | 'T', //þ | 290 | 'T', //þ |
291 | 'Y', //ÿ | 291 | 'Y', //ÿ |
292 | }; | 292 | }; |
293 | 293 | ||
294 | 294 | ||
295 | 295 | ||
296 | 296 | ||
297 | 297 | ||
298 | static void hackString ( QString &s ) | 298 | static void hackString ( QString &s ) |
299 | { | 299 | { |
300 | int len = s.length(); | 300 | int len = s.length(); |
301 | const QChar* uc = s.unicode(); | 301 | const QChar* uc = s.unicode(); |
302 | for ( int i = 0; i < len; i++ ) { | 302 | for ( int i = 0; i < len; i++ ) { |
303 | if ( !uc++->row() ) | 303 | if ( !uc++->row() ) |
304 | s[i] = collationHack[s[i].cell()]; | 304 | s[i] = collationHack[s[i].cell()]; |
305 | } | 305 | } |
306 | } | 306 | } |
307 | 307 | ||
308 | QString buildSortKey( const QString & s ) | 308 | QString buildSortKey( const QString & s ) |
309 | { | 309 | { |
310 | QString res = s; | 310 | QString res = s; |
311 | hackString( res ); | 311 | hackString( res ); |
312 | return res; | 312 | return res; |
313 | } | 313 | } |
314 | 314 | ||
315 | QString buildSortKey( const QString & s1, const QString & s2 ) | 315 | QString buildSortKey( const QString & s1, const QString & s2 ) |
316 | { | 316 | { |
317 | QString res = s1 + QChar( '\0' ) + s2; | 317 | QString res = s1 + QChar( '\0' ) + s2; |
318 | hackString( res ); | 318 | hackString( res ); |
319 | return res; | 319 | return res; |
320 | } | 320 | } |
321 | 321 | ||
322 | QString buildSortKey( const QString & s1, const QString & s2, | 322 | QString buildSortKey( const QString & s1, const QString & s2, |
323 | const QString & s3 ) | 323 | const QString & s3 ) |
324 | { | 324 | { |
325 | QString res = s1 + QChar( '\0' ) + s2 + QChar( '\0' ) + s3; | 325 | QString res = s1 + QChar( '\0' ) + s2 + QChar( '\0' ) + s3; |
326 | hackString( res ); | 326 | hackString( res ); |
327 | return res; | 327 | return res; |
328 | } | 328 | } |
329 | 329 | ||
330 | static inline QChar coll( QChar u ) | 330 | static inline QChar coll( QChar u ) |
331 | { | 331 | { |
332 | return u.row() ? u : QChar(collationHack[ u.cell() ]); | 332 | return u.row() ? u : QChar(collationHack[ u.cell() ]); |
333 | } | 333 | } |
334 | 334 | ||
335 | 335 | ||
336 | int compare( const QString & s1, const QString & s2 ) | 336 | int compare( const QString & s1, const QString & s2 ) |
337 | { | 337 | { |
338 | const QChar* u1 = s1.unicode(); | 338 | const QChar* u1 = s1.unicode(); |
339 | const QChar* u2 = s2.unicode(); | 339 | const QChar* u2 = s2.unicode(); |
340 | 340 | ||
341 | if ( u1 == u2 ) | 341 | if ( u1 == u2 ) |
342 | return 0; | 342 | return 0; |
343 | if ( u1 == 0 ) | 343 | if ( u1 == 0 ) |
344 | return 1; | 344 | return 1; |
345 | if ( u2 == 0 ) | 345 | if ( u2 == 0 ) |
346 | return -1; | 346 | return -1; |
347 | int l=QMIN(s1.length(),s2.length()); | 347 | int l=QMIN(s1.length(),s2.length()); |
348 | while ( l-- && coll(*u1) == coll(*u2) ) | 348 | while ( l-- && coll(*u1) == coll(*u2) ) |
349 | u1++,u2++; | 349 | u1++,u2++; |
350 | if ( l==-1 ) | 350 | if ( l==-1 ) |
351 | return ( s1.length()-s2.length() ); | 351 | return ( s1.length()-s2.length() ); |
352 | return u1->unicode() - u2->unicode(); | 352 | return u1->unicode() - u2->unicode(); |
353 | } | 353 | } |
354 | 354 | ||
355 | QString simplifyMultiLineSpace( const QString &multiLine ) | 355 | QString simplifyMultiLineSpace( const QString &multiLine ) |
356 | { | 356 | { |
357 | QString result; | 357 | QString result; |
358 | QStringList lines = QStringList::split("\n", multiLine); | 358 | QStringList lines = QStringList::split("\n", multiLine); |
359 | for ( QStringList::Iterator it = lines.begin(); it != lines.end(); ++it ) { | 359 | for ( QStringList::Iterator it = lines.begin(); it != lines.end(); ++it ) { |
360 | if ( it != lines.begin() ) | 360 | if ( it != lines.begin() ) |
361 | result += "\n"; | 361 | result += "\n"; |
362 | result += (*it).simplifyWhiteSpace(); | 362 | result += (*it).simplifyWhiteSpace(); |
363 | } | 363 | } |
364 | return result; | 364 | return result; |
365 | } | 365 | } |
366 | 366 | ||
367 | QString escapeString( const QString& plain ) | 367 | QString escapeString( const QString& plain ) |
368 | { | 368 | { |
369 | QString tmp(plain); | 369 | QString tmp(plain); |
370 | int pos = tmp.length(); | 370 | int pos = tmp.length(); |
371 | const QChar *uc = plain.unicode(); | 371 | const QChar *uc = plain.unicode(); |
372 | while ( pos-- ) { | 372 | while ( pos-- ) { |
373 | unsigned char ch = uc[pos].latin1(); | 373 | unsigned char ch = uc[pos].latin1(); |
374 | if ( ch == '&' ) | 374 | if ( ch == '&' ) |
375 | tmp.replace( pos, 1, "&" ); | 375 | tmp.replace( pos, 1, "&" ); |
376 | else if ( ch == '<' ) | 376 | else if ( ch == '<' ) |
377 | tmp.replace( pos, 1, "<" ); | 377 | tmp.replace( pos, 1, "<" ); |
378 | else if ( ch == '>' ) | 378 | else if ( ch == '>' ) |
379 | tmp.replace( pos, 1, ">" ); | 379 | tmp.replace( pos, 1, ">" ); |
380 | else if ( ch == '\"' ) | 380 | else if ( ch == '\"' ) |
381 | tmp.replace( pos, 1, """ ); | 381 | tmp.replace( pos, 1, """ ); |
382 | } | 382 | } |
383 | return tmp; | 383 | return tmp; |
384 | } | 384 | } |
385 | 385 | ||
386 | QString plainString( const char* escaped, unsigned int length ) | 386 | QString plainString( const char* escaped, unsigned int length ) |
387 | { | 387 | { |
388 | return plainString( QString::fromUtf8( escaped, length ) ); | 388 | return plainString( QString::fromUtf8( escaped, length ) ); |
389 | } | 389 | } |
390 | 390 | ||
391 | QString plainString( const QCString& string ) | 391 | QString plainString( const QCString& string ) |
392 | { | 392 | { |
393 | // We first have to pass it through a ::fromUtf8() | 393 | // We first have to pass it through a ::fromUtf8() |
394 | return plainString( string.data(), string.length() ); | 394 | return plainString( string.data(), string.length() ); |
395 | } | 395 | } |
396 | 396 | ||
397 | QString plainString( const QString& string ) | 397 | QString plainString( const QString& string ) |
398 | { | 398 | { |
399 | QString tmp( string ); | 399 | QString tmp( string ); |
400 | int pos = -1; | 400 | int pos = -1; |
401 | while ( (pos = tmp.find( "&", pos +1 ) ) != -1 ) { | 401 | while ( (pos = tmp.find( "&", pos +1 ) ) != -1 ) { |
402 | if ( tmp.find( "&", pos ) == pos ) | 402 | if ( tmp.find( "&", pos ) == pos ) |
403 | tmp.replace( pos, 5, "&" ); | 403 | tmp.replace( pos, 5, "&" ); |
404 | else if ( tmp.find( "<", pos ) == pos ) | 404 | else if ( tmp.find( "<", pos ) == pos ) |
405 | tmp.replace( pos, 4, "<" ); | 405 | tmp.replace( pos, 4, "<" ); |
406 | else if( tmp.find( ">", pos ) == pos ) | 406 | else if( tmp.find( ">", pos ) == pos ) |
407 | tmp.replace( pos, 4, ">" ); | 407 | tmp.replace( pos, 4, ">" ); |
408 | else if ( tmp.find( """, pos ) == pos ) | 408 | else if ( tmp.find( """, pos ) == pos ) |
409 | tmp.replace( pos, 6, "\"" ); | 409 | tmp.replace( pos, 6, "\"" ); |
410 | } | 410 | } |
411 | return tmp; | 411 | return tmp; |
412 | } | 412 | } |
413 | 413 | ||
414 | } // namespace QPC | 414 | } // namespace QPC |