⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exception.h

📁 通用网络游戏开发框架
💻 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 + -