Skip to content
Snippets Groups Projects
Commit 226c5546 authored by MerryMage's avatar MerryMage
Browse files

FileUtil: Missing #include, Add const to IOFile methods

parent 38f4c9cc
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
#include "common/common_types.h" #include "common/common_types.h"
#ifdef _MSC_VER
#include "common/string_util.h"
#endif
// User directory indices for GetUserPath // User directory indices for GetUserPath
enum { enum {
D_USER_IDX, D_USER_IDX,
...@@ -172,7 +176,7 @@ class IOFile : public NonCopyable ...@@ -172,7 +176,7 @@ class IOFile : public NonCopyable
{ {
public: public:
IOFile(); IOFile();
IOFile(std::FILE* file); explicit IOFile(std::FILE* file);
IOFile(const std::string& filename, const char openmode[]); IOFile(const std::string& filename, const char openmode[]);
~IOFile(); ~IOFile();
...@@ -235,10 +239,10 @@ public: ...@@ -235,10 +239,10 @@ public:
return WriteArray(&object, 1); return WriteArray(&object, 1);
} }
bool IsOpen() { return nullptr != m_file; } bool IsOpen() const { return nullptr != m_file; }
// m_good is set to false when a read, write or other function fails // m_good is set to false when a read, write or other function fails
bool IsGood() { return m_good; } bool IsGood() const { return m_good; }
operator void*() { return m_good ? m_file : nullptr; } operator void*() { return m_good ? m_file : nullptr; }
std::FILE* ReleaseHandle(); std::FILE* ReleaseHandle();
...@@ -258,9 +262,6 @@ public: ...@@ -258,9 +262,6 @@ public:
std::FILE* m_file; std::FILE* m_file;
bool m_good; bool m_good;
private:
IOFile(IOFile&);
IOFile& operator=(IOFile& other);
}; };
} // namespace } // namespace
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment