Typo fix and ctor params reordering.
This commit is contained in:
parent
c9a99f7e99
commit
f132916a0f
2 changed files with 18 additions and 16 deletions
|
@ -9,13 +9,13 @@ namespace cloonel {
|
||||||
namespace {
|
namespace {
|
||||||
///---------------------------------------------------------------------
|
///---------------------------------------------------------------------
|
||||||
///---------------------------------------------------------------------
|
///---------------------------------------------------------------------
|
||||||
PHYSFS_File* OpenPhysFSFile (const char* parPath, PhysycsFSFile::OpenMode parMode) {
|
PHYSFS_File* OpenPhysFSFile (const char* parPath, PhysicsFSFile::OpenMode parMode) {
|
||||||
switch (parMode) {
|
switch (parMode) {
|
||||||
case PhysycsFSFile::OpenMode_Read:
|
case PhysicsFSFile::OpenMode_Read:
|
||||||
return PHYSFS_openRead(parPath);
|
return PHYSFS_openRead(parPath);
|
||||||
case PhysycsFSFile::OpenMode_Write:
|
case PhysicsFSFile::OpenMode_Write:
|
||||||
return PHYSFS_openWrite(parPath);
|
return PHYSFS_openWrite(parPath);
|
||||||
case PhysycsFSFile::OpenMode_Append:
|
case PhysicsFSFile::OpenMode_Append:
|
||||||
return PHYSFS_openAppend(parPath);
|
return PHYSFS_openAppend(parPath);
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -59,7 +59,7 @@ namespace cloonel {
|
||||||
|
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
PhysycsFSFile::PhysycsFSFile (const char* parPath, OpenMode parMode, bool parBuffered, const char* parDescCategory) :
|
PhysicsFSFile::PhysicsFSFile (const char* parPath, OpenMode parMode, const char* parDescCategory, bool parBuffered) :
|
||||||
m_handle(OpenPhysFSFile(parPath, parMode))
|
m_handle(OpenPhysFSFile(parPath, parMode))
|
||||||
{
|
{
|
||||||
if (not m_handle) {
|
if (not m_handle) {
|
||||||
|
@ -78,7 +78,7 @@ namespace cloonel {
|
||||||
|
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
PhysycsFSFile::~PhysycsFSFile() noexcept {
|
PhysicsFSFile::~PhysicsFSFile() noexcept {
|
||||||
if (IsOpen()) {
|
if (IsOpen()) {
|
||||||
PHYSFS_close(static_cast<PHYSFS_File*>(m_handle));
|
PHYSFS_close(static_cast<PHYSFS_File*>(m_handle));
|
||||||
}
|
}
|
||||||
|
@ -86,43 +86,43 @@ namespace cloonel {
|
||||||
|
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
bool PhysycsFSFile::IsOpen() const noexcept {
|
bool PhysicsFSFile::IsOpen() const noexcept {
|
||||||
return (m_handle != nullptr);
|
return (m_handle != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
int64_t PhysycsFSFile::Read (void* parBuff, uint32_t parSize, uint32_t parCount) {
|
int64_t PhysicsFSFile::Read (void* parBuff, uint32_t parSize, uint32_t parCount) {
|
||||||
return PHYSFS_read(static_cast<PHYSFS_File*>(m_handle), parBuff, parSize, parCount);
|
return PHYSFS_read(static_cast<PHYSFS_File*>(m_handle), parBuff, parSize, parCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
int64_t PhysycsFSFile::Write (void* parBuff, uint32_t parSize, uint32_t parCount) {
|
int64_t PhysicsFSFile::Write (void* parBuff, uint32_t parSize, uint32_t parCount) {
|
||||||
return PHYSFS_write(static_cast<PHYSFS_File*>(m_handle), parBuff, parSize, parCount);
|
return PHYSFS_write(static_cast<PHYSFS_File*>(m_handle), parBuff, parSize, parCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
bool PhysycsFSFile::IsEof() const noexcept {
|
bool PhysicsFSFile::IsEof() const noexcept {
|
||||||
return PHYSFS_eof(static_cast<PHYSFS_File*>(const_cast<void*>(m_handle)));
|
return PHYSFS_eof(static_cast<PHYSFS_File*>(const_cast<void*>(m_handle)));
|
||||||
}
|
}
|
||||||
|
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
int64_t PhysycsFSFile::Tell() const {
|
int64_t PhysicsFSFile::Tell() const {
|
||||||
return PHYSFS_tell(static_cast<PHYSFS_File*>(const_cast<void*>(m_handle)));
|
return PHYSFS_tell(static_cast<PHYSFS_File*>(const_cast<void*>(m_handle)));
|
||||||
}
|
}
|
||||||
|
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
int PhysycsFSFile::Seek (uint64_t parPos) {
|
int PhysicsFSFile::Seek (uint64_t parPos) {
|
||||||
return PHYSFS_seek(static_cast<PHYSFS_File*>(m_handle), parPos);
|
return PHYSFS_seek(static_cast<PHYSFS_File*>(m_handle), parPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
///-------------------------------------------------------------------------
|
///-------------------------------------------------------------------------
|
||||||
void PhysycsFSFile::Flush() noexcept {
|
void PhysicsFSFile::Flush() noexcept {
|
||||||
PHYSFS_flush(static_cast<PHYSFS_File*>(m_handle));
|
PHYSFS_flush(static_cast<PHYSFS_File*>(m_handle));
|
||||||
}
|
}
|
||||||
} //namespace cloonel
|
} //namespace cloonel
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
#define DEF_PHYSICSFS_BUFFERED true
|
||||||
|
|
||||||
namespace cloonel {
|
namespace cloonel {
|
||||||
class PhysicsFSWrapper {
|
class PhysicsFSWrapper {
|
||||||
public:
|
public:
|
||||||
|
@ -12,7 +14,7 @@ namespace cloonel {
|
||||||
void Append ( const char* parRelativePath, const char* parMountPoint );
|
void Append ( const char* parRelativePath, const char* parMountPoint );
|
||||||
};
|
};
|
||||||
|
|
||||||
class PhysycsFSFile {
|
class PhysicsFSFile {
|
||||||
public:
|
public:
|
||||||
enum OpenMode {
|
enum OpenMode {
|
||||||
OpenMode_Read,
|
OpenMode_Read,
|
||||||
|
@ -20,8 +22,8 @@ namespace cloonel {
|
||||||
OpenMode_Append
|
OpenMode_Append
|
||||||
};
|
};
|
||||||
|
|
||||||
PhysycsFSFile ( const char* parPath, OpenMode parMode, bool parBuffered, const char* parDescCategory );
|
PhysicsFSFile ( const char* parPath, OpenMode parMode, const char* parDescCategory, bool parBuffered = DEF_PHYSICSFS_BUFFERED );
|
||||||
~PhysycsFSFile ( void ) noexcept;
|
~PhysicsFSFile ( void ) noexcept;
|
||||||
|
|
||||||
bool IsOpen ( void ) const noexcept;
|
bool IsOpen ( void ) const noexcept;
|
||||||
int64_t Read ( void* parBuff, uint32_t parSize, uint32_t parCount );
|
int64_t Read ( void* parBuff, uint32_t parSize, uint32_t parCount );
|
||||||
|
|
Loading…
Reference in a new issue