752{
753
754
756 struct Comparator {
757 bool operator()
759 return component < pItem->name; }
760 bool operator()
762 return pItem->name < component; }
763 };
764 auto find = [&pItems](
const Identifier &component ){
return std::equal_range(
765 pItems->begin(), pItems->end(), component, Comparator() ); };
766
767 auto pNode = ®istry;
768 pItems = &pNode->
items;
769
770 const auto pathComponents = ::wxSplit( placement.
path,
'/' );
771 auto pComponent = pathComponents.begin(),
end = pathComponents.end();
772
773
774
775 auto debugPath = wxString{
'/'} + registry.
name.
GET();
776 while ( pComponent !=
end ) {
777 const auto &pathComponent = *pComponent;
778
779
780
781 const auto range = find( pathComponent );
782 const auto iter2 = std::find_if( range.first, range.second,
784 return dynamic_cast< GroupItem* >( pItem.get() ); } );
785
786 if ( iter2 != range.second ) {
787
788 pNode =
static_cast< GroupItem*
>( iter2->get() );
789 pItems = &pNode->
items;
790 debugPath += '/' + pathComponent;
791 ++pComponent;
792 }
793 else
794
795
796
797
798 break;
799 }
800
801
802 while ( pComponent !=
end ) {
803 auto newNode = std::make_unique<TransparentGroupItem<>>( *pComponent );
804 pNode = newNode.get();
805 pItems->insert( find( pNode->name ).second, std::move( newNode ) );
806 pItems = &pNode->items;
807 ++pComponent;
808 }
809
810
811 pItem->orderingHint = placement.
hint;
812
813
814 pItems->insert( find( pItem->name ).second, std::move( pItem ) );
815}
An explicitly nonlocalized string, not meant for the user to see.
const wxString & GET() const
Explicit conversion to wxString, meant to be ugly-looking and demanding of a comment why it's correct...
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
std::unique_ptr< BaseItem > BaseItemPtr
std::vector< BaseItemPtr > BaseItemPtrs