1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4     Rosegarden
5     A MIDI and audio sequencer and musical notation editor.
6     Copyright 2000-2021 the Rosegarden development team.
7 
8     This program is free software; you can redistribute it and/or
9     modify it under the terms of the GNU General Public License as
10     published by the Free Software Foundation; either version 2 of the
11     License, or (at your option) any later version.  See the file
12     COPYING included with this distribution for more information.
13 */
14 
15 #include <QDataStream>
16 #include "MappedEventList.h"
17 #include "MappedEvent.h"
18 #include "base/SegmentPerformanceHelper.h"
19 
20 namespace Rosegarden
21 {
22 
~MappedEventList()23 MappedEventList::~MappedEventList()
24 {
25     clear();
26 }
27 
28 // copy constructor
MappedEventList(const MappedEventList & mC)29 MappedEventList::MappedEventList(const MappedEventList &mC):
30     std::multiset<MappedEvent *, MappedEvent::MappedEventCmp>()
31 {
32     clear();
33 
34     // deep copy
35     for (MappedEventList::const_iterator it = mC.begin(); it != mC.end(); ++it)
36         insert(new MappedEvent(**it));
37 
38 }
39 
40 MappedEventList &
operator =(const MappedEventList & c)41 MappedEventList::operator=(const MappedEventList &c)
42 {
43     if (&c == this) return *this;
44 
45     clear();
46 
47     for (MappedEventList::const_iterator it = c.begin(); it != c.end(); ++it)
48         insert(new MappedEvent(**it));
49 
50     return *this;
51 }
52 
53 void
merge(const MappedEventList & mC)54 MappedEventList::merge(const MappedEventList &mC)
55 {
56     for (MappedEventList::const_iterator it = mC.begin(); it != mC.end(); ++it)
57         insert(new MappedEvent(**it)); // deep copy
58 }
59 
60 void
clear()61 MappedEventList::clear()
62 {
63     for (MappedEventListIterator it = begin(); it != end(); ++it)
64         delete (*it);
65 
66     erase(begin(), end());
67 }
68 
69 
70 
71 }
72 
73 
74