00001 00020 #ifndef __ICALCONVERTER_H__ 00021 #define __ICALCONVERTER_H__ 00022 using namespace std; 00023 extern "C" { 00024 #include <libical/ical.h> 00025 #include <libical/icalcomponent.h> 00026 #include <libical/icalenums.h> 00027 #include "stdlib.h" 00028 #include "stdio.h" 00029 } 00030 #include "CComponent.h" 00031 #include "CRecurrenceRule.h" 00032 #include "CProperties.h" 00033 #include "CParameters.h" 00034 typedef enum { 00035 ICAL_TYPE = 0, 00036 VCAL_TYPE, 00037 UNKNOWN_TYPE 00038 }FileType; 00043 class ICalConverter { 00044 00045 public: 00056 string localToIcalVcal(CComponent *pEntry,FileType iType,int pErrorCode); 00067 CComponent *toLocal(string strIcalComp,FileType iType,int pErrorCode); 00071 ICalConverter(); 00075 ~ICalConverter(); 00076 00083 string appendControlM(string szContents); 00084 00090 string toString(); 00101 vector < CComponent* > icalVcalToLocal(string strIcalComp,FileType iType,int pErrorCode); 00109 string strip(string szContents); 00122 bool checkCount(string szContents,string szBegin,string szEnd,unsigned int& iCount); 00131 string validateContents(string szContents); 00139 int getIntFromIcaltimetype(struct icaltimetype ical_time); 00140 00141 private: 00148 float stringToFloat(string szValue); 00156 string addAlarmDateToString(string strIcalComp, string strVCalAlarmDate); 00165 string addRuleToString(string strIcalComp, vector < string > rrules, 00166 int flag); 00174 string getIcalAlarm(CAlarm * cAlarm); 00181 void deleteWhiteSpaces(string &szSpaceString ); 00192 vector<CRecurrenceRule*> getRecurrence(string strIcalComp, icalcomponent* pComp, icalproperty_kind kind,FileType iFType); 00193 00204 CRecurrenceRule* getRecurrenceRule(string strIcalComp, int index, string strRuleType,FileType iFType); 00205 00215 vector<string> getRecurrenceDates(string strIcalComp, icalcomponent *pComp, icalproperty_kind kind); 00216 00217 00218 00227 CAlarm* getAlarm(string strIcalComp, icalcomponent *pComp); 00228 00229 00236 struct tm initTime(icaltimetype time_ical); 00237 00246 string get_line(string strIcal, int start_loc); 00247 00255 string get_line_in_ical(string strInVcal, string strType, int index); 00256 00264 string getTranspFromIcal(icalproperty_transp iTransp); 00265 00272 COrganizer* getOrganizerFromIcal(icalproperty *pProp); 00273 00281 CAttendee* getAttendeeFromIcal(icalproperty *pProp,FileType iType); 00282 00290 int getParticipationRoleFromIcal(icalparameter_role icalRole); 00291 00299 int getParticipationStatusFromIcal(icalparameter_partstat icalPartStat); 00300 00308 bool getRSVPFromIcal(icalparameter_rsvp icalRSVP); 00309 00317 int getCUTypeFromIcal(icalparameter_cutype icalCUType); 00318 00326 string getClasFromIcal(icalproperty_class iClass); 00327 00334 icalproperty* getIcalOrganizer(COrganizer* pOrg); 00335 00342 string getContactFromIcal(icalproperty* pProp); 00343 00351 icalparameter_rsvp getIcalRSVP(bool fRSVP); 00352 00360 icalparameter_partstat getIcalPartStatus(ParticipantStatus iPartStat); 00361 00369 icalparameter_role getIcalPartRole(ParticipantRole iRole); 00370 00378 icalparameter_cutype getIcalCalendarUserType(CalendarUserType iCUType); 00379 00387 icalproperty* getIcalAttendee(CAttendee* pAtten,FileType iType); 00388 00395 CProperties* getXProperty(icalproperty *pProp); 00396 00403 CParameters* getParameters(icalparameter *pParam); 00404 00411 vector <CParameters*> getRelationshipParamFromICal(icalparameter* pParam); 00412 00419 int getStatusFromIcal(icalproperty_status icalStatus); 00420 00427 CParameters* getLanguageFromIcal(icalparameter* pParam); 00428 00435 CParameters* getAlterFromIcal(icalparameter* pParam); 00436 00443 vector < CParameters* > getLangAlterParam(icalproperty* pProp); 00444 00452 int getIcalStatus(statusParam iStatus); 00460 icalparameter_reltype getIcalRelType(RelationshipType iRel); 00467 CParameters* getFMTypeFromIcal(icalparameter* pParam); 00473 icalparameter* getTZIDParam(); 00474 00475 }; 00476 #endif