100 lines
2.5 KiB
C++
100 lines
2.5 KiB
C++
/******************************************************************************/
|
|
/* STREAMS - INLINE CODE ******************************************************/
|
|
/******************************************************************************/
|
|
|
|
#ifndef _H_EBCL_INLINE_STREAMS
|
|
#define _H_EBCL_INLINE_STREAMS
|
|
#include <ebcl/Streams.hh>
|
|
namespace ebcl {
|
|
|
|
|
|
/*= X_StreamError ============================================================*/
|
|
|
|
inline X_StreamError::X_StreamError( E_StreamError e )
|
|
: std::exception( ) , error_( e ) , sysError_( -1 )
|
|
{ }
|
|
|
|
inline X_StreamError::X_StreamError( int error )
|
|
: std::exception( ) , error_( E_StreamError::SYSTEM_ERROR ) , sysError_( error )
|
|
{ }
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
inline E_StreamError X_StreamError::code( ) const
|
|
{
|
|
return error_;
|
|
}
|
|
|
|
inline int X_StreamError::systemError( ) const
|
|
{
|
|
return sysError_;
|
|
}
|
|
|
|
|
|
/*= 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
|
|
#endif // _H_EBCL_INLINE_STREAMS
|