Files - Use T_FSPath
This commit is contained in:
parent
5497856be2
commit
424ba93472
3 changed files with 9 additions and 8 deletions
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
#ifndef _H_EBCL_FILES
|
#ifndef _H_EBCL_FILES
|
||||||
#define _H_EBCL_FILES
|
#define _H_EBCL_FILES
|
||||||
|
#include <ebcl/Filesystem.hh>
|
||||||
#include <ebcl/Streams.hh>
|
#include <ebcl/Streams.hh>
|
||||||
#include <ebcl/Strings.hh>
|
|
||||||
namespace ebcl {
|
namespace ebcl {
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ enum class E_FileMode {
|
||||||
class T_File final
|
class T_File final
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
T_String path_;
|
T_FSPath path_;
|
||||||
E_FileMode mode_;
|
E_FileMode mode_;
|
||||||
FILE* file_;
|
FILE* file_;
|
||||||
size_t size_ , pos_;
|
size_t size_ , pos_;
|
||||||
|
@ -30,7 +30,7 @@ class T_File final
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Construct from a file path. Does not open the file.
|
// Construct from a file path. Does not open the file.
|
||||||
T_File( T_String const& path , E_FileMode mode );
|
T_File( T_FSPath const& path , E_FileMode mode );
|
||||||
|
|
||||||
// Move constructor and assignment
|
// Move constructor and assignment
|
||||||
T_File( T_File&& other ) noexcept;
|
T_File( T_File&& other ) noexcept;
|
||||||
|
@ -49,7 +49,7 @@ class T_File final
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|
||||||
// Get the path
|
// Get the path
|
||||||
T_String const& path( ) const noexcept;
|
T_FSPath const& path( ) const noexcept;
|
||||||
// Get the mode
|
// Get the mode
|
||||||
E_FileMode mode( ) const noexcept;
|
E_FileMode mode( ) const noexcept;
|
||||||
|
|
||||||
|
@ -182,6 +182,6 @@ class T_FileOutputStream final : public A_OutputStream
|
||||||
M_CLASS_POINTERS( FileOutputStream );
|
M_CLASS_POINTERS( FileOutputStream );
|
||||||
|
|
||||||
|
|
||||||
}
|
} // namespace ebcl
|
||||||
#endif // _H_EBCL_FILES
|
#endif // _H_EBCL_FILES
|
||||||
#include <ebcl/inline/Files.hh>
|
#include <ebcl/inline/Files.hh>
|
||||||
|
|
|
@ -29,7 +29,7 @@ inline void swap( T_File& lhs , T_File& rhs ) noexcept
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
inline T_String const& T_File::path( ) const noexcept
|
inline T_FSPath const& T_File::path( ) const noexcept
|
||||||
{
|
{
|
||||||
return path_;
|
return path_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,8 @@ T_File::T_File( )
|
||||||
: path_( ) , file_( nullptr )
|
: path_( ) , file_( nullptr )
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
T_File::T_File( T_String const& path , E_FileMode mode )
|
T_File::T_File( T_FSPath const& path ,
|
||||||
|
const E_FileMode mode )
|
||||||
: path_( path ) , mode_( mode ) , file_( nullptr )
|
: path_( path ) , mode_( mode ) , file_( nullptr )
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
@ -38,7 +39,7 @@ void T_File::open( )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy file path to C string
|
// Copy file path to C string
|
||||||
const T_Buffer< char > path( path_.toOSString( ) );
|
const T_Buffer< char > path( path_.toString( ).toOSString( ) );
|
||||||
|
|
||||||
// Select the right mode
|
// Select the right mode
|
||||||
char const* const mode( ([this]() {
|
char const* const mode( ([this]() {
|
||||||
|
|
Loading…
Reference in a new issue