forked from peterkvt80/vbit2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
normalpages.cpp
64 lines (52 loc) · 1.03 KB
/
normalpages.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "normalpages.h"
using namespace vbit;
NormalPages::NormalPages()
{
ResetIter();
}
NormalPages::~NormalPages()
{
}
void NormalPages::addPage(TTXPageStream* p)
{
_NormalPagesList.push_front(p);
}
void NormalPages::deletePage(TTXPageStream* p)
{
_NormalPagesList.remove(p);
ResetIter();
}
TTXPageStream* NormalPages::NextPage()
{
if (_page == nullptr)
{
++_iter;
_page = *_iter;
}
else
{
++_iter;
_page = *_iter;
}
if (_iter == _NormalPagesList.end())
{
_page = nullptr;
}
if (_page)
{
if (_page->GetStatusFlag()==TTXPageStream::MARKED)
{
std::cerr << "[NormalPages::NextPage] Deleted " << _page->GetSourcePage() << std::endl;
_page->SetState(TTXPageStream::GONE);
_NormalPagesList.remove(_page);
ResetIter();
return nullptr;
}
}
return _page;
}
void NormalPages::ResetIter()
{
_iter=_NormalPagesList.begin();
_page=nullptr;
}