-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSeqStream.cpp
More file actions
43 lines (37 loc) · 840 Bytes
/
SeqStream.cpp
File metadata and controls
43 lines (37 loc) · 840 Bytes
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
#include<seq_view.h>
namespace SeqView {
SeqStream::SeqStream(istream * is_) {
is = is_;
ipos = 0;
opos = 0;
while(ipos < 199 && is->good() && !is->eof()) {
char ch;
is->get(ch);
buffer[ipos] = ch;
ipos += 1;
}
}
bool SeqStream::good() {
return is->good() || ipos != opos;
}
bool SeqStream::eof() {
return opos > ipos && is->eof();
}
void SeqStream::get(char &ch) {
if(opos < ipos) {
ch = buffer[opos];
opos += 1;
} else {
is->get(ch);
opos += 1;
}
}
bool SeqStream::start_over() {
bool okay = false;
if(opos <= ipos) {
opos = 0;
okay = true;
}
return okay;
}
}