r_recur_base.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_RECUR_BASE_H__
00023 #define __BARRY_RECORD_RECUR_BASE_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 class BXEXPORT RecurBase
00044 {
00045 public:
00046
00047
00048
00049
00050
00051
00052 enum RecurringCodeType {
00053 Day = 1,
00054
00055 MonthByDate = 3,
00056
00057 MonthByDay = 4,
00058
00059 YearByDate = 5,
00060
00061 YearByDay = 6,
00062
00063
00064 Week = 12
00065
00066 };
00067
00068
00069 bool Recurring;
00070 RecurringCodeType RecurringType;
00071 unsigned short Interval;
00072 time_t RecurringEndTime;
00073
00074
00075
00076
00077
00078
00079 bool Perpetual;
00080
00081 unsigned short
00082 DayOfWeek,
00083 WeekOfMonth,
00084 DayOfMonth,
00085 MonthOfYear;
00086 unsigned char WeekDays;
00087
00088
00089 #define CAL_WD_SUN 0x01
00090 #define CAL_WD_MON 0x02
00091 #define CAL_WD_TUE 0x04
00092 #define CAL_WD_WED 0x08
00093 #define CAL_WD_THU 0x10
00094 #define CAL_WD_FRI 0x20
00095 #define CAL_WD_SAT 0x40
00096
00097 protected:
00098 void ParseRecurrenceData(const void *data);
00099 static unsigned char WeekDayProto2Rec(uint8_t raw_field);
00100 static uint8_t WeekDayRec2Proto(unsigned char weekdays);
00101
00102 protected:
00103 RecurBase();
00104 ~RecurBase();
00105
00106 public:
00107
00108
00109 bool ParseField(uint8_t type, const unsigned char *data, size_t size,
00110 const IConverter *ic = 0);
00111 void BuildRecurrenceData(time_t StartTime, void *data) const;
00112
00113 uint8_t RecurringFieldType() const;
00114
00115 void Clear();
00116
00117 void Dump(std::ostream &os) const;
00118 };
00119
00120 BXEXPORT inline std::ostream& operator<<(std::ostream &os, const RecurBase &msg) {
00121 msg.Dump(os);
00122 return os;
00123 }
00124
00125 }
00126
00127 #endif
00128