desktop: CalEditDlg: fixed dialog title bar
[barry.git] / src / vevent.h
blobccf025ddb8aeb571336470ab34b48077f9286a06
1 ///
2 /// \file vevent.h
3 /// Conversion routines for vevents (VCALENDAR, etc)
4 ///
6 /*
7 Copyright (C) 2006-2012, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #ifndef __BARRY_SYNC_VEVENT_H__
23 #define __BARRY_SYNC_VEVENT_H__
25 #include "dll.h"
26 #include "vbase.h"
27 #include "vformat.h"
28 #include "r_calendar.h"
29 #include <stdint.h>
30 #include <string>
32 namespace Barry { namespace Sync {
35 // vCalendar
37 /// Class for converting between RFC 2445 iCalendar data format,
38 /// and the Barry::Calendar class.
39 ///
40 class BXEXPORT vCalendar : public vBase
42 // external reference
43 vTimeConverter &m_vtc;
45 // data to pass to external requests
46 char *m_gCalData; // dynamic memory returned by vformat()... can
47 // be used directly by the plugin, without
48 // overmuch allocation and freeing (see Extract())
49 std::string m_vCalData; // copy of m_gCalData, for C++ use
50 Barry::Calendar m_BarryCal;
52 static const char *WeekDays[7];
54 uint16_t GetMonthWeekNumFromBYDAY(const std::string& ByDay);
55 uint16_t GetWeekDayIndexFromBYDAY(const std::string& ByDay);
57 protected:
58 void RecurToVCal();
59 void RecurToBarryCal(vAttr& rrule, time_t starttime);
61 static uint16_t GetWeekDayIndex(const char *dayname);
62 bool HasMultipleVEvents() const;
64 public:
65 explicit vCalendar(vTimeConverter &vtc);
66 ~vCalendar();
68 const std::string& ToVCal(const Barry::Calendar &cal);
69 const Barry::Calendar& ToBarry(const char *vcal, uint32_t RecordId);
71 const std::string& GetVCal() const { return m_vCalData; }
72 const Barry::Calendar& GetBarryCal() const { return m_BarryCal; }
74 char* ExtractVCal();
76 void Clear();
78 // This is the v-name of the innermost BEGIN/END block
79 static const char* GetVName() { return "VEVENT"; }
82 }} // namespace Barry::Sync
84 #endif