forked from sourcesimian/uICAL
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvlinestream.cpp
More file actions
54 lines (51 loc) · 1.51 KB
/
Copy pathvlinestream.cpp
File metadata and controls
54 lines (51 loc) · 1.51 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
/*############################################################################
# Copyright (c) 2020 Source Simian : https://github.com/sourcesimian/uICAL #
############################################################################*/
#include "uICAL/cppstl.h"
#include "uICAL/types.h"
#include "uICAL/error.h"
#include "uICAL/util.h"
#include "uICAL/logging.h"
#include "uICAL/vline.h"
#include "uICAL/vlinestream.h"
namespace uICAL
{
VLineStream::VLineStream(istream &ical)
: ical(ical), currentLine(nullptr), repeat(false)
{
}
void VLineStream::repeatLine()
{
this->repeat = true;
}
const VLine_ptr VLineStream::next()
{
if (!this->repeat || this->currentLine == nullptr)
{
string line;
if (line.readfrom(this->ical, '\n'))
{
line.rtrim();
while (true)
{
char next = this->ical.peek();
string line2;
if (next != 0x20 && next != 0x09)
break;
this->ical.get();
if (!line2.readfrom(this->ical, '\n'))
break;
line2.rtrim();
line = line + line2;
}
this->currentLine = new_ptr<VLine>(line);
}
else
{
this->currentLine = nullptr;
}
}
this->repeat = false;
return this->currentLine;
}
}