/* ============================================================================= * scpp_exception.hpp * Copyright (c) 2003 - 2013 Nomura Kei * ============================================================================= */ #ifndef SCPP_EXCEPTION_HPP #define SCPP_EXCEPTION_HPP #ifdef __cplusplus #include <exception> #include <string> #ifndef SC_COMPILER_H #include <sc_compiler.h> #endif namespace scpp { /** * 例外基底クラス. * sc ライブラリで扱う例外は 本 Throwable を継承しています. */ class Throwable : public std::exception { public: Throwable() NO_THROW(); Throwable(const Throwable& t) NO_THROW(); Throwable(const std::string& msg) NO_THROW(); virtual ~Throwable() NO_THROW(); virtual const char* what() const NO_THROW(); protected: std::string message; }; /** * sc ライブラリで使用する Exception クラス. * 回復可能なエラーは本クラスを継承したクラスを throw します. */ class Exception : public Throwable { public: Exception() NO_THROW(); Exception(const Exception& t) NO_THROW(); Exception(const std::string& msg) NO_THROW(); virtual ~Exception() NO_THROW(); }; /** * sc ライブラリで使用する Error クラス. * 回復困難なエラーの場合, 本クラスを継承したクラスを throw します. */ class Error : public Throwable { public: Error() NO_THROW(); Error(const Error& t) NO_THROW(); Error(const std::string& msg) NO_THROW(); virtual ~Error() NO_THROW(); }; } // namespace scpp #endif /* __cplusplus */ #endif /* SCPP_EXCEPTION_HPP */