Core/OpenMode: Rename ReadOnly/WriteOnly to Read/Write

This commit is contained in:
Lynix
2023-12-25 19:49:03 +01:00
parent 754a3d3614
commit 4065fbfb1a
24 changed files with 42 additions and 42 deletions

View File

@@ -98,13 +98,13 @@ namespace Nz
Defer, //< Defers file opening until a read/write operation is performed on it
Lock, //< Prevents file modification by other handles while it's open
MustExist, //< Fails if the file doesn't exists, even if opened in write mode
ReadOnly, //< Allows read operations
Read, //< Allows read operations
Text, //< Opens in text mode (converts system line endings from/to \n)
Truncate, //< Creates the file if it doesn't exist and empties it otherwise
Unbuffered, //< Each read/write operations are performed directly using system calls (very slow)
WriteOnly, //< Allows write operations, creates the file if it doesn't exist
Write, //< Allows write operations, creates the file if it doesn't exist
Max = WriteOnly
Max = Write
};
template<>
@@ -115,7 +115,7 @@ namespace Nz
using OpenModeFlags = Flags<OpenMode>;
constexpr OpenModeFlags OpenMode_ReadWrite = OpenMode::ReadOnly | OpenMode::WriteOnly;
constexpr OpenModeFlags OpenMode_ReadWrite = OpenMode::Read | OpenMode::Write;
enum class ParameterType
{

View File

@@ -91,7 +91,7 @@ namespace Nz
{
if (!file.IsOpen())
{
if (!file.Open(OpenMode::ReadOnly))
if (!file.Open(OpenMode::Read))
{
NazaraErrorFmt("failed to load resource: unable to open \"{0}\"", filePath);
return nullptr;

View File

@@ -91,7 +91,7 @@ namespace Nz
{
File file(filePath);
if (!file.Open(OpenMode::WriteOnly | OpenMode::Truncate))
if (!file.Open(OpenMode::Write | OpenMode::Truncate))
{
NazaraErrorFmt("failed to save to file: unable to open \"{0}\" in write mode", filePath);
return false;

View File

@@ -142,7 +142,7 @@ namespace Nz
inline bool Stream::IsReadable() const
{
return m_openMode.Test(OpenMode::ReadOnly);
return m_openMode.Test(OpenMode::Read);
}
/*!
@@ -169,7 +169,7 @@ namespace Nz
*/
inline bool Stream::IsWritable() const
{
return m_openMode.Test(OpenMode::WriteOnly);
return m_openMode.Test(OpenMode::Write);
}
/*!

View File

@@ -17,7 +17,7 @@ namespace Nz
class NAZARA_CORE_API VirtualDirectoryFilesystemResolver : public VirtualDirectoryResolver
{
public:
inline VirtualDirectoryFilesystemResolver(std::filesystem::path physicalPath, OpenModeFlags fileOpenMode = OpenMode::ReadOnly | OpenMode::Defer);
inline VirtualDirectoryFilesystemResolver(std::filesystem::path physicalPath, OpenModeFlags fileOpenMode = OpenMode::Read | OpenMode::Defer);
VirtualDirectoryFilesystemResolver(const VirtualDirectoryFilesystemResolver&) = delete;
VirtualDirectoryFilesystemResolver(VirtualDirectoryFilesystemResolver&&) = delete;
~VirtualDirectoryFilesystemResolver() = default;

View File

@@ -155,7 +155,7 @@ namespace Nz
inline void NetPacket::Reset(UInt16 netCode, const void* ptr, std::size_t size)
{
InitStream(HeaderSize + size, HeaderSize, OpenMode::ReadOnly);
InitStream(HeaderSize + size, HeaderSize, OpenMode::Read);
m_buffer->Resize(HeaderSize + size);
if (ptr)