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
00455 vector < time_t > generateInstanceTimes(time_t viewBegin, time_t viewEnd);
00456
00457
00465 vector < time_t > getInstanceTimes(time_t viewBegin, time_t viewEnd);
00466
00475 int getInstanceNumber(time_t viewBegin, time_t viewEnd);
00476
00477
00484 int getDuration();
00491 bool getRecurrenceProperties();
00498 bool getAlarmProperties();
00499
00503 virtual ~ CComponent();
00504
00511 void setCreatedTime(time_t iCreatedTime);
00512
00520 time_t getCreatedTime();
00524 void removeAlarm();
00528 void removeRecurrence();
00529
00530
00531
00532 string getTzid();
00533
00534
00535
00536
00537 void setTzid(string sZone);
00541 time_t getTzOffset(void);
00542
00546 void setTzOffset(time_t);
00547
00551 string toString();
00555 vector < string > extractSubStrings(string SourceString, string byField);
00566 void updateUntilInDB(time_t until,int& pErrorCode);
00567
00573 bool updateAlarmTriggerTime(time_t *pOutInstanceTime);
00574
00581 void setCalendarId(int iId);
00582
00589 int getCalendarId();
00590
00591 private:
00592
00604 bool generateYearlyInstanceTime(time_t viewBegin, time_t viewEnd, vector<time_t> &time);
00605
00606 private:
00607
00616
00617
00618 string sId;
00620 int iCalId;
00622 int iType;
00624 int iFlags;
00626 int iStatus;
00628 time_t iDateStart;
00630 time_t iDateEnd;
00632 time_t iLastModified;
00634 time_t iCreatedTime;
00636 time_t iuntil;
00638 int iAllDay;
00640 string szSummary;
00642 string szDescription;
00644 string szLocation;
00646 string szuid;
00648 CRecurrence *pRecurrence;
00650 CAlarm *pAlarm;
00652 string sTzid ;
00653
00654 time_t tzOffset;
00655
00656
00657 time_t iStDate;
00659 time_t iEndDate;
00661 vector < time_t > rTimes;
00664 };
00665
00666 #endif