@@ -317,7 +317,13 @@ bool EditorHelpSearch::Runner::_slice() {
317317}
318318
319319bool EditorHelpSearch::Runner::_phase_match_classes_init () {
320- iterator_doc = EditorHelp::get_doc_data ()->class_list .begin ();
320+ iterator_doc = nullptr ;
321+ iterator_stack.clear ();
322+ if (search_flags & SEARCH_SHOW_HIERARCHY ) {
323+ iterator_stack.push_back (EditorHelp::get_doc_data ()->inheriting [" " ].front ());
324+ } else {
325+ iterator_doc = EditorHelp::get_doc_data ()->class_list .begin ();
326+ }
321327 matches.clear ();
322328 matched_item = nullptr ;
323329 match_highest_score = 0 ;
@@ -331,81 +337,103 @@ bool EditorHelpSearch::Runner::_phase_match_classes_init() {
331337}
332338
333339bool EditorHelpSearch::Runner::_phase_match_classes () {
334- if (!iterator_doc) {
340+ if (!iterator_doc && iterator_stack. is_empty () ) {
335341 return true ;
336342 }
337343
338- DocData::ClassDoc &class_doc = iterator_doc->value ;
339- if (class_doc.name .is_empty ()) {
340- ++iterator_doc;
341- return false ;
344+ DocData::ClassDoc *class_doc = nullptr ;
345+ if (iterator_doc) {
346+ class_doc = &iterator_doc->value ;
347+ } else if (!iterator_stack.is_empty () && iterator_stack[iterator_stack.size () - 1 ]) {
348+ class_doc = EditorHelp::get_doc_data ()->class_list .getptr (iterator_stack[iterator_stack.size () - 1 ]->get ());
349+ }
350+
351+ if (class_doc && class_doc->name .is_empty ()) {
352+ class_doc = nullptr ;
342353 }
343354
344- if (!_is_class_disabled_by_feature_profile (class_doc. name )) {
355+ if (class_doc && !_is_class_disabled_by_feature_profile (class_doc-> name )) {
345356 ClassMatch match;
346- match.doc = & class_doc;
357+ match.doc = class_doc;
347358
348359 // Match class name.
349360 if (search_flags & SEARCH_CLASSES ) {
350361 // If the search term is empty, add any classes which are not script docs or which don't start with
351362 // a double-quotation. This will ensure that only C++ classes and explicitly named classes will
352363 // be added.
353- match.name = (term.is_empty () && (!class_doc. is_script_doc || class_doc. name [0 ] != ' \" ' )) || _match_string (term, class_doc. name );
364+ match.name = (term.is_empty () && (!class_doc-> is_script_doc || class_doc-> name [0 ] != ' \" ' )) || _match_string (term, class_doc-> name );
354365 }
355366
356367 // Match members only if the term is long enough, to avoid slow performance from building a large tree.
357368 // Make an exception for annotations, since there are not that many of them.
358369 if (term.length () > 1 || term == " @" ) {
359370 if (search_flags & SEARCH_CONSTRUCTORS ) {
360- _match_method_name_and_push_back (class_doc. constructors , &match.constructors );
371+ _match_method_name_and_push_back (class_doc-> constructors , &match.constructors );
361372 }
362373 if (search_flags & SEARCH_METHODS ) {
363- _match_method_name_and_push_back (class_doc. methods , &match.methods );
374+ _match_method_name_and_push_back (class_doc-> methods , &match.methods );
364375 }
365376 if (search_flags & SEARCH_OPERATORS ) {
366- _match_method_name_and_push_back (class_doc. operators , &match.operators );
377+ _match_method_name_and_push_back (class_doc-> operators , &match.operators );
367378 }
368379 if (search_flags & SEARCH_SIGNALS ) {
369- for (int i = 0 ; i < class_doc. signals .size (); i++) {
370- if (_all_terms_in_name (class_doc. signals [i].name )) {
371- match.signals .push_back (const_cast <DocData::MethodDoc *>(&class_doc. signals [i]));
380+ for (int i = 0 ; i < class_doc-> signals .size (); i++) {
381+ if (_all_terms_in_name (class_doc-> signals [i].name )) {
382+ match.signals .push_back (const_cast <DocData::MethodDoc *>(&class_doc-> signals [i]));
372383 }
373384 }
374385 }
375386 if (search_flags & SEARCH_CONSTANTS ) {
376- for (int i = 0 ; i < class_doc. constants .size (); i++) {
377- if (_all_terms_in_name (class_doc. constants [i].name )) {
378- match.constants .push_back (const_cast <DocData::ConstantDoc *>(&class_doc. constants [i]));
387+ for (int i = 0 ; i < class_doc-> constants .size (); i++) {
388+ if (_all_terms_in_name (class_doc-> constants [i].name )) {
389+ match.constants .push_back (const_cast <DocData::ConstantDoc *>(&class_doc-> constants [i]));
379390 }
380391 }
381392 }
382393 if (search_flags & SEARCH_PROPERTIES ) {
383- for (int i = 0 ; i < class_doc. properties .size (); i++) {
384- if (_all_terms_in_name (class_doc. properties [i].name )) {
385- match.properties .push_back (const_cast <DocData::PropertyDoc *>(&class_doc. properties [i]));
394+ for (int i = 0 ; i < class_doc-> properties .size (); i++) {
395+ if (_all_terms_in_name (class_doc-> properties [i].name )) {
396+ match.properties .push_back (const_cast <DocData::PropertyDoc *>(&class_doc-> properties [i]));
386397 }
387398 }
388399 }
389400 if (search_flags & SEARCH_THEME_ITEMS ) {
390- for (int i = 0 ; i < class_doc. theme_properties .size (); i++) {
391- if (_all_terms_in_name (class_doc. theme_properties [i].name )) {
392- match.theme_properties .push_back (const_cast <DocData::ThemeItemDoc *>(&class_doc. theme_properties [i]));
401+ for (int i = 0 ; i < class_doc-> theme_properties .size (); i++) {
402+ if (_all_terms_in_name (class_doc-> theme_properties [i].name )) {
403+ match.theme_properties .push_back (const_cast <DocData::ThemeItemDoc *>(&class_doc-> theme_properties [i]));
393404 }
394405 }
395406 }
396407 if (search_flags & SEARCH_ANNOTATIONS ) {
397- for (int i = 0 ; i < class_doc. annotations .size (); i++) {
398- if (_match_string (term, class_doc. annotations [i].name )) {
399- match.annotations .push_back (const_cast <DocData::MethodDoc *>(&class_doc. annotations [i]));
408+ for (int i = 0 ; i < class_doc-> annotations .size (); i++) {
409+ if (_match_string (term, class_doc-> annotations [i].name )) {
410+ match.annotations .push_back (const_cast <DocData::MethodDoc *>(&class_doc-> annotations [i]));
400411 }
401412 }
402413 }
403414 }
404- matches[class_doc.name ] = match;
415+ matches[class_doc->name ] = match;
416+ }
417+
418+ if (iterator_doc) {
419+ ++iterator_doc;
420+ return !iterator_doc;
421+ }
422+
423+ if (!iterator_stack.is_empty ()) {
424+ if (iterator_stack[iterator_stack.size () - 1 ]) {
425+ iterator_stack[iterator_stack.size () - 1 ] = iterator_stack[iterator_stack.size () - 1 ]->next ();
426+ }
427+ if (!iterator_stack[iterator_stack.size () - 1 ]) {
428+ iterator_stack.resize (iterator_stack.size () - 1 );
429+ }
430+ }
431+
432+ if (class_doc && EditorHelp::get_doc_data ()->inheriting .has (class_doc->name )) {
433+ iterator_stack.push_back (EditorHelp::get_doc_data ()->inheriting [class_doc->name ].front ());
405434 }
406435
407- ++iterator_doc;
408- return !iterator_doc;
436+ return iterator_stack.is_empty ();
409437}
410438
411439bool EditorHelpSearch::Runner::_phase_class_items_init () {
0 commit comments