/*****************************************************************************
 * $LastChangedDate: 2011-04-23 21:07:07 -0400 (Sat, 23 Apr 2011) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   C++ exceptions.
 *//*
 * LEGAL:   COPYRIGHT (C) 2007 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

#ifndef BASE_EXCEPTION_HH
#define BASE_EXCEPTION_HH 1

#include <exception>
#include <sstream>

namespace base {

void
PrintException( const std::exception& ex, const string& functionName );

////////////////////////////////////////////////////////////////////////////////
/// @brief Base Exception class.
///
/// The purpose of base::Exception class is to specifically catch exceptions
/// thrown by the application rather than by the C++ standard library.
/// Usually, though, base::Exception is caught as std::exception.
///
class Exception : public std::exception
{
COPYABLE(Exception)  // PREVENT_COPYING() cannot be used for exception classes
public:
                            Exception( void );
    explicit                Exception( const string& text );
    explicit                Exception( const std::ostringstream& oss );
    virtual                 ~Exception() throw();
    virtual const char*     what() const throw();

protected:
    string  mText;      ///< derivative can reassign
};

} // namespace base

#endif // BASE_EXCEPTION_HH
