YSTest
PreAlpha_b500_20140530
The YSLib Test Project
首页
相关页面
模块
命名空间
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
ymsgdef.h
浏览该文件的文档.
1
/*
2
© 2009-2013 FrankHB.
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_ymsgdef_h_
29
#define YSL_INC_CORE_ymsgdef_h_ 1
30
31
#include "
YModules.h
"
32
#include YFM_YSLib_Core_YMessage
33
#include <functional>
// for std::function;
34
35
namespace
YSLib
36
{
37
38
namespace
Messaging
39
{
40
41
using
MessageID
=
enum
MessageSpace
42
{
43
Null
= 0x0000,
44
Set = 0x0003,
45
46
Quit = 0x0012,
48
Bound = 0x0014,
49
Task = 0x0016,
50
51
Paint = 0x00AF,
52
53
Input = 0x00FF
54
};
55
56
58
59
#define SM_Null YSLib::Messaging::Null
60
#define SM_Set YSLib::Messaging::Set
61
62
#define SM_Quit YSLib::Messaging::Quit
63
#define SM_Bound YSLib::Messaging::Bound
64
#define SM_Task YSLib::Messaging::Task
65
66
#define SM_Paint YSLib::Messaging::Paint
67
#define SM_Input YSLib::Messaging::Input
68
69
70
71
template
<MessageID _vID>
72
struct
SMessageMap
73
{};
74
75
#define DefMessageTarget(_id, _type) \
76
template<> \
77
struct SMessageMap<_id> \
78
{ \
79
using TargetType = _type; \
80
};
81
83
84
DefMessageTarget
(
SM_Null
,
void
)
85
DefMessageTarget
(
SM_Set
, shared_ptr<Shell>)
86
DefMessageTarget
(
SM_Quit
,
int
)
87
DefMessageTarget
(
SM_Bound
, pair<weak_ptr<Shell>
YPP_Comma
Message
>)
88
DefMessageTarget
(
SM_Task
, std::function<
void
()>)
89
DefMessageTarget
(
SM_Input
,
void
)
91
92
93
template<
MessageID
_vID>
94
inline const typename
SMessageMap
<_vID>::
TargetType
&
95
FetchTarget
(const
Message
& msg)
96
{
97
return
msg.GetContent().GetObject<
typename
SMessageMap<_vID>::TargetType
>();
98
}
99
100
}
// namespace Messaging;
101
102
}
// namespace YSLib;
103
104
#endif
105
YModules.h
SM_Set
#define SM_Set
Definition:
ymsgdef.h:60
DefMessageTarget
#define DefMessageTarget(_id, _type)
Definition:
ymsgdef.h:75
YSLib::Messaging::MessageID
enum MessageSpace{Null=0x0000, Set=0x0003, Quit=0x0012, Bound=0x0014, Task=0x0016, Paint=0x00AF, Input=0x00FF} MessageID
Definition:
ymsgdef.h:54
YPP_Comma
#define YPP_Comma
替换为逗号的预处理记号。
Definition:
ydef.h:147
YSLib::Messaging::FetchTarget
const SMessageMap< _vID >::TargetType & FetchTarget(const Message &msg)
Definition:
ymsgdef.h:95
SM_Quit
#define SM_Quit
Definition:
ymsgdef.h:62
YSLib::Messaging::SMessageMap< YSLib::Messaging::Input >::TargetType
void TargetType
Definition:
ymsgdef.h:89
SM_Task
#define SM_Task
Definition:
ymsgdef.h:64
SM_Null
#define SM_Null
Definition:
ymsgdef.h:59
SM_Input
#define SM_Input
Definition:
ymsgdef.h:67
SM_Bound
#define SM_Bound
Definition:
ymsgdef.h:63
CHRLib::CharSet::Null
空字符集。
Definition:
encoding.h:56
YSLib::Messaging::SMessageMap
Definition:
ymsgdef.h:72
YSLib::Messaging::Message
消息。
Definition:
ymsg.h:66
YFramework
include
YSLib
Core
ymsgdef.h
生成于 2014年 五月 30日 星期五 00:14:53 , 为 YSTest使用
1.8.7