3 /// Blackberry database record parser class for calendar records.
7 Copyright (C) 2005-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_RECORD_CALENDAR_H__
23 #define __BARRY_RECORD_CALENDAR_H__
27 #include "r_recur_base.h"
36 // forward declarations
40 // NOTE: All classes here must be container-safe! Perhaps add sorting
41 // operators in the future.
46 /// \addtogroup RecordParserClasses
49 class BXEXPORT Calendar
: public RecurBase
52 typedef Barry::UnknownsType UnknownsType
;
62 Barry::TimeT NotificationTime
; // 0 means notification is off
63 Barry::TimeT StartTime
;
65 EmailAddressList Organizer
;
66 EmailAddressList AcceptedBy
;
67 EmailAddressList Invited
; // list of invited people (email a
72 /// This lists the available settings found in the device.
73 /// This list is based on information from MS Outlook 2007
74 /// (Free ==0 and Busy == 2)
75 /// This is FBTYPE in RFC2445 and is defined as
76 /// FREE, BUSY, BUSY-UNAVAILABLE and BUSY-TENTATIVE
78 enum FreeBusyFlagType
{
84 FreeBusyFlagType FreeBusyFlag
;
89 /// This is also called classification in Evolution and it
90 /// is the equivilant of public or private in outlook
91 /// Private is set to 0x2 in Outlook
92 /// RFC2445 CLASS is PUBLIC, PRIVATE, CONFIDENTIAL
100 ClassFlagType ClassFlag
;
102 uint64_t CalendarID
; // Calendar ID (usefull if devices have several calendars)
104 uint16_t TimeZoneCode
; // the time zone originally used
105 // for the recurrence data...
106 // seems to have little use, but
107 // set to your current time zone
109 bool TimeZoneValid
; // true if the record contained a
110 // time zone code, or in other words,
111 // true if TimeZoneCode contains
112 // valid data. Be sure to set this to
113 // to true if you desire to write a
114 // calendar item with a time zone
115 // to the device, otherwise, the builder
116 // code will skip the time zone.
119 UnknownsType Unknowns
;
122 static FreeBusyFlagType
FreeBusyFlagProto2Rec(uint8_t f
);
123 static uint8_t FreeBusyFlagRec2Proto(FreeBusyFlagType f
);
125 static ClassFlagType
ClassFlagProto2Rec(uint8_t f
);
126 static uint8_t ClassFlagRec2Proto(ClassFlagType f
);
128 virtual void DumpSpecialFields(std::ostream
&os
) const;
131 const unsigned char* ParseField(const unsigned char *begin
,
132 const unsigned char *end
, const IConverter
*ic
= 0);
138 // Parser / Builder API (see parser.h / builder.h)
139 void Validate() const;
140 uint8_t GetRecType() const { return RecType
; }
141 uint32_t GetUniqueId() const { return RecordId
; }
142 void SetIds(uint8_t Type
, uint32_t Id
) { RecType
= Type
; RecordId
= Id
; }
143 void ParseHeader(const Data
&data
, size_t &offset
);
144 void ParseFields(const Data
&data
, size_t &offset
, const IConverter
*ic
= 0);
145 void BuildHeader(Data
&data
, size_t &offset
) const;
146 void BuildFields(Data
&data
, size_t &offset
, const IConverter
*ic
= 0) const;
148 // operations (common among record classes)
150 void Dump(std::ostream
&os
) const;
151 std::string
GetDescription() const;
154 bool operator<(const Calendar
&other
) const;
157 static const char * GetDBName() { return "Calendar"; }
158 static uint8_t GetDefaultRecType() { return 5; } // or 0?
160 // Generic Field Handle support
161 static const FieldHandle
<Calendar
>::ListT
& GetFieldHandles();
164 BXEXPORT
inline std::ostream
& operator<<(std::ostream
&os
, const Calendar
&msg
) {
170 class BXEXPORT CalendarAll
: public Calendar
173 std::string MailAccount
;
176 virtual void DumpSpecialFields(std::ostream
&os
) const;
179 // Parser / Builder API (see parser.h / builder.h)
180 void ParseHeader(const Data
&data
, size_t &offset
);
186 static const char * GetDBName() { return "Calendar - All"; }
188 // Generic Field Handle support
189 static const FieldHandle
<CalendarAll
>::ListT
& GetFieldHandles();
192 BXEXPORT
inline std::ostream
& operator<<(std::ostream
&os
, const CalendarAll
&msg
) {