Audacity 3.2.0
Public Member Functions | Static Public Member Functions | List of all members
ChannelAttachments< Attachment > Class Template Reference

Holds multiple objects of the parameter type as a single attachment to Track. More...

#include <ChannelAttachments.h>

Inheritance diagram for ChannelAttachments< Attachment >:
[legend]
Collaboration diagram for ChannelAttachments< Attachment >:
[legend]

Public Member Functions

 ~ChannelAttachments () override=default
 
template<typename F , typename sfinae = std::enable_if_t<std::is_convertible_v< std::invoke_result_t<F, Track&, size_t>, std::shared_ptr<Attachment> >>>
 ChannelAttachments (Track &track, F &&f)
 Type-erasing constructor. More...
 
- Public Member Functions inherited from ChannelAttachmentsBase
 ChannelAttachmentsBase (Track &track, Factory factory)
 
 ~ChannelAttachmentsBase () override
 
 ChannelAttachmentsBase (const ChannelAttachmentsBase &)=delete
 
ChannelAttachmentsBaseoperator= (const ChannelAttachmentsBase &)=delete
 
 ChannelAttachmentsBase (ChannelAttachmentsBase &)=delete
 
ChannelAttachmentsBaseoperator= (ChannelAttachmentsBase &&other)
 
size_t Size () const
 
void CopyTo (Track &track) const override
 Copy state, for undo/redo purposes. More...
 
void Reparent (const std::shared_ptr< Track > &parent) override
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
void WriteXMLAttributes (XMLWriter &writer) const override
 Serialize persistent attributes. More...
 
bool HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView) override
 Deserialize an attribute, returning true if recognized. More...
 
void MakeStereo (const std::shared_ptr< Track > &parent, ChannelAttachmentsBase &&other)
 
void SwapChannels (const std::shared_ptr< Track > &parent)
 
void Erase (const std::shared_ptr< Track > &parent, size_t index)
 
- Public Member Functions inherited from TrackAttachment
virtual ~TrackAttachment ()
 
virtual void CopyTo (Track &track) const
 Copy state, for undo/redo purposes. More...
 
virtual void Reparent (const std::shared_ptr< Track > &parent)
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
virtual void WriteXMLAttributes (XMLWriter &) const
 Serialize persistent attributes. More...
 
virtual bool HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView)
 Deserialize an attribute, returning true if recognized. More...
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Static Public Member Functions

static Attachment & Get (const AttachedTrackObjects::RegisteredFactory &key, Track &track, size_t iChannel)
 
static Attachment * Find (const AttachedTrackObjects::RegisteredFactory &key, Track *pTrack, size_t iChannel)
 

Additional Inherited Members

- Public Types inherited from ChannelAttachmentsBase
using Factory = std::function< std::shared_ptr< ChannelAttachment >(Track &, size_t)>
 
- Static Protected Member Functions inherited from ChannelAttachmentsBase
static ChannelAttachmentGet (const AttachedTrackObjects::RegisteredFactory &key, Track &track, size_t iChannel)
 
static ChannelAttachmentFind (const AttachedTrackObjects::RegisteredFactory &key, Track *pTrack, size_t iChannel)
 

Detailed Description

template<typename Attachment>
class ChannelAttachments< Attachment >

Holds multiple objects of the parameter type as a single attachment to Track.

Definition at line 129 of file ChannelAttachments.h.

Constructor & Destructor Documentation

◆ ~ChannelAttachments()

template<typename Attachment >
ChannelAttachments< Attachment >::~ChannelAttachments ( )
overridedefault

◆ ChannelAttachments()

template<typename Attachment >
template<typename F , typename sfinae = std::enable_if_t<std::is_convertible_v< std::invoke_result_t<F, Track&, size_t>, std::shared_ptr<Attachment> >>>
ChannelAttachments< Attachment >::ChannelAttachments ( Track track,
F &&  f 
)
inlineexplicit

Type-erasing constructor.

Template Parameters
Freturns a shared pointer to Attachment (or some subtype of it)
Precondition
f never returns null

f may assume the precondition that the given channel index is less than the given track's number of channels

Definition at line 170 of file ChannelAttachments.h.

171 : ChannelAttachmentsBase{ track, std::forward<F>(f) }
172 {}
Holds multiple objects as a single attachment to Track.

Member Function Documentation

◆ Find()

template<typename Attachment >
static Attachment * ChannelAttachments< Attachment >::Find ( const AttachedTrackObjects::RegisteredFactory key,
Track pTrack,
size_t  iChannel 
)
inlinestatic
Precondition
!pTrack || iChannel < pTrack->NChannels()

Definition at line 148 of file ChannelAttachments.h.

151 {
152 return static_cast<Attachment*>(
154 }
static const AudacityProject::AttachedObjects::RegisteredFactory key
static ChannelAttachment * Find(const AttachedTrackObjects::RegisteredFactory &key, Track *pTrack, size_t iChannel)

References ChannelAttachmentsBase::Find(), anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, and key.

Referenced by ChannelView::FindFromChannelGroup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Get()

template<typename Attachment >
static Attachment & ChannelAttachments< Attachment >::Get ( const AttachedTrackObjects::RegisteredFactory key,
Track track,
size_t  iChannel 
)
inlinestatic
Precondition
iChannel < track.NChannels()

Definition at line 138 of file ChannelAttachments.h.

141 {
142 return static_cast<Attachment&>(
144 }
static ChannelAttachment & Get(const AttachedTrackObjects::RegisteredFactory &key, Track &track, size_t iChannel)

References ChannelAttachmentsBase::Get(), anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, and key.

Referenced by TrackPanelResizerCell::GetFromChannelGroup(), and ChannelView::GetFromChannelGroup().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: