1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-30 15:39:27 +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:
v.audacity 2010-09-10 22:02:04 +00:00
parent a106ae232f
commit 1b1b05947e

View File

@ -57,8 +57,25 @@ class WaveClip;
WX_DECLARE_USER_EXPORTED_LIST(WaveClip, WaveClipList, AUDACITY_DLL_API);
WX_DEFINE_USER_EXPORTED_ARRAY_PTR(WaveClip*, WaveClipArray, class AUDACITY_DLL_API);
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:
// typical constructor
WaveClip(DirManager *projDirManager, sampleFormat format, int rate);