Oncaphillis::Ligh++pd

niftyLib::iexception_stream_t< _Exception, _CharT, _Traits, _Alloc > Class Template Reference

#include <src/niftylib/iexception_stream.h>


Detailed Description

template<typename _Exception, typename _CharT, typename _Traits, typename _Alloc>
class niftyLib::iexception_stream_t< _Exception, _CharT, _Traits, _Alloc >

An std::ostream offspring which serves as a collector of formated text to be used as the iexception_t::what argument for exception throwing.

Instances to iexception_stream_t throw an exception of the specified type whenever a std::ends gets inserted into the stream.

EXAMPLE

If the parameter n is out of range we migh simply do something like.

      //  Throw an exception of apropriate type simply
      //  By sending a 'flush' into the stream

      if(n>maxN) {
       iexception_stream_t<std::exception> es;
       es << "parameter n=" << n << " is out of range" << std::flush;
      }

And an exception of type std::exception assiciated with the given text will be thrown.

See also:
iexception_t::out

Public Types

typedef _Exception exception
 "Pull in" the type of the exception we are supposed to throw.
typedef _CharT char_type
 "Pull in" the charcter type we are supposed to write.
typedef _Traits traits_type
 Pull in the traits_type which informs about the traits of _CharT.
typedef iexception_buf_t
< exception, char_type,
traits_type, _Alloc > 
buffer_type
 Typedef of the stream_buf subclass we are working with.
typedef std::basic_string
< char_type, _Traits, _Alloc > 
string_type
 The sort of string we might return.

Public Member Functions

 iexception_stream_t (const std::string &s, std::ios_base::openmode m=std::ios_base::in|std::ios_base::out)
 Constructor accepting a string to initialize the buffer and optional io flags.
 iexception_stream_t (std::ios_base::openmode m=std::ios_base::in|std::ios_base::out)
 Constructor initializing the buffer to "" with optional io flags.
virtual ~iexception_stream_t ()
 Destructor.
string_type str () const
 Return the std::string held by the buffer.
void str (const string_type &s) const
 Fill the string buffer with a new content.

Member Typedef Documentation

template<typename _Exception, typename _CharT, typename _Traits, typename _Alloc>
typedef _Exception niftyLib::iexception_stream_t< _Exception, _CharT, _Traits, _Alloc >::exception

"Pull in" the type of the exception we are supposed to throw.

template<typename _Exception, typename _CharT, typename _Traits, typename _Alloc>
typedef _CharT niftyLib::iexception_stream_t< _Exception, _CharT, _Traits, _Alloc >::char_type

"Pull in" the charcter type we are supposed to write.

template<typename _Exception, typename _CharT, typename _Traits, typename _Alloc>
typedef _Traits niftyLib::iexception_stream_t< _Exception, _CharT, _Traits, _Alloc >::traits_type

Pull in the traits_type which informs about the traits of _CharT.

template<typename _Exception, typename _CharT, typename _Traits, typename _Alloc>
typedef iexception_buf_t<exception,char_type,traits_type,_Alloc> niftyLib::iexception_stream_t< _Exception, _CharT, _Traits, _Alloc >::buffer_type

Typedef of the stream_buf subclass we are working with.

template<typename _Exception, typename _CharT, typename _Traits, typename _Alloc>
typedef std::basic_string<char_type,_Traits,_Alloc> niftyLib::iexception_stream_t< _Exception, _CharT, _Traits, _Alloc >::string_type

The sort of string we might return.


Constructor & Destructor Documentation

template<typename _Exception, typename _CharT, typename _Traits, typename _Alloc>
niftyLib::iexception_stream_t< _Exception, _CharT, _Traits, _Alloc >::iexception_stream_t ( const std::string &  s,
std::ios_base::openmode  m = std::ios_base::in | std::ios_base::out 
) [inline, explicit]

Constructor accepting a string to initialize the buffer and optional io flags.

template<typename _Exception, typename _CharT, typename _Traits, typename _Alloc>
niftyLib::iexception_stream_t< _Exception, _CharT, _Traits, _Alloc >::iexception_stream_t ( std::ios_base::openmode  m = std::ios_base::in | std::ios_base::out  )  [inline, explicit]

Constructor initializing the buffer to "" with optional io flags.

template<typename _Exception, typename _CharT, typename _Traits, typename _Alloc>
virtual niftyLib::iexception_stream_t< _Exception, _CharT, _Traits, _Alloc >::~iexception_stream_t (  )  [inline, virtual]

Destructor.


Member Function Documentation

template<typename _Exception, typename _CharT, typename _Traits, typename _Alloc>
string_type niftyLib::iexception_stream_t< _Exception, _CharT, _Traits, _Alloc >::str (  )  const [inline]

Return the std::string held by the buffer.

template<typename _Exception, typename _CharT, typename _Traits, typename _Alloc>
void niftyLib::iexception_stream_t< _Exception, _CharT, _Traits, _Alloc >::str ( const string_type s  )  const [inline]

Fill the string buffer with a new content.


The documentation for this class was generated from the following file:

Generated by  doxygen
© 2008; Dr. Sebastian Kloska ( Oncaphillis )
Powered by: [?]