rest of virtuals removed

virtuals removed and replaced with override where necessary on the rest of the code base, clang-tidy to the rescue.
This commit is contained in:
marauder2k7 2024-03-18 18:40:22 +00:00
parent efbe5e90f5
commit 2b295fb7f0
454 changed files with 4162 additions and 4156 deletions

View file

@ -43,14 +43,14 @@ class FilterStream : public Stream
// Mandatory overrides. By default, these are simply passed to
// whatever is returned from getStream();
protected:
bool _read(const U32 in_numBytes, void* out_pBuffer);
bool _write(const U32 in_numBytes, const void* in_pBuffer);
bool _read(const U32 in_numBytes, void* out_pBuffer) override;
bool _write(const U32 in_numBytes, const void* in_pBuffer) override;
public:
bool hasCapability(const Capability) const;
bool hasCapability(const Capability) const override;
U32 getPosition() const;
bool setPosition(const U32 in_newPosition);
U32 getStreamSize();
U32 getPosition() const override;
bool setPosition(const U32 in_newPosition) override;
U32 getStreamSize() override;
};
#endif //_FILTERSTREAM_H_

View file

@ -48,14 +48,14 @@ namespace Torque
MemFileSystem(String volume);
~MemFileSystem();
String getTypeStr() const { return "Mem"; }
String getTypeStr() const override { return "Mem"; }
FileNodeRef resolve(const Path& path);
FileNodeRef create(const Path& path,FileNode::Mode);
bool remove(const Path& path);
bool rename(const Path& from,const Path& to);
Path mapTo(const Path& path);
Path mapFrom(const Path& path);
FileNodeRef resolve(const Path& path) override;
FileNodeRef create(const Path& path,FileNode::Mode) override;
bool remove(const Path& path) override;
bool rename(const Path& from,const Path& to) override;
Path mapTo(const Path& path) override;
Path mapFrom(const Path& path) override;
private:
String mVolume;
@ -73,21 +73,21 @@ namespace Torque
MemFile(MemFileSystem* fs, MemFileData* fileData);
virtual ~MemFile();
Path getName() const;
NodeStatus getStatus() const;
bool getAttributes(Attributes*);
Path getName() const override;
NodeStatus getStatus() const override;
bool getAttributes(Attributes*) override;
U32 getPosition();
U32 setPosition(U32,SeekMode);
U32 getPosition() override;
U32 setPosition(U32,SeekMode) override;
bool open(AccessMode);
bool close();
bool open(AccessMode) override;
bool close() override;
U32 read(void* dst, U32 size);
U32 write(const void* src, U32 size);
U32 read(void* dst, U32 size) override;
U32 write(const void* src, U32 size) override;
private:
U32 calculateChecksum();
U32 calculateChecksum() override;
MemFileSystem* mFileSystem;
MemFileData* mFileData;
@ -107,20 +107,20 @@ namespace Torque
MemDirectory(MemFileSystem* fs, MemDirectoryData* dir);
~MemDirectory();
Path getName() const;
NodeStatus getStatus() const;
bool getAttributes(Attributes*);
Path getName() const override;
NodeStatus getStatus() const override;
bool getAttributes(Attributes*) override;
bool open();
bool close();
bool read(Attributes*);
bool open() override;
bool close() override;
bool read(Attributes*) override;
private:
friend class MemFileSystem;
MemFileSystem* mFileSystem;
MemDirectoryData* mDirectoryData;
U32 calculateChecksum();
U32 calculateChecksum() override;
NodeStatus mStatus;
U32 mSearchIndex;

View file

@ -177,9 +177,9 @@ class OggTheoraDecoder : public OggDecoder,
void _transcode420toRGBA_SSE2( th_ycbcr_buffer ycbcr, U8* buffer, U32 width, U32 height, U32 pitch );
#endif
// OggDecoder.
virtual bool _detect( ogg_page* startPage );
virtual bool _init();
virtual bool _packetin( ogg_packet* packet );
bool _detect( ogg_page* startPage ) override;
bool _init() override;
bool _packetin( ogg_packet* packet ) override;
///
U32 _getPixelOffset( th_ycbcr_buffer buffer, U32 plane, U32 x, U32 y ) const
@ -258,10 +258,10 @@ class OggTheoraDecoder : public OggDecoder,
void reusePacket( OggTheoraFrame* packet ) { mFreePackets.pushBack( packet ); }
// OggDecoder.
virtual const char* getName() const { return "Theora"; }
const char* getName() const override { return "Theora"; }
// IInputStream.
virtual U32 read( OggTheoraFrame** buffer, U32 num );
U32 read( OggTheoraFrame** buffer, U32 num ) override;
};
#endif // !_OGGTHEORADECODER_H_

