Streams - Added optional path to errors
This commit is contained in:
parent
424ba93472
commit
0651ea28e0
8 changed files with 39 additions and 21 deletions
|
@ -166,6 +166,15 @@ struct T_BinaryWriter
|
|||
};
|
||||
|
||||
|
||||
}
|
||||
#include <ebcl/inline/BinaryStreams.hh>
|
||||
/*= STREAM INTERFACES FOR OBJECTS THAT ARE NEEDED BY STREAMS =================*/
|
||||
|
||||
M_DECLARE_OBJECT_READER( T_Character );
|
||||
M_DECLARE_OBJECT_WRITER( T_Character );
|
||||
M_DECLARE_OBJECT_READER( T_String );
|
||||
M_DECLARE_OBJECT_WRITER( T_String );
|
||||
M_DECLARE_OBJECT_WRITER( T_StringBuilder );
|
||||
|
||||
|
||||
} // namespace ebcl
|
||||
#endif // _H_EBCL_BINARYSTREAMS
|
||||
#include <ebcl/inline/BinaryStreams.hh>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define _H_EBCL_SRDBINARY
|
||||
#include <ebcl/SRDIO.hh>
|
||||
#include <ebcl/HashIndex.hh>
|
||||
#include <ebcl/BinaryStreams.hh>
|
||||
namespace ebcl {
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#ifndef _H_EBCL_SRDIO
|
||||
#define _H_EBCL_SRDIO
|
||||
#include <ebcl/SRDData.hh>
|
||||
#include <ebcl/Streams.hh>
|
||||
namespace ebcl {
|
||||
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include <ebcl/Utilities.hh>
|
||||
#include <ebcl/Pointers.hh>
|
||||
#include <ebcl/Buffers.hh>
|
||||
#include <ebcl/Types.hh>
|
||||
#include <ebcl/Filesystem.hh>
|
||||
namespace ebcl {
|
||||
|
||||
|
||||
|
@ -28,19 +30,22 @@ class X_StreamError : public std::exception
|
|||
private:
|
||||
E_StreamError error_;
|
||||
int sysError_;
|
||||
T_Optional< T_FSPath > path_;
|
||||
|
||||
public:
|
||||
explicit X_StreamError( E_StreamError e );
|
||||
explicit X_StreamError( int error );
|
||||
explicit X_StreamError( E_StreamError e ,
|
||||
T_Optional< T_FSPath > p = {} ) noexcept;
|
||||
explicit X_StreamError( int error ,
|
||||
T_Optional< T_FSPath > p = {} ) noexcept;
|
||||
|
||||
X_StreamError( ) = delete;
|
||||
X_StreamError( X_StreamError const& ) = default;
|
||||
X_StreamError( X_StreamError&& ) noexcept = default;
|
||||
virtual X_StreamError& operator= ( X_StreamError const& ) = default;
|
||||
virtual X_StreamError& operator= ( X_StreamError&& ) = default;
|
||||
virtual X_StreamError& operator= ( X_StreamError&& ) noexcept = default;
|
||||
|
||||
E_StreamError code( ) const;
|
||||
int systemError( ) const;
|
||||
E_StreamError code( ) const noexcept;
|
||||
int systemError( ) const noexcept;
|
||||
|
||||
char const* what( ) const noexcept;
|
||||
};
|
||||
|
@ -107,6 +112,6 @@ class A_OutputStream : public A_Stream
|
|||
|
||||
M_ABSTRACT_POINTERS( OutputStream );
|
||||
|
||||
} // namespace
|
||||
} // namespace ebcl
|
||||
#include <ebcl/inline/Streams.hh>
|
||||
#endif // _H_EBCL_STREAMS
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <ebcl/Externals.hh>
|
||||
#include <ebcl/Pointers.hh>
|
||||
#include <ebcl/Arrays.hh>
|
||||
#include <ebcl/BinaryStreams.hh>
|
||||
#include <ebcl/Buffers.hh>
|
||||
namespace ebcl {
|
||||
|
||||
|
||||
|
@ -113,8 +113,6 @@ struct T_Character
|
|||
|
||||
|
||||
M_CLASS_POINTERS( Character );
|
||||
M_DECLARE_OBJECT_READER( T_Character );
|
||||
M_DECLARE_OBJECT_WRITER( T_Character );
|
||||
|
||||
|
||||
/*= IMMUTABLE UTF8 STRINGS ===================================================*/
|
||||
|
@ -293,8 +291,6 @@ class T_String
|
|||
M_CLASS_POINTERS( String );
|
||||
M_DECLARE_HASH( T_String );
|
||||
M_DECLARE_COMPARATOR( T_String );
|
||||
M_DECLARE_OBJECT_READER( T_String );
|
||||
M_DECLARE_OBJECT_WRITER( T_String );
|
||||
|
||||
void swap( T_String& lhs , T_String& rhs ) noexcept;
|
||||
|
||||
|
@ -433,7 +429,6 @@ class T_StringBuilder
|
|||
|
||||
|
||||
M_CLASS_POINTERS( StringBuilder );
|
||||
M_DECLARE_OBJECT_WRITER( T_StringBuilder );
|
||||
void swap( T_StringBuilder& lhs , T_StringBuilder& rhs );
|
||||
|
||||
// Operator <<
|
||||
|
|
|
@ -10,22 +10,27 @@ namespace ebcl {
|
|||
|
||||
/*= X_StreamError ============================================================*/
|
||||
|
||||
inline X_StreamError::X_StreamError( E_StreamError e )
|
||||
: std::exception( ) , error_( e ) , sysError_( -1 )
|
||||
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 ) }
|
||||
{ }
|
||||
|
||||
inline X_StreamError::X_StreamError( int error )
|
||||
: std::exception( ) , error_( E_StreamError::SYSTEM_ERROR ) , sysError_( error )
|
||||
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 ) }
|
||||
{ }
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
inline E_StreamError X_StreamError::code( ) const
|
||||
inline E_StreamError X_StreamError::code( ) const noexcept
|
||||
{
|
||||
return error_;
|
||||
}
|
||||
|
||||
inline int X_StreamError::systemError( ) const
|
||||
inline int X_StreamError::systemError( ) const noexcept
|
||||
{
|
||||
return sysError_;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
|
||||
#include <ebcl/SRDText.hh>
|
||||
#include <ebcl/BinaryStreams.hh>
|
||||
using namespace ebcl;
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <ebcl/Threading.hh>
|
||||
#include <ebcl/Types.hh>
|
||||
#include <ebcl/Alloc.hh>
|
||||
#include <ebcl/BinaryStreams.hh>
|
||||
|
||||
|
||||
using namespace ebcl;
|
||||
|
|
Loading…
Reference in a new issue