General: Use the override keyword where applicable

This commit is contained in:
Lioncash 2019-08-15 10:46:30 -04:00
parent 4b7917cc05
commit 8e22dda880
9 changed files with 45 additions and 45 deletions

View File

@ -6,6 +6,6 @@ class LZType10 : public LZBase {
public:
explicit LZType10(atInt32 minimumOffset = 1, atInt32 SlidingWindow = 4096, atInt32 MinimumMatch = 3,
atInt32 BlockSize = 8);
atUint32 compress(const atUint8* src, atUint8** dstBuf, atUint32 srcLength);
atUint32 decompress(const atUint8* src, atUint8** dst, atUint32 srcLen);
atUint32 compress(const atUint8* src, atUint8** dstBuf, atUint32 srcLength) override;
atUint32 decompress(const atUint8* src, atUint8** dst, atUint32 srcLen) override;
};

View File

@ -6,6 +6,6 @@ class LZType11 : public LZBase {
public:
explicit LZType11(atInt32 MinimumOffset = 1, atInt32 SlidingWindow = 4096, atInt32 MinimumMatch = 3,
atInt32 BlockSize = 8);
atUint32 compress(const atUint8* src, atUint8** dst, atUint32 srcLength);
atUint32 decompress(const atUint8* src, atUint8** dst, atUint32 srcLength);
atUint32 compress(const atUint8* src, atUint8** dst, atUint32 srcLength) override;
atUint32 decompress(const atUint8* src, atUint8** dst, atUint32 srcLength) override;
};

View File