View file

@ -64,9 +64,9 @@ class OggVorbisDecoder : public OggDecoder,
#endif
// OggDecoder.
virtual bool _detect( ogg_page* startPage );
virtual bool _init();
virtual bool _packetin( ogg_packet* packet );
bool _detect( ogg_page* startPage ) override;
bool _init() override;
bool _packetin( ogg_packet* packet ) override;
public:
@ -82,10 +82,10 @@ class OggVorbisDecoder : public OggDecoder,
U32 getSamplesPerSecond() const { return mVorbisInfo.rate; }
// OggDecoder.
virtual const char* getName() const { return "Vorbis"; }
const char* getName() const override { return "Vorbis"; }
// IInputStream.
virtual U32 read( RawData** buffer, U32 num );
U32 read( RawData** buffer, U32 num ) override;
};
#endif // !_OGGVORBISDECODER_H_

View file

@ -45,25 +45,25 @@ class ResizeFilterStream : public FilterStream, public IStreamByteCount
ResizeFilterStream();
~ResizeFilterStream();
bool attachStream(Stream* io_pSlaveStream);
void detachStream();
Stream* getStream();
bool attachStream(Stream* io_pSlaveStream) override;
void detachStream() override;
Stream* getStream() override;
bool setStreamOffset(const U32 in_startOffset,
const U32 in_streamLen);
// Mandatory overrides.
protected:
bool _read(const U32 in_numBytes, void* out_pBuffer);
bool _read(const U32 in_numBytes, void* out_pBuffer) override;
public:
U32 getPosition() const;
bool setPosition(const U32 in_newPosition);
U32 getPosition() const override;
bool setPosition(const U32 in_newPosition) override;
U32 getStreamSize();
U32 getStreamSize() override;
// IStreamByteCount
U32 getLastBytesRead() { return m_lastBytesRead; }
U32 getLastBytesWritten() { return 0; }
U32 getLastBytesRead() override { return m_lastBytesRead; }
U32 getLastBytesWritten() override { return 0; }
};
#endif //_RESIZESTREAM_H_

View file

@ -44,7 +44,7 @@ public:
virtual ~FileStreamObject();
DECLARE_CONOBJECT(FileStreamObject);
virtual bool onAdd();
bool onAdd() override;
//-----------------------------------------------------------------------------
/// @brief Open a file

View file

@ -81,16 +81,16 @@ class MemStream : public Stream
protected:
// Stream
bool _read( const U32 in_numBytes, void *out_pBuffer );
bool _write( const U32 in_numBytes, const void *in_pBuffer );
bool _read( const U32 in_numBytes, void *out_pBuffer ) override;
bool _write( const U32 in_numBytes, const void *in_pBuffer ) override;
public:
// Stream
bool hasCapability( const Capability caps ) const;
U32 getPosition() const;
bool setPosition( const U32 in_newPosition );
U32 getStreamSize();
bool hasCapability( const Capability caps ) const override;
U32 getPosition() const override;
bool setPosition( const U32 in_newPosition ) override;
U32 getStreamSize() override;
/// Returns the memory buffer.
void *getBuffer() { return mBufferBase; }

View file

@ -53,7 +53,7 @@ public:
DECLARE_CONOBJECT(StreamObject);
virtual bool onAdd();
bool onAdd() override;
/// Set the stream to allow reuse of the object
void setStream(Stream *stream) { mStream = stream; }

View file

