mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-03 17:39:25 +02:00
It is an error to copy a WaveClip without specifying the DirManager. Defined break-inducing copy constructor and assignment operator methods so that if some developer makes the mistake of calling a single-arg copy constructor rather than the one below (that requires a DirManager*), rather than it going to C++-generated default copy constructor, it goes here and the error is made clear to that developer.
These are a good idea to add in *many* other places...
This commit is contained in:
parent
a106ae232f
commit
1b1b05947e
@ -59,6 +59,23 @@ WX_DEFINE_USER_EXPORTED_ARRAY_PTR(WaveClip*, WaveClipArray, class AUDACITY_DLL_A
|
|||||||
|
|
||||||
class AUDACITY_DLL_API WaveClip : public XMLTagHandler
|
class AUDACITY_DLL_API WaveClip : public XMLTagHandler
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
// It is an error to copy a WaveClip without specifying the DirManager.
|
||||||
|
// We define these break-inducing single-arg methods so that
|
||||||
|
// if some developer makes the mistake of calling a single-arg copy
|
||||||
|
// constructor rather than the one below (that requires a DirManager*),
|
||||||
|
// rather than it going to C++-generated default copy constructor,
|
||||||
|
// it goes here and the error is made clear to that developer.
|
||||||
|
WaveClip(const WaveClip&)
|
||||||
|
{
|
||||||
|
wxFAIL_MSG(wxT("It is an error to copy a WaveClip without specifying the DirManager."));
|
||||||
|
};
|
||||||
|
WaveClip& operator=(const WaveClip& orig)
|
||||||
|
{
|
||||||
|
WaveClip bogus(orig);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// typical constructor
|
// typical constructor
|
||||||
WaveClip(DirManager *projDirManager, sampleFormat format, int rate);
|
WaveClip(DirManager *projDirManager, sampleFormat format, int rate);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user