forked from sourcesimian/uICAL
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutil.cpp
More file actions
61 lines (55 loc) · 1.29 KB
/
Copy pathutil.cpp
File metadata and controls
61 lines (55 loc) · 1.29 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
/*############################################################################
# Copyright (c) 2020 Source Simian : https://github.com/sourcesimian/uICAL #
############################################################################*/
//#include <cstdlib>
#include "uICAL/cppstl.h"
#include "uICAL/types.h"
#include "uICAL/util.h"
namespace uICAL
{
Joiner::Joiner(char delim)
{
this->delim = delim;
}
ostream &Joiner::out()
{
return this->stm;
}
Joiner &Joiner::next()
{
if (this->stm.empty())
{
this->values.push_back("");
}
else
{
this->values.push_back(this->stm);
this->stm.clear();
}
return *this;
}
void Joiner::str(ostream &out) const
{
bool started = false;
for (string value : this->values)
{
if (started)
out << this->delim;
else
started = true;
out << value;
}
}
void Joiner::write(ostream &out) const
{
bool started = false;
for (string value : this->values)
{
if (started)
out << this->delim;
else
started = true;
out << value;
}
}
}