YSTest: yexcept.h 源文件

YSTest PreAlpha_b400_20130424 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
yexcept.h
浏览该文件的文档.
1 ﻿/*
2 Copyright (C) by Franksoft 2010 - 2011.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YSL_INC_CORE_YEXCEPT_H_
29 #define YSL_INC_CORE_YEXCEPT_H_ 1
30
31 #include "ysdef.h"
32 #include <exception>
33 #include <stdexcept>
34 #include <string>
35
36 YSL_BEGIN
37
39 typedef std::exception Exception;
40
41
43 typedef std::runtime_error GeneralEvent;
44
45
46 //记录异常事件类。
47 class YF_API LoggedEvent : public GeneralEvent
48 {
49 public:
50 typedef u8 LevelType;
51
52 private:
53 LevelType level;
54
55 public:
60 LoggedEvent(const std::string&, LevelType = 0) ynothrow;
65 LoggedEvent(const GeneralEvent&, LevelType = 0) ynothrow;
69 ~LoggedEvent() ynothrow override = default;
70
71 DefGetter(const ynothrow, LevelType, Level, level)
72 };
73
74
79 class YF_API FatalError : GeneralEvent
80 {
81 private:
82 const char* content;
83
84 public:
86 FatalError(const char*, const char*) ynothrow;
87
88 DefGetter(const ynothrow, const char*, Content, content)
89 DefGetter(const ynothrow, const char*, Title, what())
90 };
91
92 YSL_END
93
94 #endif
95