-
Notifications
You must be signed in to change notification settings - Fork 5
/
LxComposeIter.h
80 lines (70 loc) · 1.53 KB
/
LxComposeIter.h
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include <list>
using std::list;
#ifndef __LEXI_COMPOSE_ITER_H
#define __LEXI_COMPOSE_ITER_H
class ComposeParagraph;
class ComposePage;
class ComposeDoc;
class ComposeRow;
typedef list<ComposeRow*> RowList;
typedef list<ComposePage*>::iterator page_iter;
typedef list<ComposeParagraph*>::iterator paragraph_iter;
typedef list<ComposeRow*>::iterator row_iter;
class LxRowInPageIter;
#include "LxComposeDoc.h"
class LxRowInPageIter
{
public:
LxRowInPageIter() = default;
LxRowInPageIter(ComposePage* page, paragraph_iter pagraph, row_iter irow) :
this_page(page), paragraph(pagraph), row(irow)
{
}
bool operator==(const LxRowInPageIter& other) const
{
return row == other.row;
}
bool operator!=(const LxRowInPageIter& other) const
{
return row != other.row;
}
LxRowInPageIter& operator=(LxRowInPageIter& other)
{
this_page = other.this_page;
paragraph = other.paragraph;
row = other.row;
return *this;
}
ComposeRow* operator*()
{
return *row;
}
LxRowInPageIter& operator++()
{
row++;
if (row == (*paragraph)->end())
{
paragraph++;
if (paragraph != this_page->end())
row = (*paragraph)->begin();
}
return *this;
}
LxRowInPageIter operator++(int)
{
LxRowInPageIter tmp = *this;
row++;
if (row == (*paragraph)->end())
{
paragraph++;
if (paragraph != this_page->end())
row = (*paragraph)->begin();
}
return tmp;
}
private:
ComposePage* this_page;
paragraph_iter paragraph;
row_iter row;
};
#endif