2017-11-01 20:14:23 +01:00
|
|
|
/******************************************************************************/
|
|
|
|
/* STREAMS - INLINE CODE ******************************************************/
|
|
|
|
/******************************************************************************/
|
|
|
|
|
2017-11-01 21:44:54 +01:00
|
|
|
#ifndef _H_EBCL_INLINE_STREAMS
|
|
|
|
#define _H_EBCL_INLINE_STREAMS
|
|
|
|
#include <ebcl/Streams.hh>
|
|
|
|
namespace ebcl {
|
2017-11-01 20:14:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*= X_StreamError ============================================================*/
|
|
|
|
|
2017-12-27 19:00:56 +01:00
|
|
|
inline X_StreamError::X_StreamError(
|
|
|
|
const E_StreamError e ,
|
|
|
|
T_Optional< T_FSPath > p ) noexcept
|
|
|
|
: std::exception( ) , error_( e ) , sysError_( -1 ) ,
|
|
|
|
path_{ std::move( p ) }
|
2017-11-01 20:14:23 +01:00
|
|
|
{ }
|
|
|
|
|
2017-12-27 19:00:56 +01:00
|
|
|
inline X_StreamError::X_StreamError( const int error ,
|
|
|
|
T_Optional< T_FSPath > p ) noexcept
|
|
|
|
: std::exception( ) , error_( E_StreamError::SYSTEM_ERROR ) ,
|
|
|
|
sysError_( error ) , path_{ std::move( p ) }
|
2017-11-01 20:14:23 +01:00
|
|
|
{ }
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
2017-12-27 19:00:56 +01:00
|
|
|
inline E_StreamError X_StreamError::code( ) const noexcept
|
2017-11-01 20:14:23 +01:00
|
|
|
{
|
|
|
|
return error_;
|
|
|
|
}
|
|
|
|
|
2017-12-27 19:00:56 +01:00
|
|
|
inline int X_StreamError::systemError( ) const noexcept
|
2017-11-01 20:14:23 +01:00
|
|
|
{
|
|
|
|
return sysError_;
|
|
|
|
}
|
|
|
|
|
2017-12-28 09:52:30 +01:00
|
|
|
inline T_Optional< T_FSPath > const& X_StreamError::path( ) const noexcept
|
|
|
|
{
|
|
|
|
return path_;
|
|
|
|
}
|
|
|
|
|
2017-11-01 20:14:23 +01:00
|
|
|
|
|
|
|
/*= A_Stream =================================================================*/
|
|
|
|
|
|
|
|
inline A_Stream::A_Stream( bool isInput , size_t position ) noexcept
|
|
|
|
: isInput_( isInput ) , knownSize_( false ) , position_( position )
|
|
|
|
{ }
|
|
|
|
|
|
|
|
inline A_Stream::A_Stream( bool isInput , size_t position , size_t size ) noexcept
|
|
|
|
: isInput_( isInput ) , knownSize_( true ) , size_( size ) ,
|
|
|
|
position_( position )
|
|
|
|
{ }
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
inline A_Stream::~A_Stream( )
|
|
|
|
{ }
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
inline bool A_Stream::isInput( ) const
|
|
|
|
{
|
|
|
|
return isInput_;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool A_Stream::isSizeKnown( ) const
|
|
|
|
{
|
|
|
|
return knownSize_;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline size_t A_Stream::position( ) const
|
|
|
|
{
|
|
|
|
return position_;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline size_t A_Stream::size( ) const
|
|
|
|
{
|
|
|
|
if ( knownSize_ ) {
|
|
|
|
return size_;
|
|
|
|
} else {
|
|
|
|
throw X_StreamError( E_StreamError::NOT_SUPPORTED );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*= A_InputStream ============================================================*/
|
|
|
|
|
|
|
|
inline A_InputStream::A_InputStream( size_t position ) noexcept
|
|
|
|
: A_Stream( true , position )
|
|
|
|
{ }
|
|
|
|
|
|
|
|
inline A_InputStream::A_InputStream( size_t position , size_t size ) noexcept
|
|
|
|
: A_Stream( true , position , size )
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
/*= A_OutputStream ===========================================================*/
|
|
|
|
|
|
|
|
inline A_OutputStream::A_OutputStream( size_t position ) noexcept
|
|
|
|
: A_Stream( false , position )
|
|
|
|
{ }
|
|
|
|
|
|
|
|
inline A_OutputStream::A_OutputStream( size_t position , size_t size ) noexcept
|
|
|
|
: A_Stream( false , position , size )
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace
|
2017-11-01 21:44:54 +01:00
|
|
|
#endif // _H_EBCL_INLINE_STREAMS
|