1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-16 17:41:14 +01:00

Replace virtual with override wherever possible; eliminate needless virtual...

... for functions in final classes.

override is like const -- it's not necessary, but it helps the compiler to
catch mistakes.

There may be some overriding functions not explicitly declared virtual and I did
not identify such cases, in which I might also add override.
This commit is contained in:
Paul Licameli
2016-02-24 01:06:47 -05:00
parent 74121c1494
commit 990080ae7d
169 changed files with 1652 additions and 1639 deletions

View File

@@ -36,32 +36,32 @@ class ODComputeSummaryTask final : public ODTask
ODComputeSummaryTask();
virtual ~ODComputeSummaryTask(){};
virtual ODTask* Clone();
ODTask* Clone() override;
///Subclasses should override to return respective type.
virtual unsigned int GetODType(){return eODPCMSummary;}
unsigned int GetODType() override { return eODPCMSummary; }
///Return the task name
virtual const char* GetTaskName(){return "ODComputeSummaryTask";}
const char* GetTaskName() override { return "ODComputeSummaryTask"; }
virtual const wxChar* GetTip(){return _("Import complete. Calculating waveform");}
const wxChar* GetTip() override { return _("Import complete. Calculating waveform"); }
virtual bool UsesCustomWorkUntilPercentage(){return true;}
virtual float ComputeNextWorkUntilPercentageComplete();
bool UsesCustomWorkUntilPercentage() override { return true; }
float ComputeNextWorkUntilPercentageComplete() override;
///releases memory that the ODTask owns. Subclasses should override.
virtual void Terminate();
void Terminate() override;
protected:
///recalculates the percentage complete.
virtual void CalculatePercentComplete();
void CalculatePercentComplete() override;
///Computes and writes the data for one BlockFile if it still has a refcount.
virtual void DoSomeInternal();
void DoSomeInternal() override;
///Readjusts the blockfile order in the default manner. If we have had an ODRequest
///Then it updates in the OD manner.
virtual void Update();
void Update() override;
///Orders the input as either On-Demand or default layered order.
void OrderBlockFiles(std::vector<ODPCMAliasBlockFile*> &unorderedBlocks);

View File

@@ -68,11 +68,11 @@ public:
///this->ReadData(sampleData, floatSample, 0, mLen);
///This class should call ReadHeader() first, so it knows the length, and can prepare
///the file object if it needs to.
virtual int Decode(SampleBuffer & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel);
int Decode(SampleBuffer & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel) override;
///This is a must implement abstract virtual in the superclass.
///However it doesn't do anything because ImportFFMpeg does all that for us.
virtual bool ReadHeader() {return true;}
bool ReadHeader() override {return true;}
bool SeekingAllowed() ;

View File

@@ -31,13 +31,13 @@ class ODDecodeFFmpegTask final : public ODDecodeTask
ODDecodeFFmpegTask(void* scs,int numStreams, WaveTrack*** channels, void* formatContext, int streamIndex);
virtual ~ODDecodeFFmpegTask();
virtual ODTask* Clone();
ODTask* Clone() override;
///Creates an ODFileDecoder that decodes a file of filetype the subclass handles.
virtual ODFileDecoder* CreateFileDecoder(const wxString & fileName);
ODFileDecoder* CreateFileDecoder(const wxString & fileName) override;
///Lets other classes know that this class handles the ffmpeg type
///Subclasses should override to return respective type.
virtual unsigned int GetODType(){return eODFFMPEG;}
unsigned int GetODType() override {return eODFFMPEG;}
protected:
WaveTrack*** mChannels;

View File

