YSTest: AccessHistory.hpp 源文件

YSTest PreAlpha_b500_20140530 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
AccessHistory.hpp
浏览该文件的文档.
1 /*
2 © 2013-2014 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_Service_AccessHistory_hpp_
29 #define YSL_INC_Service_AccessHistory_hpp_ 1
30
31 #include "YModules.h"
32 #include YFM_YSLib_Adaptor_YContainer // for list;
33
34 namespace YSLib
35 {
36
42 template<typename _type>
43 class GAccessList
44 {
45 public:
47 using ValueType = _type;
49 using ListType = list<_type>;
50
51 protected:
53 ListType lstRecord;
55 typename ListType::iterator itCurrent;
56
57 public:
59 GAccessList()
60 : lstRecord(), itCurrent(lstRecord.end())
61 {}
62 DefDeCopyCtor(GAccessList)
63 DefDeMoveCtor(GAccessList)
64
65 DefPred(const, AtBegin, itCurrent == lstRecord.begin())
66 DefPred(const, AtEnd, itCurrent == lstRecord.end())
67
68 DefGetter(const ynothrow, const ListType&, List, lstRecord)
69
71 PDefH(void, Clear, )
72 ImplExpr(lstRecord.clear(), itCurrent = lstRecord.end())
73
75 void
76 DropSubsequent()
77 {
78 lstRecord.erase(itCurrent, lstRecord.end());
79 itCurrent = lstRecord.end();
80 }
81
83 template<typename... _tParams>
84 void
85 Emplace(_tParams&&... args)
86 {
87 lstRecord.emplace(itCurrent, yforward(args)...);
88 }
89
98 _type
99 Switch(bool is_prev)
100 {
101 if(is_prev)
102 {
103 --itCurrent;
104 --itCurrent;
105 }
106
107 auto ret(std::move(*itCurrent));
108
109 lstRecord.erase(itCurrent++);
110 return ret;
111 }
112 };
113
114 } // namespace YSLib;
115
116 #endif
117
YSLib::GAccessList::lstRecord
ListType lstRecord
列表记录：项的列表。
Definition: AccessHistory.hpp:53
YSLib::GAccessList::GAccessList
GAccessList()
构造：迭代器指向记录末尾。
Definition: AccessHistory.hpp:59
YSLib::GAccessList::AtBegin
AtBegin
Definition: AccessHistory.hpp:65
DefPred
#define DefPred(_q, _n,...)
Definition: YBaseMacro.h:172
YSLib::UI::args
yconstfn const string _tParams && args
Definition: Loader.h:111
YSLib::GAccessList< Bookmark >::ListType
list< Bookmark > ListType
记录列表类型。
Definition: AccessHistory.hpp:49
YSLib::GAccessList::DefDeCopyCtor
DefDeCopyCtor(GAccessList) DefDeMoveCtor(GAccessList) DefPred(const
yforward
#define yforward(_expr)
根据参数类型使用 std::forward 传递对应参数。
Definition: ydef.h:722
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:180
YSLib::GAccessList::itCurrent
ListType::iterator itCurrent
迭代器：指示当前项在记录中的插入位置。
Definition: AccessHistory.hpp:55
DefDeMoveCtor
#define DefDeMoveCtor(_t)
Definition: YBaseMacro.h:141
ImplExpr
#define ImplExpr(...)
Definition: YBaseMacro.h:93
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:514
YSLib::GAccessList< Bookmark >::ValueType
Bookmark ValueType
访问项：值类型。
Definition: AccessHistory.hpp:47
YModules.h
YSLib::GAccessList
访问列表。
Definition: AccessHistory.hpp:43