@ -143,8 +143,8 @@ private:
public:
TorqueThreadStatic( T instanceVal ) : mInstance( instanceVal ) {}
virtual void *getMemInstPtr() { return &mInstance; }
virtual const void *getConstMemInstPtr() const { return &mInstance; }
void *getMemInstPtr() override { return &mInstance; }
const void *getConstMemInstPtr() const override { return &mInstance; }
// I am not sure these are needed, and I don't want to create confusing-to-debug code
#if 0

View file

@ -31,7 +31,7 @@ class DXT5nmSwizzle : public Swizzle<U8, 4>
public:
DXT5nmSwizzle() : Swizzle<U8, 4>( NULL ) {};
virtual void InPlace( void *memory, const dsize_t size ) const
void InPlace( void *memory, const dsize_t size ) const override
{
AssertFatal( size % 4 == 0, "Bad buffer size for DXT5nm Swizzle" );
@ -50,7 +50,7 @@ public:
}
}
virtual void ToBuffer( void *destination, const void *source, const dsize_t size ) const
void ToBuffer( void *destination, const void *source, const dsize_t size ) const override
{
AssertFatal( size % 4 == 0, "Bad buffer size for DXT5nm Swizzle" );
@ -77,12 +77,12 @@ class DXT5nmSwizzleUp24t32 : public Swizzle<U8, 3>
public:
DXT5nmSwizzleUp24t32() : Swizzle<U8, 3>( NULL ) {};
virtual void InPlace( void *memory, const dsize_t size ) const
void InPlace( void *memory, const dsize_t size ) const override
{
AssertISV( false, "Cannot swizzle in place a 24->32 bit swizzle." );
}
virtual void ToBuffer( void *destination, const void *source, const dsize_t size ) const
void ToBuffer( void *destination, const void *source, const dsize_t size ) const override
{
AssertFatal( size % 3 == 0, "Bad buffer size for DXT5nm Swizzle" );
const S32 pixels = size / 3;

View file

@ -81,9 +81,9 @@ class NullSwizzle : public Swizzle<T, mapLength>
public:
NullSwizzle( const dsize_t *map = NULL ) : Swizzle<T, mapLength>( map ) {};
virtual void InPlace( void *memory, const dsize_t size ) const {}
void InPlace( void *memory, const dsize_t size ) const override {}
virtual void ToBuffer( void *destination, const void *source, const dsize_t size ) const
void ToBuffer( void *destination, const void *source, const dsize_t size ) const override
{
dMemcpy( destination, source, size );
}

View file

@ -65,8 +65,8 @@ public:
CentralDir(FileHeader &fh);
virtual ~CentralDir();
virtual bool read(Stream *stream);
virtual bool write(Stream *stream);
bool read(Stream *stream) override;
bool write(Stream *stream) override;
void setFileComment(const char *comment);
};

View file

@ -51,15 +51,15 @@ public:
inline void setFileEndPos(S32 pos) { mFileEndPos = pos; }
// Overrides of FilterStream
bool attachStream(Stream* io_pSlaveStream);
void detachStream();
Stream *getStream() { return mStream; }
bool attachStream(Stream* io_pSlaveStream) override;
void detachStream() override;
Stream *getStream() override { return mStream; }
U32 getPosition() const;
bool setPosition(const U32 in_newPosition);
U32 getPosition() const override;
bool setPosition(const U32 in_newPosition) override;
protected:
bool _read(const U32 in_numBytes, void* out_pBuffer);
bool _read(const U32 in_numBytes, void* out_pBuffer) override;
void updateKeys(const U8 c);
U8 decryptByte();

View file

@ -109,7 +109,7 @@ protected:
CentralDir *mCD;
virtual bool _write(const U32 numBytes, const void *buffer)
bool _write(const U32 numBytes, const void *buffer) override
{
if(! mStream->write(numBytes, buffer))
return false;
@ -120,7 +120,7 @@ protected:
return true;
}
virtual bool _read(const U32 numBytes, void *buffer)
bool _read(const U32 numBytes, void *buffer) override
{
if(! mStream->read(numBytes, buffer))
return false;
@ -139,7 +139,7 @@ public:
detachStream();
}
virtual bool attachStream(Stream *stream)
bool attachStream(Stream *stream) override
{
if(mCD == NULL)
return false;
@ -150,7 +150,7 @@ public:
return true;
}
virtual void detachStream()
void detachStream() override
{
if(mStream == NULL)
return;
@ -160,7 +160,7 @@ public:
mStream = NULL;
}
virtual Stream *getStream() { return mStream; }
Stream *getStream() override { return mStream; }
void setCentralDir(CentralDir *cd) { mCD = cd; }
CentralDir *getCentralDir() { return mCD; }

View file

@ -47,8 +47,8 @@ class ZipSubRStream : public FilterStream, public IStreamByteCount
U32 fillBuffer(const U32 in_attemptSize);
public:
virtual U32 getLastBytesRead() { return m_lastBytesRead; }
virtual U32 getLastBytesWritten() { return 0; }
U32 getLastBytesRead() override { return m_lastBytesRead; }
U32 getLastBytesWritten() override { return 0; }
public:
@ -57,23 +57,23 @@ public:
// Overrides of NFilterStream
public:
bool attachStream(Stream* io_pSlaveStream);
void detachStream();
Stream* getStream();
bool attachStream(Stream* io_pSlaveStream) override;
void detachStream() override;
Stream* getStream() override;
void setUncompressedSize(const U32);
// Mandatory overrides. By default, these are simply passed to
// whatever is returned from getStream();
protected:
bool _read(const U32 in_numBytes, void* out_pBuffer);
bool _read(const U32 in_numBytes, void* out_pBuffer) override;
public:
bool hasCapability(const Capability) const;
bool hasCapability(const Capability) const override;
U32 getPosition() const;
bool setPosition(const U32 in_newPosition);
U32 getPosition() const override;
bool setPosition(const U32 in_newPosition) override;
U32 getStreamSize();
U32 getStreamSize() override;
};
class ZipSubWStream : public FilterStream, public IStreamByteCount
@ -91,8 +91,8 @@ class ZipSubWStream : public FilterStream, public IStreamByteCount
U32 m_lastBytesWritten;
public:
virtual U32 getLastBytesRead() { return m_lastBytesRead; }
virtual U32 getLastBytesWritten() { return m_lastBytesWritten; }
U32 getLastBytesRead() override { return m_lastBytesRead; }
U32 getLastBytesWritten() override { return m_lastBytesWritten; }
public:
ZipSubWStream();
@ -100,22 +100,22 @@ public:
// Overrides of NFilterStream
public:
bool attachStream(Stream* io_pSlaveStream);
void detachStream();
Stream* getStream();
bool attachStream(Stream* io_pSlaveStream) override;
void detachStream() override;
Stream* getStream() override;
// Mandatory overrides. By default, these are simply passed to
// whatever is returned from getStream();
protected:
bool _read(const U32 in_numBytes, void* out_pBuffer);
bool _write(const U32 in_numBytes, const void* in_pBuffer);
bool _read(const U32 in_numBytes, void* out_pBuffer) override;
bool _write(const U32 in_numBytes, const void* in_pBuffer) override;
public:
bool hasCapability(const Capability) const;
bool hasCapability(const Capability) const override;
U32 getPosition() const;
bool setPosition(const U32 in_newPosition);
U32 getPosition() const override;
bool setPosition(const U32 in_newPosition) override;
U32 getStreamSize();
U32 getStreamSize() override;
};
#endif //_ZIPSUBSTREAM_H_

