Program Listing for File standard_exception.hpp

Return to documentation for file (/tmp/ws/src/ecl_core/ecl_exceptions/include/ecl/exceptions/standard_exception.hpp)

/*****************************************************************************
** Ifdefs
*****************************************************************************/

#ifndef ECL_EXCEPTIONS_STANDARD_EXCEPTION_HPP_
#define ECL_EXCEPTIONS_STANDARD_EXCEPTION_HPP_

/*****************************************************************************
** Disable check
*****************************************************************************/

#include <ecl/config/ecl.hpp>
#ifndef ECL_DISABLE_EXCEPTIONS

/*****************************************************************************
** Includes
*****************************************************************************/

#include <string>
#include "exception.hpp"
#include <ecl/errors/handlers.hpp>
#include <ecl/errors/macros.hpp>
#include <cstring>

/*****************************************************************************
** Namespaces
*****************************************************************************/

namespace ecl {

/*****************************************************************************
** Interface [StandardException]
*****************************************************************************/
class ecl_exceptions_PUBLIC StandardException : public Exception
{
    public:
        StandardException(const char* loc, ErrorFlag error );
        StandardException(const char* loc, ErrorFlag error, const std::string &msg );
        StandardException(const char* loc, const StandardException &e );

        virtual ~StandardException() throw() {}

        const char* what() const throw();

        const std::string& message() const { return detailed_message; };

        const ErrorFlag& flag() const { return error_flag; }
    private:

        void create_combined_message();

        const ErrorFlag error_flag;
        std::string detailed_message;
        std::string combined_message;
};

} // namespace ecl

#endif /* ECL_DISABLE_EXCEPTIONS */
#endif /*ECL_EXCEPTIONS_STANDARD_EXCEPTION_HPP_*/