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 __CCOMPONENT_H__
00025 #define __CCOMPONENT_H__
00026
00027
00028 #include <string>
00029 #include<sstream>
00030 #include <vector>
00031 using namespace::std;
00032 using std::string;
00033 using std::vector;
00034
00035 class CAlarm;
00036 class CRecurrence;
00037 class CRecurrenceRule;
00038 class CAttendee;
00039 class COrganizer;
00040 #include <sys/time.h>
00041
00042
00043 typedef enum {
00044 NEEDSACTION_STATUS = 0,
00045 COMPLETED_STATUS,
00046 INPROCESS_STATUS,
00047 CANCELLED_STATUS,
00048 CONFIRMED_STATUS,
00049 TENTATIVE_STATUS,
00050 DRAFT_STATUS,
00051 FINAL_STATUS,
00052 SENT_STATUS,
00053 DECLINED_STATUS,
00054 DELEGATED_STATUS,
00055 ACCEPTED_STATUS,
00056 }statusParam;
00057
00063 class CComponent {
00064
00065 public:
00066
00070 CComponent();
00071
00075 CComponent(CComponent &);
00076
00080 CComponent(string description);
00081
00085 CComponent(string summary, time_t tododue, int status);
00086
00090 CComponent(string summary, string description, string location, time_t dateStart, time_t dateEnd);
00091
00095 CComponent(string szuid, string szDescription, time_t stDateStart);
00096
00105 vector < CRecurrenceRule * >retrieveRecurreceRuleObject();
00106
00114 const CComponent & operator=(const CComponent & right);
00115
00132 CComponent(string id, int type,int flags, string summary, string description,
00133 string location, int status, time_t dateStart, time_t dateEnd,
00134 time_t lastModified,time_t iCreatedTime);
00135
00136
00143 bool setId(string sId);
00144
00151 string getId();
00152
00163 bool setType(int num);
00164
00171 int getType();
00176 bool setFlags(int iflag);
00177
00178
00185 int getFlags();
00186
00194 bool setSummary(string szSummary);
00195
00203 string getSummary();
00204
00205
00213 bool setDescription(string strDescription);
00214
00222 string getDescription();
00223
00224
00232 bool setLocation(string szLocation);
00233
00241 string getLocation();
00242
00243
00250 bool setStatus(int iStatus);
00251
00252
00259 int getStatus();
00260
00261
00268 bool setDateStart(time_t dateStart);
00269
00270
00277 time_t getDateStart();
00278
00279
00280
00287 bool setDateEnd(time_t dateEnd);
00288
00289
00296 time_t getDateEnd();
00297
00298
00305 bool setLastModified(time_t lastModified);
00306
00307
00314 bool setRecurrence(CRecurrence * ptrRecur);
00321 CRecurrence *getRecurrence();
00322
00323
00330 time_t getLastModified();
00331
00338 bool setUntil(time_t iuntil);
00345 time_t getUntil();
00346
00355 bool setGUid(string szuid);
00364 string getGUid();
00376 bool setRtype(int irtype);
00377
00390 int getRtype();
00391
00398 bool setAlarm(CAlarm * uAlarm);
00399
00407 bool setAlarm(int time_before, int alarm_duration);
00408
00415 bool setAlarmBefore(int time_before);
00416
00423 CAlarm *getAlarm();
00424
00430 int getAlarmBefore();
00431
00438 int getAllDay();
00439
00446 bool setAllDay(int iAllDay);
00447
00457 vector < time_t > generateInstanceTimes(time_t viewBegin, time_t viewEnd);
00458
00466 void generateInstanceTimes(time_t viewBegin, time_t viewEnd, vector<time_t> &instance_times);
00467
00468
00476 vector < time_t > getInstanceTimes(time_t viewBegin, time_t viewEnd);
00477
00485 void getInstanceTimes(time_t viewBegin, time_t viewEnd, vector<time_t> &instance_times);
00486
00495 int getInstanceNumber(time_t viewBegin, time_t viewEnd);
00496
00497
00504 int getDuration();
00511 bool getRecurrenceProperties();
00518 bool getAlarmProperties();
00519
00523 virtual ~ CComponent();
00524
00531 void setCreatedTime(time_t iCreatedTime);
00532
00540 time_t getCreatedTime();
00544 void removeAlarm();
00548 void removeRecurrence();
00549
00550
00551
00552 string getTzid();
00553
00554
00555
00556
00557 void setTzid(string sZone);
00561 time_t getTzOffset(void);
00562
00566 void setTzOffset(time_t);
00567
00571 string toString();
00575 vector < string > extractSubStrings(string SourceString, string byField);
00586 void updateUntilInDB(time_t until,int& pErrorCode);
00587
00593 bool updateAlarmTriggerTime(time_t *pOutInstanceTime);
00594
00601 void setCalendarId(int iId);
00602
00609 int getCalendarId();
00610
00611 private:
00612
00624 bool generateYearlyInstanceTime(time_t viewBegin, time_t viewEnd, vector<time_t> &time);
00625
00626 private:
00627
00636
00637
00638 string sId;
00640 int iCalId;
00642 int iType;
00644 int iFlags;
00646 int iStatus;
00648 time_t iDateStart;
00650 time_t iDateEnd;
00652 time_t iLastModified;
00654 time_t iCreatedTime;
00656 time_t iuntil;
00658 int iAllDay;
00660 string szSummary;
00662 string szDescription;
00664 string szLocation;
00666 string szuid;
00668 CRecurrence *pRecurrence;
00670 CAlarm *pAlarm;
00672 string sTzid ;
00673
00674 time_t tzOffset;
00675
00676
00677 time_t iStDate;
00679 time_t iEndDate;
00681 vector < time_t > rTimes;
00684 };
00685
00686 #endif