YSTest: AccessHistory.hpp 源文件

YSTest PreAlpha_b800_20170810 The YSLib Test Project

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

- 文件列表
- 文件成员

AccessHistory.hpp
浏览该文件的文档.
1 /*
2 © 2013-2015, 2017 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_Core_YShellDefinition // 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.cbegin())
66 DefPred(const, AtEnd, itCurrent == lstRecord.cend())
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
86 DefFwdTmpl(-> decltype(lstRecord.emplace(itCurrent, yforward(args)...)),
87 auto, emplace, lstRecord.emplace(itCurrent, yforward(args)...))
88
97 _type
98 Switch(bool is_prev)
99 {
100 if(is_prev)
101 {
102 --itCurrent;
103 --itCurrent;
104 }
105
106 auto res(std::move(*itCurrent));
107
108 lstRecord.erase(itCurrent++);
109 return res;
110 }
111 };
112
113 } // namespace YSLib;
114
115 #endif
116
YSLib::GAccessList< Bookmark >::ValueType
Bookmark ValueType
访问项：值类型。
Definition: AccessHistory.hpp:47
YSLib::GAccessList< Bookmark >::ListType
list< Bookmark > ListType
记录列表类型。
Definition: AccessHistory.hpp:49
DefFwdTmpl
#define DefFwdTmpl(_q, _t, _n,...)
传递模板。
Definition: YBaseMacro.h:327
DefPred
#define DefPred(_q, _n,...)
Definition: YBaseMacro.h:232
YModules.h
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
YSLib::GAccessList::AtBegin
AtBegin
Definition: AccessHistory.hpp:65
YSLib::GAccessList
访问列表。
Definition: AccessHistory.hpp:43
DefDeMoveCtor
#define DefDeMoveCtor(_t)
Definition: YBaseMacro.h:167
ystdex::cpp2014::cend
auto cend(const _tRange &c) -> decltype(std::end(c))
Definition: range.hpp:87
CHRLib::args
_tParams && args
Definition: CharacterProcessing.h:538
ystdex::cpp2011::end
_type * end(_type(&&array)[_vN])
Definition: range.hpp:54
YSLib::GAccessList::lstRecord
ListType lstRecord
列表记录：项的列表。
Definition: AccessHistory.hpp:53
YSLib::PDefH
PDefH(Environment &, FetchEnvironment,) ImplRet(FetchGlobalInstance().GetEnvironmentRef()) inline PDefH(GUIHost &
取单一环境对象引用。
ystdex::cpp2014::cbegin
auto cbegin(const _tRange &c) -> decltype(std::begin(c))
Definition: range.hpp:79
YSLib::GAccessList::GAccessList
GAccessList()
构造：迭代器指向记录末尾。
Definition: AccessHistory.hpp:59
YSLib::ynothrow
YB_PURE const _type size_t n ynothrow
Definition: YCoreUtilities.h:168
YSLib::GAccessList::DefDeCopyCtor
DefDeCopyCtor(GAccessList) DefDeMoveCtor(GAccessList) DefPred(const
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:241
yforward
#define yforward(_expr)
根据参数类型使用 std::forward 传递对应参数。
Definition: ydef.h:995
YSLib::GAccessList::itCurrent
ListType::iterator itCurrent
迭代器：指示当前项在记录中的插入位置。
Definition: AccessHistory.hpp:55