]>
Commit | Line | Data |
---|---|---|
5526e819 | 1 | ///////////////////////////////////////////////////////////////////////////// |
93763ad5 | 2 | // Name: src/html/htmltag.cpp |
5526e819 VS |
3 | // Purpose: wxHtmlTag class (represents single tag) |
4 | // Author: Vaclav Slavik | |
69941f05 | 5 | // RCS-ID: $Id$ |
5526e819 | 6 | // Copyright: (c) 1999 Vaclav Slavik |
65571936 | 7 | // Licence: wxWindows licence |
5526e819 VS |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
3096bd2f | 10 | #include "wx/wxprec.h" |
5526e819 | 11 | |
2b5f62a0 | 12 | #ifdef __BORLANDC__ |
93763ad5 | 13 | #pragma hdrstop |
5526e819 VS |
14 | #endif |
15 | ||
93763ad5 WS |
16 | #if wxUSE_HTML |
17 | ||
40989e46 WS |
18 | #include "wx/html/htmltag.h" |
19 | ||
b4f4d3dd | 20 | #ifndef WX_PRECOMP |
7cf41a5d | 21 | #include "wx/colour.h" |
193d0c93 | 22 | #include "wx/wxcrtvararg.h" |
5526e819 VS |
23 | #endif |
24 | ||
daa616fc | 25 | #include "wx/html/htmlpars.h" |
4fe7567d VS |
26 | #include "wx/vector.h" |
27 | ||
7e1e0960 | 28 | #include <stdio.h> // for vsscanf |
5526e819 VS |
29 | #include <stdarg.h> |
30 | ||
5526e819 VS |
31 | //----------------------------------------------------------------------------- |
32 | // wxHtmlTagsCache | |
33 | //----------------------------------------------------------------------------- | |
34 | ||
5e8e25e7 VS |
35 | struct wxHtmlCacheItem |
36 | { | |
37 | // this is "pos" value passed to wxHtmlTag's constructor. | |
38 | // it is position of '<' character of the tag | |
39 | int Key; | |
40 | ||
41 | // end positions for the tag: | |
42 | // end1 is '<' of ending tag, | |
43 | // end2 is '>' or both are | |
44 | // -1 if there is no ending tag for this one... | |
45 | // or -2 if this is ending tag </...> | |
46 | int End1, End2; | |
47 | ||
48 | // name of this tag | |
49 | wxChar *Name; | |
50 | }; | |
51 | ||
4fe7567d VS |
52 | // NB: this is an empty class and not typedef because of forward declaration |
53 | class wxHtmlTagsCacheData : public wxVector<wxHtmlCacheItem> | |
54 | { | |
55 | }; | |
5e8e25e7 | 56 | |
07cc7ddc | 57 | bool wxIsCDATAElement(const wxChar *tag) |
7c6cd4a8 VS |
58 | { |
59 | return (wxStrcmp(tag, _T("SCRIPT")) == 0) || | |
60 | (wxStrcmp(tag, _T("STYLE")) == 0); | |
61 | } | |
62 | ||
5526e819 VS |
63 | wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source) |
64 | { | |
4fe7567d VS |
65 | m_Cache = new wxHtmlTagsCacheData; |
66 | m_CachePos = 0; | |
67 | ||
66a77a74 | 68 | const wxChar *src = source.c_str(); |
93763ad5 | 69 | int lng = source.length(); |
8cd82622 | 70 | wxChar tagBuffer[256]; |
5526e819 | 71 | |
4609ee2e | 72 | for ( int pos = 0; pos < lng; pos++ ) |
4f9297b0 VS |
73 | { |
74 | if (src[pos] == wxT('<')) // tag found: | |
a914db0f | 75 | { |
4609ee2e VZ |
76 | // don't cache comment tags |
77 | wxString::const_iterator iter = source.begin() + pos; | |
78 | if ( wxHtmlParser::SkipCommentTag(iter, source.end()) ) | |
79 | { | |
80 | pos = iter - source.begin(); | |
81 | continue; | |
82 | } | |
83 | ||
4fe7567d VS |
84 | size_t tg = Cache().size(); |
85 | Cache().push_back(wxHtmlCacheItem()); | |
86 | ||
999836aa | 87 | int stpos = pos++; |
4fe7567d | 88 | Cache()[tg].Key = stpos; |
8cd82622 | 89 | |
4f22f506 | 90 | int i; |
8cd82622 | 91 | for ( i = 0; |
4f22f506 | 92 | pos < lng && i < (int)WXSIZEOF(tagBuffer) - 1 && |
8cd82622 VZ |
93 | src[pos] != wxT('>') && !wxIsspace(src[pos]); |
94 | i++, pos++ ) | |
a914db0f | 95 | { |
42841dfc | 96 | tagBuffer[i] = (wxChar)wxToupper(src[pos]); |
5526e819 | 97 | } |
8cd82622 VZ |
98 | tagBuffer[i] = _T('\0'); |
99 | ||
4fe7567d VS |
100 | Cache()[tg].Name = new wxChar[i+1]; |
101 | memcpy(Cache()[tg].Name, tagBuffer, (i+1)*sizeof(wxChar)); | |
5526e819 | 102 | |
15db3cf5 | 103 | while (pos < lng && src[pos] != wxT('>')) pos++; |
5526e819 | 104 | |
4f9297b0 | 105 | if (src[stpos+1] == wxT('/')) // ending tag: |
a914db0f | 106 | { |
4fe7567d | 107 | Cache()[tg].End1 = Cache()[tg].End2 = -2; |
5526e819 VS |
108 | // find matching begin tag: |
109 | for (i = tg; i >= 0; i--) | |
4fe7567d | 110 | if ((Cache()[i].End1 == -1) && (wxStrcmp(Cache()[i].Name, tagBuffer+1) == 0)) |
a914db0f | 111 | { |
4fe7567d VS |
112 | Cache()[i].End1 = stpos; |
113 | Cache()[i].End2 = pos + 1; | |
5526e819 VS |
114 | break; |
115 | } | |
116 | } | |
8cd82622 | 117 | else |
a914db0f | 118 | { |
4fe7567d | 119 | Cache()[tg].End1 = Cache()[tg].End2 = -1; |
7448de8d | 120 | |
7c6cd4a8 VS |
121 | if (wxIsCDATAElement(tagBuffer)) |
122 | { | |
313ffa19 VS |
123 | // store the orig pos in case we are missing the closing |
124 | // tag (see below) | |
7448de8d | 125 | wxInt32 old_pos = pos; |
313ffa19 | 126 | bool foundCloseTag = false; |
7448de8d | 127 | |
7c6cd4a8 VS |
128 | // find next matching tag |
129 | int tag_len = wxStrlen(tagBuffer); | |
130 | while (pos < lng) | |
131 | { | |
132 | // find the ending tag | |
133 | while (pos + 1 < lng && | |
134 | (src[pos] != '<' || src[pos+1] != '/')) | |
135 | ++pos; | |
136 | if (src[pos] == '<') | |
137 | ++pos; | |
d1da8872 | 138 | |
7c6cd4a8 VS |
139 | // see if it matches |
140 | int match_pos = 0; | |
141 | while (pos < lng && match_pos < tag_len && src[pos] != '>' && src[pos] != '<') { | |
5447d1b4 VZ |
142 | // cast to wxChar needed to suppress warning in |
143 | // Unicode build | |
144 | if ((wxChar)wxToupper(src[pos]) == tagBuffer[match_pos]) { | |
7c6cd4a8 | 145 | ++match_pos; |
d1da8872 | 146 | } |
7c6cd4a8 VS |
147 | else if (src[pos] == wxT(' ') || src[pos] == wxT('\n') || |
148 | src[pos] == wxT('\r') || src[pos] == wxT('\t')) { | |
149 | // need to skip over these | |
150 | } | |
151 | else { | |
152 | match_pos = 0; | |
153 | } | |
154 | ++pos; | |
155 | } | |
156 | ||
157 | // found a match | |
7448de8d | 158 | if (match_pos == tag_len) |
313ffa19 | 159 | { |
b5d464b9 | 160 | pos = pos - tag_len - 3; |
313ffa19 | 161 | foundCloseTag = true; |
7c6cd4a8 VS |
162 | break; |
163 | } | |
313ffa19 VS |
164 | else // keep looking for the closing tag |
165 | { | |
7c6cd4a8 VS |
166 | ++pos; |
167 | } | |
168 | } | |
313ffa19 VS |
169 | if (!foundCloseTag) |
170 | { | |
171 | // we didn't find closing tag; this means the markup | |
172 | // is incorrect and the best thing we can do is to | |
173 | // ignore the unclosed tag and continue parsing as if | |
174 | // it didn't exist: | |
175 | pos = old_pos; | |
176 | } | |
7c6cd4a8 | 177 | } |
5526e819 VS |
178 | } |
179 | } | |
5526e819 VS |
180 | } |
181 | ||
182 | // ok, we're done, now we'll free .Name members of cache - we don't need it anymore: | |
4fe7567d VS |
183 | for ( wxHtmlTagsCacheData::iterator i = Cache().begin(); |
184 | i != Cache().end(); ++i ) | |
4f9297b0 | 185 | { |
4fe7567d VS |
186 | delete[] i->Name; |
187 | i->Name = NULL; | |
5526e819 VS |
188 | } |
189 | } | |
190 | ||
4fe7567d VS |
191 | wxHtmlTagsCache::~wxHtmlTagsCache() |
192 | { | |
193 | delete m_Cache; | |
194 | } | |
195 | ||
5526e819 VS |
196 | void wxHtmlTagsCache::QueryTag(int at, int* end1, int* end2) |
197 | { | |
4fe7567d VS |
198 | if (Cache().empty()) |
199 | return; | |
200 | ||
201 | if (Cache()[m_CachePos].Key != at) | |
4f9297b0 | 202 | { |
4fe7567d | 203 | int delta = (at < Cache()[m_CachePos].Key) ? -1 : 1; |
8cd82622 VZ |
204 | do |
205 | { | |
4fe7567d | 206 | if ( m_CachePos < 0 || m_CachePos == Cache().size() ) |
10b9be32 VZ |
207 | { |
208 | // something is very wrong with HTML, give up by returning an | |
209 | // impossibly large value which is going to be ignored by the | |
210 | // caller | |
211 | *end1 = | |
212 | *end2 = INT_MAX; | |
213 | return; | |
214 | } | |
215 | ||
8cd82622 | 216 | m_CachePos += delta; |
daa616fc | 217 | } |
4fe7567d | 218 | while (Cache()[m_CachePos].Key != at); |
5526e819 | 219 | } |
4fe7567d VS |
220 | *end1 = Cache()[m_CachePos].End1; |
221 | *end2 = Cache()[m_CachePos].End2; | |
5526e819 VS |
222 | } |
223 | ||
224 | ||
225 | ||
226 | ||
227 | //----------------------------------------------------------------------------- | |
228 | // wxHtmlTag | |
229 | //----------------------------------------------------------------------------- | |
230 | ||
211dfedd | 231 | wxHtmlTag::wxHtmlTag(wxHtmlTag *parent, |
8cd82622 | 232 | const wxString& source, int pos, int end_pos, |
daa616fc | 233 | wxHtmlTagsCache *cache, |
7da48d49 | 234 | wxHtmlEntitiesParser *entParser) |
5526e819 | 235 | { |
211dfedd VS |
236 | /* Setup DOM relations */ |
237 | ||
238 | m_Next = NULL; | |
239 | m_FirstChild = m_LastChild = NULL; | |
240 | m_Parent = parent; | |
241 | if (parent) | |
242 | { | |
243 | m_Prev = m_Parent->m_LastChild; | |
244 | if (m_Prev == NULL) | |
245 | m_Parent->m_FirstChild = this; | |
246 | else | |
247 | m_Prev->m_Next = this; | |
248 | m_Parent->m_LastChild = this; | |
249 | } | |
250 | else | |
251 | m_Prev = NULL; | |
252 | ||
253 | /* Find parameters and their values: */ | |
8cd82622 | 254 | |
5526e819 | 255 | int i; |
daa616fc | 256 | wxChar c; |
5526e819 VS |
257 | |
258 | // fill-in name, params and begin pos: | |
5526e819 | 259 | i = pos+1; |
5526e819 | 260 | |
b076dc01 | 261 | // find tag's name and convert it to uppercase: |
8cd82622 VZ |
262 | while ((i < end_pos) && |
263 | ((c = source[i++]) != wxT(' ') && c != wxT('\r') && | |
daa616fc | 264 | c != wxT('\n') && c != wxT('\t') && |
8cd82622 | 265 | c != wxT('>'))) |
a914db0f | 266 | { |
8cd82622 | 267 | if ((c >= wxT('a')) && (c <= wxT('z'))) |
daa616fc VS |
268 | c -= (wxT('a') - wxT('A')); |
269 | m_Name << c; | |
5526e819 VS |
270 | } |
271 | ||
b076dc01 | 272 | // if the tag has parameters, read them and "normalize" them, |
8cd82622 | 273 | // i.e. convert to uppercase, replace whitespaces by spaces and |
b076dc01 | 274 | // remove whitespaces around '=': |
c9893146 | 275 | if (source[i-1] != wxT('>')) |
daa616fc VS |
276 | { |
277 | #define IS_WHITE(c) (c == wxT(' ') || c == wxT('\r') || \ | |
278 | c == wxT('\n') || c == wxT('\t')) | |
279 | wxString pname, pvalue; | |
280 | wxChar quote; | |
8cd82622 | 281 | enum |
a914db0f | 282 | { |
8cd82622 | 283 | ST_BEFORE_NAME = 1, |
daa616fc VS |
284 | ST_NAME, |
285 | ST_BEFORE_EQ, | |
286 | ST_BEFORE_VALUE, | |
287 | ST_VALUE | |
288 | } state; | |
8cd82622 | 289 | |
daa616fc VS |
290 | quote = 0; |
291 | state = ST_BEFORE_NAME; | |
292 | while (i < end_pos) | |
293 | { | |
294 | c = source[i++]; | |
295 | ||
8cd82622 | 296 | if (c == wxT('>') && !(state == ST_VALUE && quote != 0)) |
a914db0f | 297 | { |
daa616fc | 298 | if (state == ST_BEFORE_EQ || state == ST_NAME) |
b076dc01 | 299 | { |
daa616fc VS |
300 | m_ParamNames.Add(pname); |
301 | m_ParamValues.Add(wxEmptyString); | |
b076dc01 | 302 | } |
daa616fc VS |
303 | else if (state == ST_VALUE && quote == 0) |
304 | { | |
305 | m_ParamNames.Add(pname); | |
367c84b9 VS |
306 | if (entParser) |
307 | m_ParamValues.Add(entParser->Parse(pvalue)); | |
308 | else | |
309 | m_ParamValues.Add(pvalue); | |
daa616fc VS |
310 | } |
311 | break; | |
5526e819 | 312 | } |
daa616fc | 313 | switch (state) |
a914db0f | 314 | { |
daa616fc VS |
315 | case ST_BEFORE_NAME: |
316 | if (!IS_WHITE(c)) | |
317 | { | |
318 | pname = c; | |
319 | state = ST_NAME; | |
320 | } | |
321 | break; | |
322 | case ST_NAME: | |
323 | if (IS_WHITE(c)) | |
324 | state = ST_BEFORE_EQ; | |
325 | else if (c == wxT('=')) | |
326 | state = ST_BEFORE_VALUE; | |
327 | else | |
328 | pname << c; | |
329 | break; | |
330 | case ST_BEFORE_EQ: | |
331 | if (c == wxT('=')) | |
332 | state = ST_BEFORE_VALUE; | |
333 | else if (!IS_WHITE(c)) | |
334 | { | |
335 | m_ParamNames.Add(pname); | |
336 | m_ParamValues.Add(wxEmptyString); | |
337 | pname = c; | |
338 | state = ST_NAME; | |
339 | } | |
340 | break; | |
341 | case ST_BEFORE_VALUE: | |
342 | if (!IS_WHITE(c)) | |
343 | { | |
344 | if (c == wxT('"') || c == wxT('\'')) | |
345 | quote = c, pvalue = wxEmptyString; | |
346 | else | |
347 | quote = 0, pvalue = c; | |
348 | state = ST_VALUE; | |
349 | } | |
350 | break; | |
351 | case ST_VALUE: | |
352 | if ((quote != 0 && c == quote) || | |
353 | (quote == 0 && IS_WHITE(c))) | |
354 | { | |
355 | m_ParamNames.Add(pname); | |
356 | if (quote == 0) | |
357 | { | |
358 | // VS: backward compatibility, no real reason, | |
359 | // but wxHTML code relies on this... :( | |
360 | pvalue.MakeUpper(); | |
361 | } | |
367c84b9 VS |
362 | if (entParser) |
363 | m_ParamValues.Add(entParser->Parse(pvalue)); | |
364 | else | |
365 | m_ParamValues.Add(pvalue); | |
daa616fc VS |
366 | state = ST_BEFORE_NAME; |
367 | } | |
368 | else | |
369 | pvalue << c; | |
370 | break; | |
72aa4a98 | 371 | } |
5526e819 | 372 | } |
8cd82622 | 373 | |
daa616fc | 374 | #undef IS_WHITE |
7448de8d WS |
375 | } |
376 | m_Begin = i; | |
5526e819 | 377 | |
7448de8d WS |
378 | cache->QueryTag(pos, &m_End1, &m_End2); |
379 | if (m_End1 > end_pos) m_End1 = end_pos; | |
380 | if (m_End2 > end_pos) m_End2 = end_pos; | |
5526e819 VS |
381 | } |
382 | ||
211dfedd VS |
383 | wxHtmlTag::~wxHtmlTag() |
384 | { | |
0d58bb65 VS |
385 | wxHtmlTag *t1, *t2; |
386 | t1 = m_FirstChild; | |
387 | while (t1) | |
388 | { | |
389 | t2 = t1->GetNextSibling(); | |
390 | delete t1; | |
391 | t1 = t2; | |
392 | } | |
211dfedd VS |
393 | } |
394 | ||
5526e819 VS |
395 | bool wxHtmlTag::HasParam(const wxString& par) const |
396 | { | |
8703bc01 | 397 | return (m_ParamNames.Index(par, false) != wxNOT_FOUND); |
5526e819 VS |
398 | } |
399 | ||
5526e819 VS |
400 | wxString wxHtmlTag::GetParam(const wxString& par, bool with_commas) const |
401 | { | |
8703bc01 | 402 | int index = m_ParamNames.Index(par, false); |
daa616fc VS |
403 | if (index == wxNOT_FOUND) |
404 | return wxEmptyString; | |
405 | if (with_commas) | |
4f9297b0 | 406 | { |
daa616fc VS |
407 | // VS: backward compatibility, seems to be never used by wxHTML... |
408 | wxString s; | |
409 | s << wxT('"') << m_ParamValues[index] << wxT('"'); | |
410 | return s; | |
5526e819 | 411 | } |
daa616fc VS |
412 | else |
413 | return m_ParamValues[index]; | |
5526e819 VS |
414 | } |
415 | ||
90350682 | 416 | int wxHtmlTag::ScanParam(const wxString& par, |
d7640339 VS |
417 | const char *format, |
418 | void *param) const | |
419 | { | |
420 | wxString parval = GetParam(par); | |
421 | return wxSscanf(parval, format, param); | |
422 | } | |
423 | ||
424 | int wxHtmlTag::ScanParam(const wxString& par, | |
425 | const wchar_t *format, | |
90350682 | 426 | void *param) const |
5526e819 | 427 | { |
5526e819 | 428 | wxString parval = GetParam(par); |
161f4f73 | 429 | return wxSscanf(parval, format, param); |
5526e819 VS |
430 | } |
431 | ||
8bd72d90 VS |
432 | bool wxHtmlTag::GetParamAsColour(const wxString& par, wxColour *clr) const |
433 | { | |
86766dfd | 434 | wxCHECK_MSG( clr, false, _T("invalid colour argument") ); |
8cd82622 | 435 | |
86766dfd | 436 | wxString str = GetParam(par); |
40989e46 | 437 | |
86766dfd VS |
438 | // handle colours defined in HTML 4.0 first: |
439 | if (str.length() > 1 && str[0] != _T('#')) | |
8bd72d90 | 440 | { |
86766dfd | 441 | #define HTML_COLOUR(name, r, g, b) \ |
8703bc01 | 442 | if (str.IsSameAs(wxT(name), false)) \ |
86766dfd | 443 | { clr->Set(r, g, b); return true; } |
8bd72d90 VS |
444 | HTML_COLOUR("black", 0x00,0x00,0x00) |
445 | HTML_COLOUR("silver", 0xC0,0xC0,0xC0) | |
446 | HTML_COLOUR("gray", 0x80,0x80,0x80) | |
447 | HTML_COLOUR("white", 0xFF,0xFF,0xFF) | |
448 | HTML_COLOUR("maroon", 0x80,0x00,0x00) | |
449 | HTML_COLOUR("red", 0xFF,0x00,0x00) | |
450 | HTML_COLOUR("purple", 0x80,0x00,0x80) | |
451 | HTML_COLOUR("fuchsia", 0xFF,0x00,0xFF) | |
452 | HTML_COLOUR("green", 0x00,0x80,0x00) | |
453 | HTML_COLOUR("lime", 0x00,0xFF,0x00) | |
454 | HTML_COLOUR("olive", 0x80,0x80,0x00) | |
455 | HTML_COLOUR("yellow", 0xFF,0xFF,0x00) | |
456 | HTML_COLOUR("navy", 0x00,0x00,0x80) | |
457 | HTML_COLOUR("blue", 0x00,0x00,0xFF) | |
458 | HTML_COLOUR("teal", 0x00,0x80,0x80) | |
459 | HTML_COLOUR("aqua", 0x00,0xFF,0xFF) | |
460 | #undef HTML_COLOUR | |
8bd72d90 | 461 | } |
5716a1ab | 462 | |
86766dfd VS |
463 | // then try to parse #rrggbb representations or set from other well |
464 | // known names (note that this doesn't strictly conform to HTML spec, | |
465 | // but it doesn't do real harm -- but it *must* be done after the standard | |
466 | // colors are handled above): | |
467 | if (clr->Set(str)) | |
468 | return true; | |
469 | ||
8703bc01 | 470 | return false; |
8bd72d90 VS |
471 | } |
472 | ||
473 | bool wxHtmlTag::GetParamAsInt(const wxString& par, int *clr) const | |
474 | { | |
8703bc01 | 475 | if (!HasParam(par)) return false; |
8bd72d90 VS |
476 | long i; |
477 | bool succ = GetParam(par).ToLong(&i); | |
478 | *clr = (int)i; | |
479 | return succ; | |
480 | } | |
481 | ||
daa616fc VS |
482 | wxString wxHtmlTag::GetAllParams() const |
483 | { | |
3103e8a9 | 484 | // VS: this function is for backward compatibility only, |
daa616fc VS |
485 | // never used by wxHTML |
486 | wxString s; | |
487 | size_t cnt = m_ParamNames.GetCount(); | |
488 | for (size_t i = 0; i < cnt; i++) | |
489 | { | |
490 | s << m_ParamNames[i]; | |
491 | s << wxT('='); | |
492 | if (m_ParamValues[i].Find(wxT('"')) != wxNOT_FOUND) | |
493 | s << wxT('\'') << m_ParamValues[i] << wxT('\''); | |
494 | else | |
495 | s << wxT('"') << m_ParamValues[i] << wxT('"'); | |
496 | } | |
497 | return s; | |
498 | } | |
499 | ||
211dfedd VS |
500 | wxHtmlTag *wxHtmlTag::GetFirstSibling() const |
501 | { | |
502 | if (m_Parent) | |
503 | return m_Parent->m_FirstChild; | |
504 | else | |
505 | { | |
506 | wxHtmlTag *cur = (wxHtmlTag*)this; | |
8cd82622 | 507 | while (cur->m_Prev) |
211dfedd VS |
508 | cur = cur->m_Prev; |
509 | return cur; | |
510 | } | |
511 | } | |
512 | ||
513 | wxHtmlTag *wxHtmlTag::GetLastSibling() const | |
514 | { | |
515 | if (m_Parent) | |
516 | return m_Parent->m_LastChild; | |
517 | else | |
518 | { | |
519 | wxHtmlTag *cur = (wxHtmlTag*)this; | |
8cd82622 | 520 | while (cur->m_Next) |
211dfedd VS |
521 | cur = cur->m_Next; |
522 | return cur; | |
523 | } | |
524 | } | |
525 | ||
526 | wxHtmlTag *wxHtmlTag::GetNextTag() const | |
527 | { | |
528 | if (m_FirstChild) return m_FirstChild; | |
529 | if (m_Next) return m_Next; | |
530 | wxHtmlTag *cur = m_Parent; | |
531 | if (!cur) return NULL; | |
8cd82622 | 532 | while (cur->m_Parent && !cur->m_Next) |
211dfedd VS |
533 | cur = cur->m_Parent; |
534 | return cur->m_Next; | |
535 | } | |
536 | ||
4d223b67 | 537 | #endif |