-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathFrameRange.i
More file actions
74 lines (60 loc) · 1.88 KB
/
FrameRange.i
File metadata and controls
74 lines (60 loc) · 1.88 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
%include "common.i"
%{
#include "sequenceParser/FrameRange.hpp"
%}
#ifdef SWIGJAVA
%rename(toString) sequenceParser::FrameRange::string;
%rename(equals) sequenceParser::FrameRange::operator==;
%ignore sequenceParser::FrameRangesConstIterator::operator++;
%ignore sequenceParser::FrameRangesConstIterator::operator--;
%rename(equals) sequenceParser::FrameRangesConstIterator::operator==;
%ignore sequenceParser::FrameRangesConstIterator::operator!=;
#elif SWIGPYTHON
%rename(__str__) sequenceParser::FrameRange::string;
%rename(__eq__) sequenceParser::FrameRange::operator==;
%rename(__next__) sequenceParser::FrameRangesConstIterator::operator++;
%rename(__previous__) sequenceParser::FrameRangesConstIterator::operator--;
%rename(__eq__) sequenceParser::FrameRangesConstIterator::operator==;
%rename(__ne__) sequenceParser::FrameRangesConstIterator::operator!=;
#endif
%include "FrameRange.hpp"
#ifdef SWIGPYTHON
%pythoncode
{
class PyFrameRangesConstIterator:
def __init__(self, it, itEnd):
self.it = it
self.itEnd = itEnd
def __iter__(self):
return self
def __next__(self):
'''Python3 iterator'''
self.it = self.it.next()
if self.it == self.itEnd:
raise StopIteration
return self.it.value()
def next(self):
'''Python2 iterator'''
return self.__next__()
}
%extend sequenceParser::FrameRangesView
{
%pythoncode
{
def __iter__(self):
return PyFrameRangesConstIterator(self.begin().previous(), self.end())
def __str__(self):
return self.string()
}
}
%extend sequenceParser::FrameRangesSubView
{
%pythoncode
{
def __iter__(self):
return PyFrameRangesConstIterator(self.begin().previous(), self.end())
def __str__(self):
return self.string()
}
}
#endif