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