View file

@ -60,7 +60,7 @@ public:
return open(String(), Torque::FS::File::ReadWrite);
}
virtual void close()
void close() override
{
Parent::close();
@ -70,7 +70,7 @@ public:
}
/// Disallow setPosition()
virtual bool setPosition(const U32 i_newPosition) { return false; }
bool setPosition(const U32 i_newPosition) override { return false; }
/// Seek back to the start of the file.
/// This is used internally by the zip code and should never be called whilst

View file

@ -54,8 +54,8 @@ public:
close();
}
virtual Path getName() const { return mZipFilename; }
virtual NodeStatus getStatus() const
Path getName() const override { return mZipFilename; }
NodeStatus getStatus() const override
{
if (mZipStream)
{
@ -76,7 +76,7 @@ public:
return FileNode::Closed;
}
virtual bool getAttributes(Attributes* attr)
bool getAttributes(Attributes* attr) override
{
if (!attr)
return false;
@ -92,7 +92,7 @@ public:
return true;
}
virtual U32 getPosition()
U32 getPosition() override
{
if (mZipStream)
return mZipStream->getPosition();
@ -100,7 +100,7 @@ public:
return 0;
}
virtual U32 setPosition(U32 pos, SeekMode mode)
U32 setPosition(U32 pos, SeekMode mode) override
{
if (!mZipStream || mode != Begin)
return 0;
@ -108,7 +108,7 @@ public:
return mZipStream->setPosition(pos);
}
virtual bool open(AccessMode mode)
bool open(AccessMode mode) override
{
// stream is already open so just check to make sure that they are using a valid mode
if (mode == Read)
@ -120,7 +120,7 @@ public:
}
}
virtual bool close()
bool close() override
{
if (mZipStream != NULL && mArchive != NULL)
{
@ -131,7 +131,7 @@ public:
return true;
}
virtual U32 read(void* dst, U32 size)
U32 read(void* dst, U32 size) override
{
if (mZipStream && mZipStream->read(size, dst) && mByteCount)
return mByteCount->getLastBytesRead();
@ -139,7 +139,7 @@ public:
return 0;
}
virtual U32 write(const void* src, U32 size)
U32 write(const void* src, U32 size) override
{
if (mZipStream && mZipStream->write(size, src) && mByteCount)
return mByteCount->getLastBytesWritten();
@ -148,7 +148,7 @@ public:
}
protected:
virtual U32 calculateChecksum()
U32 calculateChecksum() override
{
// JMQ: implement
return 0;
@ -180,15 +180,15 @@ public:
{
}
Torque::Path getName() const { return mPath; }
Torque::Path getName() const override { return mPath; }
// getStatus() doesn't appear to be used for directories
NodeStatus getStatus() const
NodeStatus getStatus() const override
{
return FileNode::Open;
}
bool getAttributes(Attributes* attr)
bool getAttributes(Attributes* attr) override
{
if (!attr)
return false;
@ -204,20 +204,20 @@ public:
return true;
}
bool open()
bool open() override
{
// reset iterator
if (mZipEntry)
mChildIter = mZipEntry->mChildren.begin();
return (mZipEntry != NULL && mArchive.getPointer() != NULL);
}
bool close()
bool close() override
{
if (mZipEntry)
mChildIter = mZipEntry->mChildren.end();
return true;
}
bool read(Attributes* attr)
bool read(Attributes* attr) override
{
if (!attr)
return false;
@ -244,7 +244,7 @@ public:
}
private:
U32 calculateChecksum()
U32 calculateChecksum() override
{
return 0;
}
@ -273,15 +273,15 @@ public:
{
}
Torque::Path getName() const { return mPath; }
Torque::Path getName() const override { return mPath; }
// getStatus() doesn't appear to be used for directories
NodeStatus getStatus() const
NodeStatus getStatus() const override
{
return FileNode::Open;
}
bool getAttributes(Attributes* attr)
bool getAttributes(Attributes* attr) override
{
if (!attr)
return false;
@ -299,17 +299,17 @@ public:
return true;
}
bool open()
bool open() override
{
mRead = false;
return (mArchive.getPointer() != NULL);
}
bool close()
bool close() override
{
mRead = false;
return true;
}
bool read(Attributes* attr)
bool read(Attributes* attr) override
{
if (!attr)
return false;
@ -336,7 +336,7 @@ public:
}
private:
U32 calculateChecksum()
U32 calculateChecksum() override
{
return 0;
}

View file

@ -38,25 +38,25 @@ public:
ZipFileSystem(String& zipFilename, bool zipNameIsDir = false);
virtual ~ZipFileSystem();
String getTypeStr() const { return "Zip"; }
String getTypeStr() const override { return "Zip"; }
// Strict resolve function will reteurn a node if it is mounted *AS* the requested path.
FileNodeRef resolve(const Path& path);
FileNodeRef resolve(const Path& path) override;
// Loose resolve function will return a node if it is mounted as or under the requested path.
// This is needed so mounted subdirectories will be included in recursive FindByPatern searches.
// i.e. If data/ui.zip is mounted as data/ui, a search for data/*.module will only include files
// under data/ui if the loose resolve function is used.
FileNodeRef resolveLoose(const Path& path);
FileNodeRef resolveLoose(const Path& path) override;
// these are unsupported, ZipFileSystem is currently read only access
FileNodeRef create(const Path& path,FileNode::Mode) { return 0; }
bool remove(const Path& path) { return 0; }
bool rename(const Path& a,const Path& b) { return 0; }
FileNodeRef create(const Path& path,FileNode::Mode) override { return 0; }
bool remove(const Path& path) override { return 0; }
bool rename(const Path& a,const Path& b) override { return 0; }
// these are unsupported
Path mapTo(const Path& path) { return path; }
Path mapFrom(const Path& path) { return path; }
Path mapTo(const Path& path) override { return path; }
Path mapFrom(const Path& path) override { return path; }
public:
/// Private interface for use by unit test only.

View file

@ -55,17 +55,17 @@ namespace FS
VirtualMountSystem() : mUseParentFind(false) {}
virtual ~VirtualMountSystem() { }
virtual bool mount(String root, FileSystemRef fs);
virtual bool mount(String root, const Path &path);
virtual FileSystemRef unmount(String root);
virtual bool unmount(FileSystemRef fs);
virtual S32 findByPattern( const Path &inBasePath, const String &inFilePattern, bool inRecursive, Vector<String> &outList, bool includeDirs=false, bool multiMatch = true );
virtual bool createPath(const Path& path);
bool mount(String root, FileSystemRef fs) override;
bool mount(String root, const Path &path) override;
FileSystemRef unmount(String root) override;
bool unmount(FileSystemRef fs) override;
S32 findByPattern( const Path &inBasePath, const String &inFilePattern, bool inRecursive, Vector<String> &outList, bool includeDirs=false, bool multiMatch = true ) override;
bool createPath(const Path& path) override;
protected:
virtual void _log(const String& msg);
virtual FileSystemRef _removeMountFromList(String root);
virtual FileSystemRef _getFileSystemFromList(const Path& path) const ;
void _log(const String& msg) override;
FileSystemRef _removeMountFromList(String root) override;
FileSystemRef _getFileSystemFromList(const Path& path) const override ;
// Vector of file system refs
typedef Vector<FileSystemRef> RootToFSVec;

View file

@ -384,14 +384,14 @@ class FileSystemRedirect: public FileSystem
public:
FileSystemRedirect(MountSystem* mfs,const Path& path);
String getTypeStr() const { return "Redirect"; }
String getTypeStr() const override { return "Redirect"; }
FileNodeRef resolve(const Path& path);
FileNodeRef create(const Path& path,FileNode::Mode);
bool remove(const Path& path);
bool rename(const Path& a,const Path& b);
Path mapTo(const Path& path);
Path mapFrom(const Path& path);
FileNodeRef resolve(const Path& path) override;
FileNodeRef create(const Path& path,FileNode::Mode) override;
bool remove(const Path& path) override;
bool rename(const Path& a,const Path& b) override;
Path mapTo(const Path& path) override;
Path mapFrom(const Path& path) override;
private:
Path _merge(const Path& path);
@ -406,14 +406,14 @@ public:
FileSystemRedirectChangeNotifier( FileSystem *fs );
bool addNotification( const Path &path, ChangeDelegate callback );
bool removeNotification( const Path &path, ChangeDelegate callback );
bool addNotification( const Path &path, ChangeDelegate callback ) override;
bool removeNotification( const Path &path, ChangeDelegate callback ) override;
protected:
virtual void internalProcessOnce() {}
virtual bool internalAddNotification( const Path &dir ) { return false; }
virtual bool internalRemoveNotification( const Path &dir ) { return false; }
void internalProcessOnce() override {}
bool internalAddNotification( const Path &dir ) override { return false; }
bool internalRemoveNotification( const Path &dir ) override { return false; }
};
FileSystemRedirectChangeNotifier::FileSystemRedirectChangeNotifier( FileSystem *fs )