@@ -51,13 +51,13 @@ class ODDecodeFlacTask final : public ODDecodeTask
virtual ~ODDecodeFlacTask();
virtual ODTask* Clone();
ODTask* Clone() override;
///Creates an ODFileDecoder that decodes a file of filetype the subclass handles.
virtual ODFileDecoder* CreateFileDecoder(const wxString & fileName);
ODFileDecoder* CreateFileDecoder(const wxString & fileName) override;
///Lets other classes know that this class handles flac
///Subclasses should override to return respective type.
virtual unsigned int GetODType(){return eODFLAC;}
unsigned int GetODType() override { return eODFLAC; }
};
@@ -83,10 +83,10 @@ class ODFLACFile final : public FLAC::Decoder::File
wxArrayString mComments;
protected:
virtual FLAC__StreamDecoderWriteStatus write_callback(const FLAC__Frame *frame,
const FLAC__int32 * const buffer[]);
virtual void metadata_callback(const FLAC__StreamMetadata *metadata);
virtual void error_callback(FLAC__StreamDecoderErrorStatus status);
FLAC__StreamDecoderWriteStatus write_callback(const FLAC__Frame *frame,
const FLAC__int32 * const buffer[]) override;
void metadata_callback(const FLAC__StreamMetadata *metadata) override;
void error_callback(FLAC__StreamDecoderErrorStatus status) override;
};
@@ -106,12 +106,12 @@ public:
///this->ReadData(sampleData, floatSample, 0, mLen);
///This class should call ReadHeader() first, so it knows the length, and can prepare
///the file object if it needs to.
virtual int Decode(SampleBuffer & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel);
int Decode(SampleBuffer & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel) override;
///Read header. Subclasses must override. Probably should save the info somewhere.
///Ideally called once per decoding of a file. This complicates the task because
virtual bool ReadHeader();
bool ReadHeader() override;
///FLAC specific file (inherited from FLAC::Decoder::File)
ODFLACFile* GetFlacFile();

View File

@@ -45,19 +45,20 @@ class ODDecodeTask /* not final */ : public ODTask
virtual ODTask* Clone()=0;
// NEW virtual:
virtual bool SeekingAllowed();
///changes the tasks associated with this Waveform to process the task from a different point in the track
///this is overridden from ODTask because certain classes don't allow users to seek sometimes, or not at all.
virtual void DemandTrackUpdate(WaveTrack* track, double seconds);
void DemandTrackUpdate(WaveTrack* track, double seconds) override;
///Return the task name
virtual const char* GetTaskName(){return "ODDecodeTask";}
const char* GetTaskName() override { return "ODDecodeTask"; }
virtual const wxChar* GetTip(){return _("Decoding Waveform");}
const wxChar* GetTip() override { return _("Decoding Waveform"); }
///Subclasses should override to return respective type.
virtual unsigned int GetODType(){return eODNone;}
unsigned int GetODType() override { return eODNone; }
///Creates an ODFileDecoder that decodes a file of filetype the subclass handles.
virtual ODFileDecoder* CreateFileDecoder(const wxString & fileName)=0;
@@ -67,6 +68,7 @@ class ODDecodeTask /* not final */ : public ODTask
///Blocks that have IsDataAvailable()==false are blockfiles to be decoded. if BlockFile::GetDecodeType()==ODDecodeTask::GetODType() then
///this decoder should handle it. Decoders are accessible with the methods below. These aren't thread-safe and should only
///be called from the decoding thread.
// NEW virtuals:
virtual ODFileDecoder* GetOrCreateMatchingFileDecoder(ODDecodeBlockFile* blockFile);
virtual int GetNumFileDecoders();
@@ -74,14 +76,14 @@ class ODDecodeTask /* not final */ : public ODTask
protected:
///recalculates the percentage complete.
virtual void CalculatePercentComplete();
void CalculatePercentComplete() override;
///Computes and writes the data for one BlockFile if it still has a refcount.
virtual void DoSomeInternal();
void DoSomeInternal() override;
///Readjusts the blockfile order in the default manner. If we have had an ODRequest
///Then it updates in the OD manner.
virtual void Update();
void Update() override;
///Orders the input as either On-Demand or default layered order.
void OrderBlockFiles(std::vector<ODDecodeBlockFile*> &unorderedBlocks);

View File

@@ -135,7 +135,7 @@ public:
protected:
///Executes a part of the task
virtual void* Entry();
void* Entry() override;
ODTask* mTask;
};

View File

@@ -57,7 +57,7 @@ class ODWaveTrackTaskQueue final
void MakeWaveTrackIndependent(WaveTrack* track);
///returns whether or not this queue's task list and another's can merge together, as when we make two mono tracks stereo.
virtual bool CanMergeWith(ODWaveTrackTaskQueue* otherQueue);
bool CanMergeWith(ODWaveTrackTaskQueue* otherQueue);
void MergeWaveTrack(WaveTrack* track);