Newer
Older
libj / include / j / lang / assertion_error.hpp
/**
 * @file assertion_error.hpp
 * @brief J Library AssertionError ヘッダファイル。
 * @copyright  2001 - 2024  Nomura Kei
 * @depends
 *   j/lang/throwable.hpp
 */
#ifndef J_LANG_ASSERTION_ERROR_HPP
#define J_LANG_ASSERTION_ERROR_HPP

#include <j/lang/error.hpp>

namespace j
{
    namespace lang
    {

        class AssertionError : public Error
        {
        public:
            // デフォルトコンストラクタ
            AssertionError() noexcept;

            // コンストラクタ
            AssertionError(const String &msg) noexcept;

            // コンストラクタ
            AssertionError(const String &msg, const char *file, const char *func, int line) noexcept;

            // コピーコンストラクタ
            AssertionError(const AssertionError &t) noexcept;

            // ムーブコンストラクタ
            AssertionError(AssertionError &&t) noexcept;

            // デストラクタ
            ~AssertionError() noexcept;

            // ファイル名取得
            const char *getFile() const noexcept;

            // 関数名取得
            const char *getFunc() const noexcept;

            // 行番号取得
            int getLine() const noexcept;

            // 文字列表現取得
            String toString() const noexcept override;

        private:
            const char *file;
            const char *func;
            int line;
        };

    } // namespace lang
} // namespace j

#endif // J_LANG_ASSERTION_ERROR_HPP