1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-18 00:54:19 +00:00

Added copy constructor and copy assignment operator to MidiFile

This commit is contained in:
ed 2016-12-02 12:45:42 +00:00
parent 8e7ed3ae7d
commit 17600a2902
2 changed files with 22 additions and 1 deletions

View file

@ -178,6 +178,21 @@ MidiFile::~MidiFile()
{
}
MidiFile::MidiFile (const MidiFile& other)
: timeFormat (other.timeFormat)
{
tracks.addCopiesOf (other.tracks);
}
MidiFile& MidiFile::operator= (const MidiFile& other)
{
timeFormat = other.timeFormat;
tracks.clear();
tracks.addCopiesOf (other.tracks);
return *this;
}
void MidiFile::clear()
{
tracks.clear();

View file

@ -50,6 +50,12 @@ public:
/** Destructor. */
~MidiFile();
/** Creates a copy of another MidiFile. */
MidiFile (const MidiFile& other);
/** Copies from another MidiFile object */
MidiFile& operator= (const MidiFile& other);
//==============================================================================
/** Returns the number of tracks in the file.
@see getTrack, addTrack
@ -173,7 +179,7 @@ private:
void readNextTrack (const uint8*, int size);
void writeTrack (OutputStream&, int trackNum);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiFile)
JUCE_LEAK_DETECTOR (MidiFile)
};