Newer
Older
snipet / libscpp / trunk / include / scpp_exception.hpp
/* =============================================================================
 *  scpp_exception.hpp
 *  Copyright (c)  2003 - 2013  Nomura Kei
 *  LICENSE :
 *  LGPL (GNU Lesser General General Public License - Version 3,29 June 2007)
 *  http://www.gnu.org/copyleft/lesser.html
 * =============================================================================
 *
 *
 */
#ifndef SCPP_EXCEPTION_HPP
#define SCPP_EXCEPTION_HPP


#include <exception>
#include <string>

#include <scpp_compiler.hpp>


namespace scpp
{

/**
 * 本 libscpp の例外基底クラス.
 * libscpp で扱う例外は, 本 Throwable を継承しています.
 */
class Throwable : public std::exception
{
	public:
		Throwable() throw();
		Throwable(const Throwable& t) throw();
		Throwable(const std::string& msg) throw();
		virtual ~Throwable() throw();
		virtual const char* what() const throw();

	protected:
		std::string message;
	
};


/**
 * 本 libscpp の Exception クラス.
 * 本 libscpp にて, 回復可能なエラーは,
 * 本クラスを継承したクラスを throw します.
 */
class Exception : public Throwable
{
	public:
		Exception() throw();
		Exception(const Exception& t) throw();
		Exception(const std::string& msg) throw();
		virtual ~Exception() throw();

};


/**
 * 本 libscpp の Error クラス.
 * 本 libscpp にて, 回復が困難なエラーは,
 * 本クラスを継承したクラスを throw します.
 */
class Error : public Throwable
{
	public:
		Error() throw();
		Error(const Error& t) throw();
		Error(const std::string& msg) throw();
		virtual ~Error() throw();

};


}	// namespace scpp


#endif	// SCPP_EXCEPTION_HPP