-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodel.h
More file actions
75 lines (59 loc) · 1.11 KB
/
model.h
File metadata and controls
75 lines (59 loc) · 1.11 KB
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
#ifndef MODEL_H
#define MODEL_H
#include "rangelist.h"
class SubtitleData
{
public:
typedef RangeList::iterator iterator;
private:
// This list is always sorted based on time
// So that it can be searched in log(n) time
RangeList Subs;
RangeList *VO;
iterator Selected;
public:
SubtitleData(RangeList &&subs, RangeList *vo = nullptr) :
Subs(std::move(subs)),
VO(vo),
Selected(Subs.end())
{
}
bool hasVO() const
{
return VO;
}
const SrtSubtitle &operator[](RangeList::size_type index) const
{
return Subs[index];
}
iterator begin()
{
return Subs.begin();
}
iterator end()
{
return Subs.end();
}
void addSubtitle(SrtSubtitle &&sub);
RangeList *vo()
{
return VO;
}
RangeList *subs()
{
return &Subs;
}
void setSelectedSubtitle(iterator sub)
{
Selected = sub;
}
iterator selectedSubtitle()
{
return Selected;
}
bool hasSelected()
{
return Selected != Subs.end();
}
};
#endif // MODEL_H