error.h

来自「一个纹理地形渲染器」· C头文件 代码 · 共 52 行

H
52
字号
// System Error class

#pragma once

#include <string>


namespace System
{
    /// An exception class with a text title and description

	class Error
	{
        std::string _message;       ///< error message string.

	public:

        /// construct error with given message.

		Error(const char message[])
		{
			_message = message;
		}

        /// get error title.
        /// if you want to define a new error type, derive from this class
        /// and return an identifying string in the override of this method.

		virtual const char* title() const
		{
			return "System Error";
		}

        /// get error message.

		virtual const char* message() const
		{
			return _message.c_str();
		}

        /// report error and shutdown.
        /// we may change this method to simply report the error and not shutdown...

        virtual int report()
        {
            printf("%s - %s", title(), message());
            exit(1);
            return 1;
        }
	};
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?