📄 exception.h
字号:
// This file needs -*- c++ -*- mode
// ============================================================================
// Exceptions
//
// (c) 2003 Ken Reed
//
// This is free software. You can redistribute it and/or modify it under the
// terms of the GNU General Public License version 2 as published by the Free
// Software Foundation.
// ============================================================================
#pragma once
#include <string>
// ============================================================================
// Exception base class
// ============================================================================
class Exception
{
public:
Exception(const std::string & message);
virtual std::string get_error();
int line_number;
std::string file_name;
std::string message;
std::string error_text;
};
// ============================================================================
// With additional Windows error information
// ============================================================================
class Win_exception : public Exception
{
public:
Win_exception(const std::string & message);
Win_exception(const std::string & message, DWORD error_code);
};
// ============================================================================
// Text from errno
// ============================================================================
class Posix_exception : public Exception
{
public:
Posix_exception(const std::string & message);
};
// ============================================================================
// Macro to set location information
// ============================================================================
#define RAISE(exception) \
exception.line_number = __LINE__; \
exception.file_name = __FILE__; \
throw(exception);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -