exception.h
来自「通用网络游戏开发框架」· C头文件 代码 · 共 67 行
H
67 行
// 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 + =
减小字号Ctrl + -
显示快捷键?