778{
779
780
781 std::vector<BaseItemPtr> *pItems{};
782 struct Comparator {
783 bool operator()
785 return component < pItem->name; }
786 bool operator()
788 return pItem->name < component; }
789 };
790 auto find = [&pItems](
const Identifier &component ){
return std::equal_range(
791 pItems->begin(), pItems->end(), component, Comparator() ); };
792
793 auto pNode = ®istry;
794 pItems = &pNode->
items;
795
796 const auto pathComponents = ::wxSplit( placement.
path,
'/' );
797 auto pComponent = pathComponents.begin(),
end = pathComponents.end();
798
799
800
801 auto debugPath = wxString{'/'} + registry.name.GET();
802 while ( pComponent !=
end ) {
803 const auto &pathComponent = *pComponent;
804
805
806
807 const auto range = find( pathComponent );
808 const auto iter2 = std::find_if( range.first, range.second,
810 return dynamic_cast< GroupItemBase* >( pItem.get() ); } );
811
812 if ( iter2 != range.second ) {
813
815 pItems = &pNode->
items;
816 debugPath += '/' + pathComponent;
817 ++pComponent;
818 }
819 else
820
821
822
823
824 break;
825 }
826
827
828 while ( pComponent !=
end ) {
829 auto newNode =
831 pNode = newNode.get();
832 pItems->insert( find( pNode->name ).second, std::move( newNode ) );
833 pItems = &pNode->items;
834 ++pComponent;
835 }
836
837
838 pItem->orderingHint = placement.
hint;
839
840
841 pItems->insert( find( pItem->name ).second, std::move( pItem ) );
842}
An explicitly nonlocalized string, not meant for the user to see.
std::unique_ptr< BaseItem > BaseItemPtr
Common abstract base class for items that group other items.