utils: Fix file wrapper
This commit is contained in:
parent
3cd177bff2
commit
ea2d181741
@ -25,6 +25,9 @@ namespace hex {
|
||||
|
||||
explicit File(const std::string &path, Mode mode);
|
||||
File();
|
||||
File(const File&) = delete;
|
||||
File(File &&other) noexcept;
|
||||
|
||||
~File();
|
||||
|
||||
bool isValid() { return this->m_file != nullptr; }
|
||||
|
@ -17,6 +17,11 @@ namespace hex {
|
||||
this->m_file = nullptr;
|
||||
}
|
||||
|
||||
File::File(File &&other) noexcept {
|
||||
this->m_file = other.m_file;
|
||||
other.m_file = nullptr;
|
||||
}
|
||||
|
||||
File::~File() {
|
||||
if (isValid())
|
||||
fclose(this->m_file);
|
||||
|
Loading…
Reference in New Issue
Block a user