-
Notifications
You must be signed in to change notification settings - Fork 0
/
calendar.hpp
67 lines (51 loc) · 1.54 KB
/
calendar.hpp
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
//
// calendar.hpp
// CSVtoICS
//
// Created by swaaws on 06.01.16.
// Copyright © 2016 swaaws. All rights reserved.
//
#ifndef calendar_hpp
#define calendar_hpp
#endif /* calendar_hpp */
using namespace std;
class calendar{
private:
int bdate;
int edate;
int btime;
int etime;
string eventname;
string calendarname;
public:
void init(string calendername);
void addevent(string bdate, string edate, string btime, string etime, string eventname);
// idx 01012015 01022015 000000 235959, F1
void end();
};
void calendar::init(string ncalendarname){
calendarname= ncalendarname;
ofstream textDatei(calendarname);
if(textDatei){
textDatei << "BEGIN:VCALENDAR\n" << "VERSION:2.0\n" << "X-WR-CALNAME:"<<calendarname <<"\n" << "X-WR-TIMEZONE:Europe/Berlin\n" << "METHOD:PUBLISH\n";
}
}
void calendar::end(){
ofstream textDatei(calendarname, ios::app);
if(textDatei){
textDatei <<"END:VCALENDAR";
textDatei.close();
}
}
//1TODO: LOCATION: DESCRIPTION:URL;VALUE=URI:http://
void calendar::addevent(string bdate,string edate, string btime, string etime, string eventname){
ofstream textDatei(calendarname, ios::app);
textDatei << "BEGIN:VEVENT\n"
<< "UID:" << bdate << "\n"
<< "SUMMARY:"<< eventname << "\n"
<< "CLASS:PUBLIC\n"
<< "DTSTART:" << bdate << "T" << btime << "Z\n"
<< "DTEND:" << edate << "T" << etime << "Z\n"
<< "DTSTAMP:" << bdate << "T" << btime << "Z\n"
<< "END:VEVENT\n";
}