MCPcopy Create free account
hub / github.com/audacity/audacity / ReplaceOne

Method ReplaceOne

libraries/lib-track/Track.cpp:563–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

561}
562
563Track::Holder TrackList::ReplaceOne(Track &t, TrackList &&with)
564{
565 assert(t.GetOwner().get() == this);
566 assert(!with.empty());
567
568 auto save = t.shared_from_this();
569
570 //! Move one track to the temporary list
571 auto node = t.GetNode();
572 t.SetOwner({}, {});
573
574 //! Redirect the list element of this
575 const auto iter = with.ListOfTracks::begin();
576 const auto pTrack = *iter;
577 *node = pTrack;
578 with.erase(iter);
579 pTrack->SetOwner(shared_from_this(), node);
580 pTrack->SetId(save->GetId());
581 RecalcPositions(node);
582 DeletionEvent(save, true);
583 AdditionEvent(node);
584 return save;
585}
586
587std::shared_ptr<Track> TrackList::Remove(Track &track)
588{

Callers 4

ModifiedAnalysisTrackMethod · 0.80
CommitMethod · 0.80
ApplyPendingTracksMethod · 0.80

Calls 6

GetNodeMethod · 0.80
SetOwnerMethod · 0.80
SetIdMethod · 0.80
GetIdMethod · 0.80
getMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected