99 lines
2.1 KiB
C++
99 lines
2.1 KiB
C++
/******************************************************************************/
|
|
/* FILES - INLINE CODE ********************************************************/
|
|
/******************************************************************************/
|
|
|
|
#ifndef _H_EBCL_INLINE_FILES
|
|
#define _H_EBCL_INLINE_FILES
|
|
#include <ebcl/Files.hh>
|
|
namespace ebcl {
|
|
|
|
|
|
/*= T_File ===================================================================*/
|
|
|
|
inline T_File::~T_File( )
|
|
{
|
|
close( );
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
inline void swap( T_File& lhs , T_File& rhs ) noexcept
|
|
{
|
|
using std::swap;
|
|
swap( lhs.path_ , rhs.path_ );
|
|
swap( lhs.mode_ , rhs.mode_ );
|
|
swap( lhs.file_ , rhs.file_ );
|
|
swap( lhs.size_ , rhs.size_ );
|
|
swap( lhs.pos_ , rhs.pos_ );
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
inline T_String const& T_File::path( ) const noexcept
|
|
{
|
|
return path_;
|
|
}
|
|
|
|
inline E_FileMode T_File::mode( ) const noexcept
|
|
{
|
|
return mode_;
|
|
}
|
|
|
|
inline bool T_File::isOpen( ) const noexcept
|
|
{
|
|
return file_ != nullptr;
|
|
}
|
|
|
|
inline size_t T_File::size( ) const noexcept
|
|
{
|
|
return isOpen( ) ? size_ : 0;
|
|
}
|
|
|
|
inline size_t T_File::position( ) const noexcept
|
|
{
|
|
return isOpen( ) ? pos_ : 0;
|
|
}
|
|
|
|
|
|
/*= T_FileInputStream ========================================================*/
|
|
|
|
inline void swap( T_FileInputStream& lhs , T_FileInputStream& rhs ) noexcept
|
|
{
|
|
lhs.swap( rhs );
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
inline T_File& T_FileInputStream::file( ) const noexcept
|
|
{
|
|
return fileRaw_ ? *fileRaw_ : *fileOwned_;
|
|
}
|
|
|
|
inline size_t T_FileInputStream::offset( ) const noexcept
|
|
{
|
|
return start_;
|
|
}
|
|
|
|
|
|
/*= T_FileOutputStream =======================================================*/
|
|
|
|
inline void swap( T_FileOutputStream& lhs , T_FileOutputStream& rhs ) noexcept
|
|
{
|
|
lhs.swap( rhs );
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
inline T_File& T_FileOutputStream::file( ) const noexcept
|
|
{
|
|
return fileRaw_ ? *fileRaw_ : *fileOwned_;
|
|
}
|
|
|
|
inline size_t T_FileOutputStream::offset( ) const noexcept
|
|
{
|
|
return start_;
|
|
}
|
|
|
|
|
|
} // namespace
|
|
#endif // _H_EBCL_INLINE_FILES
|