00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __VCALCONVERTER_H__
00019 #define __VCALCONVERTER_H__
00020
00021 #include "Common.h"
00022 #include "ICalConverter.h"
00023 #include <vector>
00024 #include <string>
00025 using namespace std;
00026 extern "C" {
00027 #include <libical/ical.h>
00028 #include <libical/icalcomponent.h>
00029 #include <libical/icalenums.h>
00030 #include "stdlib.h"
00031 #include "stdio.h"
00032 }
00033
00034 using std::string;
00040 class VCalConverter
00041 {
00042 public:
00046 VCalConverter();
00050 ~VCalConverter();
00051
00058 FileType checkContentsType(string szContents);
00059
00067 string vCalToICalRule(string vcal);
00068
00076 string iCalToVCalRule(string ical, time_t startTime);
00077
00085 string vCalToICalDate(string vcal);
00086
00094 string iCalToVCalDate(string ical);
00102 string vCalToICalAlarm(string vCalAlarm);
00110 string iCalToVCalAlarm(string iCalAlarm);
00117 vector<string> getTokens(string str, string delimiter);
00118
00126 string getTranspFromVcal(string szContents);
00127
00135 icaltimetype getCreatedTimeFromVcal(string szContents);
00136
00144 int getStatusFromVcal(string szContents);
00152 icalproperty* getVcalTransp(string szTransp);
00160 string getVcalStatus(statusParam iStatus);
00168 int getParticipationRoleFromVcal(string szAtten);
00176 string getVcalPartRole(int iRole);
00185 string getVcalCreatedTime(string szTime,string szContents);
00193 icalparameter* getVcalRSVP(bool fRSVP);
00201 bool getRSVPFromVcal(string szContents);
00202
00203 private:
00213 void Tokenize(const string & str,
00214 vector <string> &tokens,
00215 string delimiters = " ");
00224 string getNoDelimiterString(string str, string delimiters, string repStr);
00225
00231 void initRecurrenceItem(RecurrenceItem* item);
00232
00240 int getDay(string vcal, bool opFlag);
00241
00248 string getByMonthFromVcal(string vcal);
00249
00256 string getByDayFromVcal(string vcal);
00257
00264 string getDurationFromVcal(string vcal);
00265
00273 string getFrequency(vector<string> tokens, int index);
00274
00282 string getInterval(vector<string> tokens, int index);
00283
00291 string getCount(vector<string> tokens, int index);
00292
00300 string getUntil(vector<string> tokens, int index);
00301
00309 string getByDayFromIcal(vector<string> tokens, int index);
00310
00318 string getByMonthFromIcal(vector<string> tokens, int index);
00319
00326 time_t tzStringTogmtime(string strIcalComp);
00327
00335 string gmttimeToTZString(time_t tTime, bool onlyDate);
00336
00344 string getVCalDate(vector<string> tokens, int index, int type);
00345
00352 string getAudioAlarm(string alarm);
00353 };
00354 #endif