00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __BARRY_RECORD_CALENDAR_H__
00023 #define __BARRY_RECORD_CALENDAR_H__
00024
00025 #include "dll.h"
00026 #include "record.h"
00027 #include <iosfwd>
00028 #include <string>
00029 #include <vector>
00030 #include <map>
00031 #include <stdint.h>
00032
00033 namespace Barry {
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 class BXEXPORT Calendar
00046 {
00047 public:
00048 typedef std::vector<UnknownField> UnknownsType;
00049
00050 uint8_t RecType;
00051 uint32_t RecordId;
00052
00053
00054 bool AllDayEvent;
00055 std::string Subject;
00056 std::string Notes;
00057 std::string Location;
00058 time_t NotificationTime;
00059 time_t StartTime;
00060 time_t EndTime;
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 enum FreeBusyFlagType {
00072 Free = 0,
00073 Tentative,
00074 Busy,
00075 OutOfOffice
00076 };
00077 FreeBusyFlagType FreeBusyFlag;
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 enum ClassFlagType {
00088 Public = 0,
00089 Confidential,
00090 Private
00091 };
00092
00093 ClassFlagType ClassFlag;
00094
00095
00096
00097
00098
00099
00100
00101 enum RecurringCodeType {
00102 Day = 1,
00103
00104 MonthByDate = 3,
00105
00106 MonthByDay = 4,
00107
00108 YearByDate = 5,
00109
00110 YearByDay = 6,
00111
00112
00113 Week = 12
00114
00115 };
00116
00117
00118
00119 bool Recurring;
00120 RecurringCodeType RecurringType;
00121 unsigned short Interval;
00122 time_t RecurringEndTime;
00123
00124
00125
00126
00127
00128
00129 bool Perpetual;
00130 unsigned short TimeZoneCode;
00131
00132
00133
00134
00135 bool TimeZoneValid;
00136
00137
00138 unsigned short
00139 DayOfWeek,
00140 WeekOfMonth,
00141 DayOfMonth,
00142 MonthOfYear;
00143 unsigned char WeekDays;
00144
00145
00146 #define CAL_WD_SUN 0x01
00147 #define CAL_WD_MON 0x02
00148 #define CAL_WD_TUE 0x04
00149 #define CAL_WD_WED 0x08
00150 #define CAL_WD_THU 0x10
00151 #define CAL_WD_FRI 0x20
00152 #define CAL_WD_SAT 0x40
00153
00154
00155 UnknownsType Unknowns;
00156
00157 public:
00158 const unsigned char* ParseField(const unsigned char *begin,
00159 const unsigned char *end);
00160 void ParseRecurrenceData(const void *data);
00161 void BuildRecurrenceData(void *data) const;
00162
00163 public:
00164 Calendar();
00165 ~Calendar();
00166
00167
00168 uint8_t GetRecType() const { return RecType; }
00169 uint32_t GetUniqueId() const { return RecordId; }
00170 void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = Id; }
00171 void ParseHeader(const Data &data, size_t &offset);
00172 void ParseFields(const Data &data, size_t &offset);
00173 void BuildHeader(Data &data, size_t &offset) const;
00174 void BuildFields(Data &data, size_t &offset) const;
00175
00176 void Clear();
00177
00178 void Dump(std::ostream &os) const;
00179
00180
00181 bool operator<(const Calendar &other) const { return StartTime < other.StartTime; }
00182
00183
00184 static const char * GetDBName() { return "Calendar"; }
00185 static uint8_t GetDefaultRecType() { return 5; }
00186 };
00187
00188 BXEXPORT inline std::ostream& operator<<(std::ostream &os, const Calendar &msg) {
00189 msg.Dump(os);
00190 return os;
00191 }
00192
00193
00194
00195 }
00196
00197 #endif
00198