YSTest: ReadingList.h 源文件

YSTest PreAlpha_b400_20130424 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
ReadingList.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 INC_YREADER_READINGLIST_H_
29 #define INC_YREADER_READINGLIST_H_ 1
30
31 #include "Shells.h"
32
33 YSL_BEGIN_NAMESPACE(YReader)
34
35
40 class Bookmark
41 {
42 public:
47 typedef size_t PositionType;
48
49 IO::Path Path;
51 PositionType Position;
52
53 Bookmark(const IO::Path& path, size_t pos)
54 : Path(path), Position(pos)
55 {}
56 DefDeCopyCtor(Bookmark)
57 DefDeMoveCtor(Bookmark)
58
60 explicit
61 operator ValueNode::Container() const;
62 };
63
64
69 inline bool
70 operator==(const Bookmark& x, const Bookmark& y)
71 {
72 return x.Path == y.Path && x.Position == y.Position;
73 }
74
75
80 typedef vector<Bookmark::PositionType> BookmarkList;
81
82
88 class ReadingList
89 {
90 public:
94 typedef list<Bookmark> ListType;
95
96 private:
100 ListType reading_list;
104 ListType::iterator now_reading;
105
106 public:
110 ReadingList();
111 DefDelCopyCtor(ReadingList)
112 DefDelMoveCtor(ReadingList)
113
115 explicit
116 operator ValueNode::Container() const;
117
122 pair<bool, bool>
123 CheckBoundary();
124
128 PDefH(void, Clear, )
129 ImplExpr(reading_list.clear(), now_reading = reading_list.end())
130
135 void
136 DropSubsequent();
137
141 void
142 Insert(const IO::Path&, size_t);
143
152 Bookmark
153 Switch(bool);
154 };
155
156 YSL_END_NAMESPACE(YReader)
157
158 #endif
159