/**
* @file scpp_exception.hpp
* @bried 例外クラス用ヘッダーファイル
* @author Nomura Kei
* @copyright 2003 - 2022 Nomura Kei
*/
#ifndef SCPP_EXCEPTION_HPP
#define SCPP_EXCEPTION_HPP
#include <exception>
#include <string>
#include <sc.h>
namespace scpp
{
/**
* 本ライブラリの例外基底クラス。
* libscpp で扱う例外は、本クラスを継承します。
*/
class Throwable : public std::exception
{
public:
Throwable() noexcept;
Throwable(const Throwable& t) noexcept;
Throwable(Throwable&& t) noexcept;
Throwable(const std::string& msg) noexcept;
Throwable& operator=(const Throwable& t) noexcept;
Throwable& operator=(Throwable&& t) noexcept;
virtual ~Throwable() noexcept;
virtual const char* what() const noexcept;
protected:
std::string message;
};
/**
* 本ライブラリの Exception クラス。
* 本ライブラリにて発生したエラーのうち、回復可能なエラーは、
* 本クラスを継承した Exception クラスを throw します。
*/
class Exception : public Throwable
{
public:
Exception() noexcept;
Exception(const Exception& e) noexcept;
Exception(Exception&& e) noexcept;
Exception(const std::string& msg) noexcept;
Exception& operator=(const Exception& t) noexcept;
Exception& operator=(Exception&& t) noexcept;
virtual ~Exception() noexcept;
};
/**
* 本ライブラリの Error クラス。
* 本ライブラリにて発生したエラーのうち、回復困難なエラーは、
* 本クラスを継承した Error クラスを throw します。
*/
class Error : public Throwable
{
public:
Error() noexcept;
Error(const Error& t) noexcept;
Error(Error&& t) noexcept;
Error(const std::string& msg) noexcept;
Error& operator=(const Error& t) noexcept;
Error& operator=(Error&& t) noexcept;
virtual ~Error() noexcept;
};
} // namespace scpp
#endif // SCPP_EXCEPTION_HPP