11#ifndef __AUDACITY_REGISTRY__
12#define __AUDACITY_REGISTRY__
40 : type(type_),
name(name_) {}
43 {
return name == other.
name && type == other.type; }
48 return std::make_pair( type,
name ) <
49 std::make_pair( other.type, other.
name );
63 :
name{ internalName }
94 {
return std::make_unique<SharedItem>( ptr ); }
105 template<
typename VisitorType >
132 :
BaseItem{ internalName }, items{
std::move( items_ ) }
145 template<
typename VisitorType = ComputedItem::DefaultVisitor >
149 template<
typename... Args >
152 {
Append( std::forward< Args >( args )... ); }
158 template<
typename Arg,
typename... Args >
159 void Append( Arg &&arg, Args&&... moreArgs )
167 Append( std::forward<Args>(moreArgs)... );
173 items.push_back( std::move( ptr ) );
184 return factory(
dynamic_cast< VisitorType&
>( visitor ) );
186 AppendOne( std::make_unique<ComputedItem>( adaptedFactory ) );
189 template<
typename Subtype>
191 {
AppendOne( std::make_unique<SharedItem>(ptr) ); }
195 template<
bool transparent,
208 template<
typename VisitorType = ComputedItem::DefaultVisitor >
235 void RegisterItem( GroupItem ®istry,
const Placement &placement,
245 using Path = std::vector< Identifier >;
246 virtual void BeginGroup(
GroupItem &item,
const Path &path );
260 REGISTRIES_API
void Visit(
272 struct REGISTRIES_API
275 using Pair = std::pair< Literal, Literal >;
286 void operator () ()
override;
const TranslatableString name
An explicitly nonlocalized string, not meant for the user to see.
std::vector< Identifier > Path
void Visit(Visitor &visitor, BaseItem *pTopItem, const GroupItem *pRegistry)
std::unique_ptr< BaseItem > BaseItemPtr
std::vector< BaseItemPtr > BaseItemPtrs
std::unique_ptr< SharedItem > Shared(const BaseItemSharedPtr &ptr)
std::shared_ptr< BaseItem > BaseItemSharedPtr
void RegisterItem(GroupItem ®istry, const Placement &placement, BaseItemPtr pItem)
static RegisteredToolbarFactory factory
OrderingHint orderingHint
BaseItem(const Identifier &internalName)
Factory< DefaultVisitor > factory
ComputedItem(const Factory< DefaultVisitor > &factory_)
std::function< BaseItemSharedPtr(VisitorType &) > Factory
bool Transparent() const override
virtual bool Transparent() const =0
GroupItem(const GroupItem &) PROHIBITED
GroupItem(const Identifier &internalName, BaseItemPtrs &&items_)
void AppendOne(const std::shared_ptr< Subtype > &ptr)
void Append(Arg &&arg, Args &&... moreArgs)
InlineGroupItem(const Identifier &internalName, Args &&... args)
void AppendOne(const ComputedItem::Factory< VisitorType > &factory)
void AppendOne(BaseItemPtr &&ptr)
enum Registry::OrderingHint::Type Unspecified
OrderingHint(Type type_, const wxString &name_={})
bool operator==(const OrderingHint &other) const
bool operator<(const OrderingHint &other) const
std::vector< Pair > Pairs
std::pair< Literal, Literal > Pair
Placement(const wxString &path_, const OrderingHint &hint_={})
SharedItem(const BaseItemSharedPtr &ptr_)
~TransparentGroupItem() override