YSTest
PreAlpha_b400_20130424
The YSLib Test Project
首页
相关页面
模块
命名空间
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
WidgetIteration.h
浏览该文件的文档.
1
/*
2
Copyright by FrankHB 2012 - 2013.
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_UI_WidgetIteration_h_
29
#define YSL_INC_UI_WidgetIteration_h_ 1
30
31
#include "
ywidget.h
"
32
33
YSL_BEGIN
34
40
#define DefSubscriptor(_q, _type, ...) \
41
_type& \
42
operator[](size_t idx) _q \
43
{ \
44
return std::initializer_list<std::reference_wrapper<_type>> \
45
{__VA_ARGS__}.begin()[idx]; \
46
}
47
52
#define DefSubscriptorBase(_q, _type, _tBase, _vBaseN, ...) \
53
_type& \
54
operator[](size_t idx) _q \
55
{ \
56
return idx < _vBaseN ? _tBase::operator[](idx) \
57
: std::initializer_list<std::reference_wrapper<_type>> \
58
{__VA_ARGS__}.begin()[idx - _vBaseN].get(); \
59
}
60
61
62
YSL_BEGIN_NAMESPACE
(UI)
63
64
69
#define DefWidgetSubscriptor(...) \
70
DefSubscriptor(ynoexcept, IWidget, __VA_ARGS__) \
71
DefGetter(const ynothrow, size_t, ChildrenCount, \
72
ystdex::sizeof_params(__VA_ARGS__))
73
79
#define DefWidgetSubscriptorBase(_tBase, ...) \
80
DefSubscriptorBase(ynoexcept, IWidget, _tBase, _tBase::GetChildrenCount(), \
81
__VA_ARGS__) \
82
DefGetter(const ynothrow, size_t, ChildrenCount, \
83
_tBase::GetChildrenCount() + ystdex::sizeof_params(__VA_ARGS__))
84
90
#define DefWidgetBegin(_tIter) \
91
_tIter \
92
GetBegin() \
93
{ \
94
return _tIter(*this, 0); \
95
}
96
101
#define DefWidgetEnd(_tIter) \
102
_tIter \
103
GetEnd() \
104
{ \
105
return _tIter(*this, GetChildrenCount()); \
106
}
107
115
#define DefWidgetChildrenGetter \
116
DefGetter(override, WidgetRange, Children, \
117
WidgetRange(GetBegin(), GetEnd()))
118
124
#define DefWidgetMemberIterationOperations(_tIter) \
125
DefWidgetBegin(_tIter) \
126
DefWidgetEnd(_tIter) \
127
DefWidgetChildrenGetter
128
134
#define DefWidgetMemberIteration(...) \
135
DefWidgetMemberIterationOperations(Iterator) \
136
DefWidgetSubscriptor(__VA_ARGS__)
137
142
#define DefWidgetMemberIterationBase(_tBase, ...) \
143
DefWidgetMemberIterationOperations(Iterator) \
144
DefWidgetSubscriptorBase(_tBase, __VA_ARGS__)
145
146
YSL_END_NAMESPACE
(UI)
147
148
YSL_END
149
150
#endif
151
YFramework
include
YSLib
UI
WidgetIteration.h
生成于 2013年 四月 24日 星期三 18:41:28 , 为 YSTest使用
1.8.2