commit
41101be545
|
@ -908,18 +908,18 @@ IOFile::~IOFile()
|
|||
Close();
|
||||
}
|
||||
|
||||
IOFile::IOFile(IOFile&& other) : m_file(nullptr), m_good(true)
|
||||
IOFile::IOFile(IOFile&& other) noexcept : m_file(nullptr), m_good(true)
|
||||
{
|
||||
Swap(other);
|
||||
}
|
||||
|
||||
IOFile& IOFile::operator=(IOFile&& other)
|
||||
IOFile& IOFile::operator=(IOFile&& other) noexcept
|
||||
{
|
||||
Swap(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void IOFile::Swap(IOFile& other)
|
||||
void IOFile::Swap(IOFile& other) noexcept
|
||||
{
|
||||
std::swap(m_file, other.m_file);
|
||||
std::swap(m_good, other.m_good);
|
||||
|
|
|
@ -168,10 +168,10 @@ public:
|
|||
|
||||
~IOFile();
|
||||
|
||||
IOFile(IOFile&& other);
|
||||
IOFile& operator=(IOFile&& other);
|
||||
IOFile(IOFile&& other) noexcept;
|
||||
IOFile& operator=(IOFile&& other) noexcept;
|
||||
|
||||
void Swap(IOFile& other);
|
||||
void Swap(IOFile& other) noexcept;
|
||||
|
||||
bool Open(const std::string& filename, const char openmode[]);
|
||||
bool Close();
|
||||
|
@ -211,7 +211,7 @@ public:
|
|||
bool IsOpen() const { return nullptr != m_file; }
|
||||
// m_good is set to false when a read, write or other function fails
|
||||
bool IsGood() const { return m_good; }
|
||||
operator void*() { return m_good ? m_file : nullptr; }
|
||||
explicit operator bool() const { return IsGood(); }
|
||||
std::FILE* ReleaseHandle();
|
||||
|
||||
std::FILE* GetHandle() { return m_file; }
|
||||
|
@ -230,12 +230,9 @@ public:
|
|||
std::clearerr(m_file);
|
||||
}
|
||||
|
||||
private:
|
||||
std::FILE* m_file;
|
||||
bool m_good;
|
||||
|
||||
private:
|
||||
IOFile(IOFile&);
|
||||
IOFile& operator=(IOFile& other);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
Loading…
Reference in New Issue