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 <Track.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
 
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...
 
- 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< TrackAttachment >(Track &, size_t)>
 
- Static Protected Member Functions inherited from ChannelAttachmentsBase
static TrackAttachmentGet (const AttachedTrackObjects::RegisteredFactory &key, Track &track, size_t iChannel)
 
static TrackAttachmentFind (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 567 of file Track.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 608 of file Track.h.

609 : ChannelAttachmentsBase{ track, std::forward<F>(f) }
610 {}
Holds multiple objects as a single attachment to Track.
Definition: Track.h:530

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 586 of file Track.h.

589 {
590 return static_cast<Attachment*>(
592 }
static const AudacityProject::AttachedObjects::RegisteredFactory key
static TrackAttachment * Find(const AttachedTrackObjects::RegisteredFactory &key, Track *pTrack, size_t iChannel)
Definition: Track.cpp:1305

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 576 of file Track.h.

579 {
580 return static_cast<Attachment&>(
582 }
static TrackAttachment & Get(const AttachedTrackObjects::RegisteredFactory &key, Track &track, size_t iChannel)
Definition: Track.cpp:1286

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

Referenced by TrackPanelResizerCell::Get(), 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: