mirror of https://github.com/libAthena/athena.git
General: Use the override keyword where applicable
This commit is contained in:
parent
4b7917cc05
commit
8e22dda880
|
@ -6,6 +6,6 @@ class LZType10 : public LZBase {
|
||||||
public:
|
public:
|
||||||
explicit LZType10(atInt32 minimumOffset = 1, atInt32 SlidingWindow = 4096, atInt32 MinimumMatch = 3,
|
explicit LZType10(atInt32 minimumOffset = 1, atInt32 SlidingWindow = 4096, atInt32 MinimumMatch = 3,
|
||||||
atInt32 BlockSize = 8);
|
atInt32 BlockSize = 8);
|
||||||
atUint32 compress(const atUint8* src, atUint8** dstBuf, atUint32 srcLength);
|
atUint32 compress(const atUint8* src, atUint8** dstBuf, atUint32 srcLength) override;
|
||||||
atUint32 decompress(const atUint8* src, atUint8** dst, atUint32 srcLen);
|
atUint32 decompress(const atUint8* src, atUint8** dst, atUint32 srcLen) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,6 +6,6 @@ class LZType11 : public LZBase {
|
||||||
public:
|
public:
|
||||||
explicit LZType11(atInt32 MinimumOffset = 1, atInt32 SlidingWindow = 4096, atInt32 MinimumMatch = 3,
|
explicit LZType11(atInt32 MinimumOffset = 1, atInt32 SlidingWindow = 4096, atInt32 MinimumMatch = 3,
|
||||||
atInt32 BlockSize = 8);
|
atInt32 BlockSize = 8);
|
||||||
atUint32 compress(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);
|
atUint32 decompress(const atUint8* src, atUint8** dst, atUint32 srcLength) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,7 +18,7 @@ class FileReader : public IStreamReader {
|
||||||
public:
|
public:
|
||||||
FileReader(std::string_view filename, atInt32 cacheSize = (32 * 1024), bool globalErr = true);
|
FileReader(std::string_view filename, atInt32 cacheSize = (32 * 1024), bool globalErr = true);
|
||||||
FileReader(std::wstring_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 {
|
std::string filename() const {
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
|
@ -40,10 +40,10 @@ public:
|
||||||
void close();
|
void close();
|
||||||
bool isOpen() const { return m_fileHandle != 0; }
|
bool isOpen() const { return m_fileHandle != 0; }
|
||||||
bool save();
|
bool save();
|
||||||
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
|
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
|
||||||
atUint64 position() const;
|
atUint64 position() const override;
|
||||||
atUint64 length() const;
|
atUint64 length() const override;
|
||||||
atUint64 readUBytesToBuf(void* buf, atUint64 len);
|
atUint64 readUBytesToBuf(void* buf, atUint64 len) override;
|
||||||
|
|
||||||
void setCacheSize(const atInt32 blockSize);
|
void setCacheSize(const atInt32 blockSize);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class FileWriter : public IStreamWriter {
|
||||||
public:
|
public:
|
||||||
FileWriter(std::string_view filename, bool overwrite = true, bool globalErr = true);
|
FileWriter(std::string_view filename, bool overwrite = true, bool globalErr = true);
|
||||||
FileWriter(std::wstring_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 {
|
std::string filename() const {
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
|
@ -35,10 +35,10 @@ public:
|
||||||
void open(bool overwrite = true);
|
void open(bool overwrite = true);
|
||||||
void close();
|
void close();
|
||||||
bool isOpen() const { return m_fileHandle != 0; }
|
bool isOpen() const { return m_fileHandle != 0; }
|
||||||
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
|
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
|
||||||
atUint64 position() const;
|
atUint64 position() const override;
|
||||||
atUint64 length() const;
|
atUint64 length() const override;
|
||||||
void writeUBytes(const atUint8* data, atUint64 len);
|
void writeUBytes(const atUint8* data, atUint64 len) override;
|
||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
using HandleType = HANDLE;
|
using HandleType = HANDLE;
|
||||||
|
@ -99,12 +99,12 @@ public:
|
||||||
m_position = 0;
|
m_position = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
atUint64 position() const { return m_position; }
|
atUint64 position() const override { return m_position; }
|
||||||
atUint64 length() const { return m_deferredBuffer.size(); }
|
atUint64 length() const override { return m_deferredBuffer.size(); }
|
||||||
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
|
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
|
||||||
void writeUBytes(const atUint8* data, atUint64 len);
|
void writeUBytes(const atUint8* data, atUint64 len) override;
|
||||||
|
|
||||||
~TransactionalFileWriter() { flush(); }
|
~TransactionalFileWriter() override { flush(); }
|
||||||
};
|
};
|
||||||
} // namespace athena::io
|
} // namespace athena::io
|
||||||
|
|
||||||
|
|
|
@ -15,14 +15,14 @@ namespace athena::io {
|
||||||
*/
|
*/
|
||||||
class IStreamReader : public IStream {
|
class IStreamReader : public IStream {
|
||||||
public:
|
public:
|
||||||
virtual ~IStreamReader() = default;
|
~IStreamReader() override = default;
|
||||||
|
|
||||||
/** @brief Sets the buffers position relative to the specified position.<br />
|
/** @brief Sets the buffers position relative to the specified position.<br />
|
||||||
* It seeks relative to the current position by default.
|
* It seeks relative to the current position by default.
|
||||||
* @param position where in the buffer to seek
|
* @param position where in the buffer to seek
|
||||||
* @param origin The Origin to seek relative to
|
* @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 />
|
/** @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.
|
* @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.
|
/** @brief Returns the current position in the stream.
|
||||||
*
|
*
|
||||||
* @return 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.
|
/** @brief Returns the length of the file.
|
||||||
*
|
*
|
||||||
* @return True 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
|
/** @brief Reads a byte at the current position and advances the current position
|
||||||
*
|
*
|
||||||
|
|
|
@ -9,14 +9,14 @@
|
||||||
namespace athena::io {
|
namespace athena::io {
|
||||||
class IStreamWriter : public IStream {
|
class IStreamWriter : public IStream {
|
||||||
public:
|
public:
|
||||||
virtual ~IStreamWriter() = default;
|
~IStreamWriter() override = default;
|
||||||
|
|
||||||
/** @brief Sets the buffers position relative to the specified position.<br />
|
/** @brief Sets the buffers position relative to the specified position.<br />
|
||||||
* It seeks relative to the current position by default.
|
* It seeks relative to the current position by default.
|
||||||
* @param position where in the buffer to seek
|
* @param position where in the buffer to seek
|
||||||
* @param origin The location to seek relative to
|
* @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 />
|
/** @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.
|
* @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.
|
/** @brief Returns the current position in the stream.
|
||||||
*
|
*
|
||||||
* @return 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.
|
/** @brief Returns whether or not the stream is at the end.
|
||||||
*
|
*
|
||||||
* @return True if at end; False otherwise.
|
* @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.
|
/** @brief Writes a byte at the current position and advances the position by one byte.
|
||||||
* @param val The value to write
|
* @param val The value to write
|
||||||
|
|
|
@ -19,7 +19,7 @@ protected:
|
||||||
MemoryReader() = default;
|
MemoryReader() = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~MemoryReader();
|
~MemoryReader() override;
|
||||||
|
|
||||||
/*! \brief This constructor references an existing buffer to read from.
|
/*! \brief This constructor references an existing buffer to read from.
|
||||||
*
|
*
|
||||||
|
@ -34,19 +34,19 @@ public:
|
||||||
* \param position where in the buffer to seek
|
* \param position where in the buffer to seek
|
||||||
* \param origin The Origin to seek \sa SeekOrigin
|
* \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.
|
/*! \brief Returns the current position in the stream.
|
||||||
*
|
*
|
||||||
* \return Int64 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.
|
/*! \brief Returns whether or not the stream is at the end.
|
||||||
*
|
*
|
||||||
* \return bool True if at end; False otherwise.
|
* \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 />
|
/*! \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
|
* <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
|
* \param len Length to read
|
||||||
* \return Number of bytes read
|
* \return Number of bytes read
|
||||||
*/
|
*/
|
||||||
atUint64 readUBytesToBuf(void* buf, atUint64 len);
|
atUint64 readUBytesToBuf(void* buf, atUint64 len) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const void* m_data = nullptr;
|
const void* m_data = nullptr;
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace athena::io {
|
||||||
*/
|
*/
|
||||||
class MemoryWriter : public IStreamWriter {
|
class MemoryWriter : public IStreamWriter {
|
||||||
public:
|
public:
|
||||||
virtual ~MemoryWriter();
|
~MemoryWriter() override;
|
||||||
|
|
||||||
/*! @brief This constructor references an existing buffer to write to in-place.
|
/*! @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 position where in the buffer to seek
|
||||||
* @param origin The Origin to seek @sa SeekOrigin
|
* @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.
|
/*! @brief Returns the current position in the stream.
|
||||||
*
|
*
|
||||||
* @return Int64 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.
|
/*! @brief Returns the length of the stream.
|
||||||
*
|
*
|
||||||
* @return Int64 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; }
|
bool isOpen() const { return true; }
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public:
|
||||||
* @param data The buffer to write
|
* @param data The buffer to write
|
||||||
* @param length The amount to write
|
* @param length The amount to write
|
||||||
*/
|
*/
|
||||||
void writeUBytes(const atUint8* data, atUint64 len);
|
void writeUBytes(const atUint8* data, atUint64 len) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MemoryWriter() {}
|
MemoryWriter() {}
|
||||||
|
@ -116,7 +116,7 @@ public:
|
||||||
* @param position where in the buffer to seek
|
* @param position where in the buffer to seek
|
||||||
* @param origin The Origin to seek @sa SeekOrigin
|
* @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 />
|
/*! @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
|
* <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 data The buffer to write
|
||||||
* @param length The amount to write
|
* @param length The amount to write
|
||||||
*/
|
*/
|
||||||
void writeUBytes(const atUint8* data, atUint64 len);
|
void writeUBytes(const atUint8* data, atUint64 len) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::unique_ptr<atUint8[]> m_dataCopy;
|
std::unique_ptr<atUint8[]> m_dataCopy;
|
||||||
|
|
|
@ -22,19 +22,19 @@ public:
|
||||||
* @param position where in the buffer to seek
|
* @param position where in the buffer to seek
|
||||||
* @param origin The Origin to seek @sa SeekOrigin
|
* @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.
|
/*! @brief Returns the current position in the stream.
|
||||||
*
|
*
|
||||||
* @return Int64 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.
|
/*! @brief Returns the length of the stream.
|
||||||
*
|
*
|
||||||
* @return Int64 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; }
|
bool isOpen() const { return true; }
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public:
|
||||||
* @param data The buffer to write
|
* @param data The buffer to write
|
||||||
* @param length The amount to write
|
* @param length The amount to write
|
||||||
*/
|
*/
|
||||||
void writeUBytes(const atUint8* data, atUint64 len);
|
void writeUBytes(const atUint8* data, atUint64 len) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<uint8_t> m_data;
|
std::vector<uint8_t> m_data;
|
||||||
|
|
Loading…
Reference in New Issue