@ -18,7 +18,7 @@ class FileReader : public IStreamReader {
public:
FileReader(std::string_view filename, atInt32 cacheSize = (32 * 1024), bool globalErr = true);
FileReader(std::wstring_view filename, atInt32 cacheSize = (32 * 1024), bool globalErr = true);
virtual ~FileReader();
~FileReader() override;
std::string filename() const {
#if _WIN32
@ -40,10 +40,10 @@ public:
void close();
bool isOpen() const { return m_fileHandle != 0; }
bool save();
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
atUint64 position() const;
atUint64 length() const;
atUint64 readUBytesToBuf(void* buf, atUint64 len);
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
atUint64 position() const override;
atUint64 length() const override;
atUint64 readUBytesToBuf(void* buf, atUint64 len) override;
void setCacheSize(const atInt32 blockSize);

View File

@ -15,7 +15,7 @@ class FileWriter : public IStreamWriter {
public:
FileWriter(std::string_view filename, bool overwrite = true, bool globalErr = true);
FileWriter(std::wstring_view filename, bool overwrite = true, bool globalErr = true);
virtual ~FileWriter();
~FileWriter() override;
std::string filename() const {
#if _WIN32
@ -35,10 +35,10 @@ public:
void open(bool overwrite = true);
void close();
bool isOpen() const { return m_fileHandle != 0; }
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
atUint64 position() const;
atUint64 length() const;
void writeUBytes(const atUint8* data, atUint64 len);
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
atUint64 position() const override;
atUint64 length() const override;
void writeUBytes(const atUint8* data, atUint64 len) override;
#if _WIN32
using HandleType = HANDLE;
@ -99,12 +99,12 @@ public:
m_position = 0;
}
atUint64 position() const { return m_position; }
atUint64 length() const { return m_deferredBuffer.size(); }
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
void writeUBytes(const atUint8* data, atUint64 len);
atUint64 position() const override { return m_position; }
atUint64 length() const override { return m_deferredBuffer.size(); }
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
void writeUBytes(const atUint8* data, atUint64 len) override;
~TransactionalFileWriter() { flush(); }
~TransactionalFileWriter() override { flush(); }
};
} // namespace athena::io

View File

@ -15,14 +15,14 @@ namespace athena::io {
*/
class IStreamReader : public IStream {
public:
virtual ~IStreamReader() = default;
~IStreamReader() override = default;
/** @brief Sets the buffers position relative to the specified position.<br />
* It seeks relative to the current position by default.
* @param position where in the buffer to seek
* @param origin The Origin to seek relative to
*/
virtual void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) = 0;
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override = 0;
/** @brief Sets the buffer's position relative to the next 64-byte aligned position.<br />
*/
@ -44,19 +44,19 @@ public:
*
* @return True if at end; False otherwise.
*/
bool atEnd() const { return position() >= length(); }
bool atEnd() const override { return position() >= length(); }
/** @brief Returns the current position in the stream.
*
* @return The current position in the stream.
*/
virtual atUint64 position() const = 0;
atUint64 position() const override = 0;
/** @brief Returns the length of the file.
*
* @return True length of the file.
*/
virtual atUint64 length() const = 0;
atUint64 length() const override = 0;
/** @brief Reads a byte at the current position and advances the current position
*

View File

@ -9,14 +9,14 @@
namespace athena::io {
class IStreamWriter : public IStream {
public:
virtual ~IStreamWriter() = default;
~IStreamWriter() override = default;
/** @brief Sets the buffers position relative to the specified position.<br />
* It seeks relative to the current position by default.
* @param position where in the buffer to seek
* @param origin The location to seek relative to
*/
virtual void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) = 0;
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override = 0;
/** @brief Sets the buffers position relative to the next 32-byte aligned position.<br />
*/
@ -36,19 +36,19 @@ public:
*
* @return True if at end; False otherwise.
*/
bool atEnd() const { return position() >= length(); }
bool atEnd() const override { return position() >= length(); }
/** @brief Returns the current position in the stream.
*
* @return The current position in the stream.
*/
virtual atUint64 position() const = 0;
atUint64 position() const override = 0;
/** @brief Returns whether or not the stream is at the end.
*
* @return True if at end; False otherwise.
*/
virtual atUint64 length() const = 0;
atUint64 length() const override = 0;
/** @brief Writes a byte at the current position and advances the position by one byte.
* @param val The value to write

View File

@ -19,7 +19,7 @@ protected:
MemoryReader() = default;
public:
virtual ~MemoryReader();
~MemoryReader() override;
/*! \brief This constructor references an existing buffer to read from.
*
@ -34,19 +34,19 @@ public:
* \param position where in the buffer to seek
* \param origin The Origin to seek \sa SeekOrigin
*/
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
/*! \brief Returns the current position in the stream.
*
* \return Int64 The current position in the stream.
*/
atUint64 position() const { return m_position; }
atUint64 position() const override { return m_position; }
/*! \brief Returns whether or not the stream is at the end.
*
* \return bool True if at end; False otherwise.
*/
atUint64 length() const { return m_length; }
atUint64 length() const override { return m_length; }
/*! \brief Sets the buffer to the given one, deleting the current one.<br />
* <b>BEWARE:</b> As this deletes the current buffer it WILL cause a loss of data
@ -74,7 +74,7 @@ public:
* \param len Length to read
* \return Number of bytes read
*/
atUint64 readUBytesToBuf(void* buf, atUint64 len);
atUint64 readUBytesToBuf(void* buf, atUint64 len) override;
protected:
const void* m_data = nullptr;

View File

@ -17,7 +17,7 @@ namespace athena::io {
*/
class MemoryWriter : public IStreamWriter {
public:
virtual ~MemoryWriter();
~MemoryWriter() override;
/*! @brief This constructor references an existing buffer to write to in-place.
*
@ -31,19 +31,19 @@ public:
* @param position where in the buffer to seek
* @param origin The Origin to seek @sa SeekOrigin
*/
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
/*! @brief Returns the current position in the stream.
*
* @return Int64 The current position in the stream.
*/
atUint64 position() const { return m_position; }
atUint64 position() const override { return m_position; }
/*! @brief Returns the length of the stream.
*
* @return Int64 The length of the stream.
*/
atUint64 length() const { return m_length; }
atUint64 length() const override { return m_length; }
bool isOpen() const { return true; }
@ -85,7 +85,7 @@ public:
* @param data The buffer to write
* @param length The amount to write
*/
void writeUBytes(const atUint8* data, atUint64 len);
void writeUBytes(const atUint8* data, atUint64 len) override;
protected:
MemoryWriter() {}
@ -116,7 +116,7 @@ public:
* @param position where in the buffer to seek
* @param origin The Origin to seek @sa SeekOrigin
*/
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
/*! @brief Sets the buffer to the given one, deleting the current one.<br />
* <b>BEWARE:</b> As this deletes the current buffer it WILL cause a loss of data
@ -135,7 +135,7 @@ public:
* @param data The buffer to write
* @param length The amount to write
*/
void writeUBytes(const atUint8* data, atUint64 len);
void writeUBytes(const atUint8* data, atUint64 len) override;
protected:
std::unique_ptr<atUint8[]> m_dataCopy;

View File

@ -22,19 +22,19 @@ public:
* @param position where in the buffer to seek
* @param origin The Origin to seek @sa SeekOrigin
*/
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
/*! @brief Returns the current position in the stream.
*
* @return Int64 The current position in the stream.
*/
atUint64 position() const { return m_position; }
atUint64 position() const override { return m_position; }
/*! @brief Returns the length of the stream.
*
* @return Int64 The length of the stream.
*/
atUint64 length() const { return m_data.size(); }
atUint64 length() const override { return m_data.size(); }
bool isOpen() const { return true; }
@ -48,7 +48,7 @@ public:
* @param data The buffer to write
* @param length The amount to write
*/
void writeUBytes(const atUint8* data, atUint64 len);
void writeUBytes(const atUint8* data, atUint64 len) override;
protected:
std::vector<uint8_t> m_data;