00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __RECURRENCE_RULE_H__
00025 #define __RECURRENCE_RULE_H__
00026
00027
00028 #include<libical/ical.h>
00029 #include "DbCalls.h"
00030 #include<vector>
00031 #include <string>
00032 using std::string;
00033 using std::vector;
00034
00035
00036 typedef enum FREQUENCY {
00037
00038 SECONDLY_RECURRENCE = 0,
00039 MINUTELY_RECURRENCE = 1,
00040 HOURLY_RECURRENCE = 2,
00041 DAILY_RECURRENCE = 3,
00042 WEEKLY_RECURRENCE = 4,
00043 MONTHLY_RECURRENCE = 5,
00044 YEARLY_RECURRENCE = 6,
00045 NO_RECURRENCE = 7
00046 };
00047
00048 typedef enum {
00049 SUNDAY = 0,
00050 MONDAY,
00051 TUESDAY,
00052 WEDNESDAY,
00053 THURSDAY,
00054 FRIDAY,
00055 SATURDAY
00056 } WeekDay;
00057
00058 typedef enum {
00059 RECURRENCE_RULE = 0,
00060 EXCEPTION_RULE
00061 } RuleType;
00062
00067 class CRecurrenceRule {
00068
00069 public:
00070
00074 CRecurrenceRule(CRecurrenceRule & ref);
00075
00079 CRecurrenceRule & operator=(CRecurrenceRule & right);
00080
00084 CRecurrenceRule();
00085
00089 ~CRecurrenceRule();
00090
00098 bool setRuleType(RuleType iType);
00099
00108 RuleType getRuleType();
00109
00120 bool rruleParser(string szRule);
00121
00128 bool setRrule(string szRRule);
00129
00136 string getRrule();
00137
00145 bool setFrequency(FREQUENCY iValue);
00146
00153 FREQUENCY getFrequency();
00154
00161 bool setUntil(time_t iUntil);
00162
00169 time_t getUntil();
00170
00177 bool setCount(int iCount);
00178
00185 int getCount();
00186
00194 bool setSecond(vector < short > vSec);
00195
00203 vector < short >getSecond();
00204
00213 bool setMinute(vector < short > vMinute);
00214
00222 vector < short >getMinute();
00223
00231 bool setHour(vector < short > vHour);
00232
00240 vector < short >getHour();
00241
00250 bool setWeekDay(vector < short > vByWeekDay);
00251
00260 vector < short >getWeekDay();
00261
00268 bool setMonthDay(vector < short > vByMonthDay);
00269
00276 vector < short >getMonthDay();
00277
00285 bool setYearDay(vector < short > vByYearDay);
00286
00293 vector < short >getYearDay();
00294
00302 bool setWeekNumber(vector < short > vByWeekNumber);
00303
00311 vector < short >getWeekNumber();
00312
00320 bool setMonth(vector < short > vMonth);
00321
00329 vector < short >getMonth();
00330
00346 bool setPos(vector < short > vPosition);
00347
00354 vector < short >getPos();
00355
00372 bool setWeekStart(icalrecurrencetype_weekday start);
00373
00381 icalrecurrencetype_weekday getWeekStart();
00382
00388 bool setInterval(short interval);
00389
00397 short getInterval();
00401 string toString();
00402
00403
00408 CRecurrenceRule(int iType, string szRRule);
00409
00413 bool checkRuleIsComplex();
00414 private:
00422 vector < short > convertArrayToVector(short array[], int iLengthMax);
00423
00424 FREQUENCY iFreq;
00426 string szRule;
00428 int iCount;
00430 short interval;
00432 time_t iUntil;
00434 RuleType iType;
00444 icalrecurrencetype_weekday weekStart;
00445
00446
00447
00448
00449
00450 vector < short >vBySecond;
00452 vector < short >vByMinute;
00454 vector < short >vByHour;
00456 vector < short >vByWeekDay;
00458 vector < short >vByMonthDay;
00460 vector < short >vByYearDay;
00462 vector < short >vByWeekNumber;
00464 vector < short >vByMonth;
00466 vector < short >vBySetPos;
00467 };
00468
00469 #endif