mirror of
https://github.com/libAthena/athena.git
synced 2025-12-08 13:15:05 +00:00
Fix stand alone compiling, minor code updates
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#if _WIN32
|
||||
#ifdef _WIN32
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
@@ -20,14 +20,14 @@ public:
|
||||
~FileWriter() override;
|
||||
|
||||
std::string filename() const {
|
||||
#if _WIN32
|
||||
#ifdef _WIN32
|
||||
return utility::wideToUtf8(m_filename);
|
||||
#else
|
||||
return m_filename;
|
||||
#endif
|
||||
}
|
||||
std::wstring wfilename() const {
|
||||
#if _WIN32
|
||||
#ifdef _WIN32
|
||||
return m_filename;
|
||||
#else
|
||||
return utility::utf8ToWide(m_filename);
|
||||
@@ -36,13 +36,13 @@ public:
|
||||
|
||||
void open(bool overwrite = true);
|
||||
void close();
|
||||
bool isOpen() const { return m_fileHandle != 0; }
|
||||
bool isOpen() const { return m_fileHandle != nullptr; }
|
||||
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
|
||||
#ifdef _WIN32
|
||||
using HandleType = HANDLE;
|
||||
#else
|
||||
using HandleType = FILE*;
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
HandleType _fileHandle() { return m_fileHandle; }
|
||||
|
||||
private:
|
||||
#if _WIN32
|
||||
#ifdef _WIN32
|
||||
std::wstring m_filename;
|
||||
#else
|
||||
std::string m_filename;
|
||||
@@ -61,7 +61,7 @@ private:
|
||||
};
|
||||
|
||||
class TransactionalFileWriter : public IStreamWriter {
|
||||
#if _WIN32
|
||||
#ifdef _WIN32
|
||||
std::wstring m_filename;
|
||||
#else
|
||||
std::string m_filename;
|
||||
@@ -73,7 +73,7 @@ class TransactionalFileWriter : public IStreamWriter {
|
||||
public:
|
||||
explicit TransactionalFileWriter(std::string_view filename, bool overwrite = true, bool globalErr = true)
|
||||
: m_overwrite(overwrite), m_globalErr(globalErr) {
|
||||
#if _WIN32
|
||||
#ifdef _WIN32
|
||||
m_filename = utility::utf8ToWide(filename);
|
||||
#else
|
||||
m_filename = filename;
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
}
|
||||
explicit TransactionalFileWriter(std::wstring_view filename, bool overwrite = true, bool globalErr = true)
|
||||
: m_overwrite(overwrite), m_globalErr(globalErr) {
|
||||
#if _WIN32
|
||||
#ifdef _WIN32
|
||||
m_filename = filename;
|
||||
#else
|
||||
m_filename = utility::wideToUtf8(filename);
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
|
||||
/*! @brief Writes the given buffer with the specified length, buffers can be bigger than the length
|
||||
* however it's undefined behavior to try and write a buffer which is smaller than the given length.
|
||||
* If you are needing to fill in an area please use IStreamWriter::fill(atUint64) instead.
|
||||
* If you are needing to fill in an area please use @sa IStreamWriter::fill(atUint64) instead.
|
||||
*
|
||||
* @param data The buffer to write
|
||||
* @param length The amount to write
|
||||
|
||||
Reference in New Issue
Block a user