refactored FileMode to make more sense

This commit is contained in:
Noel Berry
2021-04-05 01:07:16 -07:00
parent 9e8a181fd2
commit 65f7194e4f
8 changed files with 55 additions and 27 deletions

View File

@ -9,10 +9,17 @@ namespace Blah
enum class FileMode
{
None = 0,
Read = 1 << 0,
Write = 1 << 1,
ReadWrite = Read | Write,
// Opens an existing file for reading.
OpenRead,
// Opens an existing file for reading and writing.
Open,
// Creates a new file or overwrites an existing file for writing.
CreateWrite,
// Creates a new file or overwrites an existing file for reading and writing.
Create,
};
namespace Directory
@ -43,7 +50,7 @@ namespace Blah
bool remove(const FilePath& path);
// Opens the given file and returns a stream
FileStream open(const FilePath& path, FileMode mode = FileMode::ReadWrite);
FileStream open(const FilePath& path, FileMode mode);
}
namespace Path

View File

@ -8,7 +8,7 @@ namespace Blah
{
public:
FileStream();
FileStream(const FilePath& path, FileMode mode = FileMode::ReadWrite);
FileStream(const FilePath& path, FileMode mode);
FileStream(FileStream&& fs) noexcept;
FileStream& operator=(FileStream&& fs) noexcept;
~FileStream();