src/include/common/vocl/iCalendar/iCalConverter.h

00001 /*
00002  * Funambol is a mobile platform developed by Funambol, Inc. 
00003  * Copyright (C) 2003 - 2007 Funambol, Inc.
00004  * 
00005  * This program is free software; you can redistribute it and/or modify it under
00006  * the terms of the GNU Affero General Public License version 3 as published by
00007  * the Free Software Foundation with the addition of the following permission 
00008  * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
00009  * WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE 
00010  * WARRANTY OF NON INFRINGEMENT  OF THIRD PARTY RIGHTS.
00011  * 
00012  * This program is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00014  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00015  * details.
00016  * 
00017  * You should have received a copy of the GNU Affero General Public License 
00018  * along with this program; if not, see http://www.gnu.org/licenses or write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00020  * MA 02110-1301 USA.
00021  * 
00022  * You can contact Funambol, Inc. headquarters at 643 Bair Island Road, Suite 
00023  * 305, Redwood City, CA 94063, USA, or at email address info@funambol.com.
00024  * 
00025  * The interactive user interfaces in modified source and object code versions
00026  * of this program must display Appropriate Legal Notices, as required under
00027  * Section 5 of the GNU Affero General Public License version 3.
00028  * 
00029  * In accordance with Section 7(b) of the GNU Affero General Public License
00030  * version 3, these Appropriate Legal Notices must retain the display of the
00031  * "Powered by Funambol" logo. If the display of the logo is not reasonably 
00032  * feasible for technical reasons, the Appropriate Legal Notices must display
00033  * the words "Powered by Funambol".
00034  */
00035 
00036 
00037 #ifndef INCL_VIRTUAL_CALENDAR_CONVERTER
00038 #define INCL_VIRTUAL_CALENDAR_CONVERTER
00039 
00041 #include "base/fscapi.h"
00042 #include "vocl/iCalendar/Calendar.h"
00043 #include "vocl/VConverter.h"
00044 #include "base/globalsdef.h"
00045 
00046 BEGIN_NAMESPACE
00047 
00048 class WString;
00049 
00050 #define EVENT_PROPERTIES_LIST TEXT("BEGIN,CLASS,CREATED,DESCRIPTION,DTSTART,GEO,LAST-MODIFIED,LOCATION,ORGANIZER,PRIORITY,") \
00051                                    TEXT("DTSTAMP,SEQUENCE,STATUS,SUMMARY,TRANSP,UID,URL,RECURRENCE-ID,DTEND,DURATION,ATTACH,ATTENDEE,") \
00052                                    TEXT("CATEGORIES,COMMENT,CONTACT,EXDATE,EXRULE,REQUEST-STATUS,RELATED,RESOURCES,RDATE,RRULE,END,GROUP")
00053 
00054 #define TODO_PROPERTIES_LIST  TEXT("BEGIN,CLASS,COMPLETED,CREATED,DESCRIPTION,DTSTAMP,DTSTART,GEO,LAST-MODIFIED,LOCATION,ORGANIZER,PERCENT-COMPLETE,") \
00055                                    TEXT("PRIORITY,RECURRENCE-ID,SEQUENCE,STATUS,SUMMARY,UID,URL,DUE,DURATION,ATTACH,ATTENDEE,") \
00056                                    TEXT("CATEGORIES,COMMENT,CONTACT,EXDATE,EXRULE,REQUEST-STATUS,RELATED,RESOURCES,RDATE,RRULE,END,GROUP")
00057 
00058 #define CLASS_PROPERTY_VALUE  TEXT("PUBLIC,PRIVATE,CONFIDENTIAL")
00059 
00060 #define COMMENT_PARAM_LIST      TEXT("ALTREP,LANGUAGE")
00061 #define DT_PARAM_LIST           TEXT("VALUE,TZID")
00062 #define ORGANIZER_PARAM_LIST    TEXT("CN,DIR,SENT-BY,LANGUAGE,ROLE")
00063 #define ATTACH_PARAM_LIST       TEXT("FMTTYPE,ENCODING,VALUE")
00064 #define ATTENDEE_PARAM_LIST     TEXT("CUTYPE,MEMBER,ROLE,PARTSTAT,RSVP,DELEGATED-TO,DELEGATED-FROM,SENT-BY,CN,DIR,LANGUAGE")
00065 #define RDATE_PARAM_LIST        TEXT("VALUE,DATE-TIME,DATE,PERIOD,TZID")
00066 #define RECRUL_ITEMS_LIST       TEXT("FREQ,UNTIL,COUNT,INTERVAL,BYSECOND,BYMINUTE,BYHOUR,BYDAY,BYMONTHDAY,BYYEARDAY,BYWEEKNO,BYMONTH,BYSETPOS,WKST")
00067 #define FREQUENCY_VALUES_LIST   TEXT("SECONDLY,MINUTELY,HOURLY,DAILY,WEEKLY,MONTHLY,YEARLY")
00068 
00069 #define ERROR_SUCCESS                0L
00070 #define ERROR_KEY_PROPERTY_MISSING   100L
00071 #define ERROR_ILLEGAL_VERSION_NUMBER 101L
00072 #define ERROR_ILLEGAL_PROPERTY_NAME  102L
00073 #define ERROR_UNSUPPORTED_ENCODING   103L
00074 #define ERROR_ILLEGAL_TYPE_PARAMETER 104L
00075 #define ERROR_ILLEGAL_PARAMETER      105L
00076 #define ERROR_INVALID_PROPERTY_VALUE 106L
00077 #define ERROR_PARSING_ERROR          200L
00078 #define ERROR_INVALID_EVENT_BLOCK    301L
00079 #define ERROR_INVALID_TODO_BLOCK     302L
00080 
00081 //#define isdigit(c) ((c) >= '0' && (c)<= '9') FIXME
00082 
00083 
00084 class iCalConverter {
00085 private:
00086     WCHAR* iCalendar;
00087     Calendar* calendar;
00088     bool validateEvent(Event*, WString& error, long* errorCode);
00089     bool validateTodo(ToDo*, WString& error, long* errorCode);
00090     bool validatePropery(VProperty*, WString& error, long* errorCode);
00091     Event* extractEvent(VObject* vo, WString& errorDescription, long* errorCode);
00092     ToDo* extractTask(VObject* vo, WString& errorDescription, long* errorCode);
00093     bool validateGeo(WCHAR* geo);
00094     bool validateDT(WCHAR* dt);
00095     bool validateDate(WCHAR* date);
00096     bool validateRecur(WCHAR* recur);
00097     void extractAlarm(VObject* vo);
00098 
00099 public:
00100     iCalConverter();
00101     ~iCalConverter();
00102     void setSource(WCHAR* inputICalendar);
00103     void setSource(Calendar& inputCalendar);
00104     void getICalendar(WCHAR* vCard);
00105     void getCalendar(Calendar** outputContact);
00106     bool convert(WString& error, long* errorCode);
00107 };
00108 
00109 END_NAMESPACE
00110 
00112 #endif

Generated on Fri Jul 25 15:04:15 2008 for Funambol C++ Client Library by  doxygen 1.5.1