Qtopia library API Documentation

vobject_p.h

00001 /***************************************************************************
00002 (C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
00003 Business Machines Corporation and Siemens Rolm Communications Inc.
00004 
00005 For purposes of this license notice, the term Licensors shall mean,
00006 collectively, Apple Computer, Inc., AT&T Corp., International
00007 Business Machines Corporation and Siemens Rolm Communications Inc.
00008 The term Licensor shall mean any of the Licensors.
00009 
00010 Subject to acceptance of the following conditions, permission is hereby
00011 granted by Licensors without the need for written agreement and without
00012 license or royalty fees, to use, copy, modify and distribute this
00013 software for any purpose.
00014 
00015 The above copyright notice and the following four paragraphs must be
00016 reproduced in all copies of this software and any software including
00017 this software.
00018 
00019 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
00020 ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
00021 MODIFICATIONS.
00022 
00023 IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
00024 INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
00025 OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00026 DAMAGE.
00027 
00028 EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
00029 INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00031 PURPOSE.
00032 
00033 The software is provided with RESTRICTED RIGHTS.  Use, duplication, or
00034 disclosure by the government are subject to restrictions set forth in
00035 DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
00036 
00037 ***************************************************************************/
00038 
00039 /*
00040 
00041 The vCard/vCalendar C interface is implemented in the set
00042 of files as follows:
00043 
00044 vcc.y, yacc source, and vcc.c, the yacc output you will use
00045 implements the core parser
00046 
00047 vobject.c implements an API that insulates the caller from
00048 the parser and changes in the vCard/vCalendar BNF
00049 
00050 port.h defines compilation environment dependent stuff
00051 
00052 vcc.h and vobject.h are header files for their .c counterparts
00053 
00054 vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions
00055 which you may find useful.
00056 
00057 test.c is a standalone test driver that exercises some of
00058 the features of the APIs provided. Invoke test.exe on a
00059 VCARD/VCALENDAR input text file and you will see the pretty
00060 print output of the internal representation (this pretty print
00061 output should give you a good idea of how the internal
00062 representation looks like -- there is one such output in the
00063 following too). Also, a file with the .out suffix is generated
00064 to show that the internal representation can be written back
00065 in the original text format.
00066 
00067 For more information on this API see the readme.txt file
00068 which accompanied this distribution.
00069 
00070   Also visit:
00071 
00072         http://www.versit.com
00073         http://www.ralden.com
00074 
00075 */
00076 
00077 // No tr() anywhere in this file
00078 
00079 
00080 #ifndef __VOBJECT_H__
00081 #define __VOBJECT_H__ 1
00082 
00083 #include <qstring.h>
00084 
00085 #define vCardClipboardFormat        "+//ISBN 1-887687-00-9::versit::PDI//vCard"
00086 #define vCalendarClipboardFormat    "+//ISBN 1-887687-00-9::versit::PDI//vCalendar"
00087 
00088 /* The above strings vCardClipboardFormat and vCalendarClipboardFormat
00089 are globally unique IDs which can be used to generate clipboard format
00090 ID's as per the requirements of a specific platform. For example, in
00091 Windows they are used as the parameter in a call to RegisterClipboardFormat.
00092 For example:
00093 
00094   CLIPFORMAT foo = RegisterClipboardFormat(vCardClipboardFormat);
00095 
00096 */
00097 
00098 #define vCardMimeType       "text/x-vCard"
00099 #define vCalendarMimeType   "text/x-vCalendar"
00100 
00101 #undef DLLEXPORT
00102 #include <qtopia/global.h>
00103 #if defined(QTOPIA_MAKEDLL)
00104 #define DLLEXPORT(t)   __declspec(dllexport) t
00105 #elif defined(QTOPIA_DLL)
00106 #define DLLEXPORT(t)   __declspec(dllimport) t
00107 #else
00108 #define DLLEXPORT(t) t
00109 #endif
00110 
00111 #ifndef FALSE
00112 #define FALSE   0
00113 #endif
00114 #ifndef TRUE
00115 #define TRUE    1
00116 #endif
00117 
00118 #include <stdlib.h>
00119 #include <stdio.h>
00120 
00121 
00122 #define VC7bitProp              "7BIT"
00123 #define VC8bitProp              "8BIT"
00124 #define VCAAlarmProp            "AALARM"
00125 #define VCAdditionalNamesProp   "ADDN"
00126 #define VCAdrProp               "ADR"
00127 #define VCAgentProp             "AGENT"
00128 #define VCAIFFProp              "AIFF"
00129 #define VCAOLProp               "AOL"
00130 #define VCAppleLinkProp         "APPLELINK"
00131 #define VCAttachProp            "ATTACH"
00132 #define VCAttendeeProp          "ATTENDEE"
00133 #define VCATTMailProp           "ATTMAIL"
00134 #define VCAudioContentProp      "AUDIOCONTENT"
00135 #define VCAVIProp               "AVI"
00136 #define VCBase64Prop            "BASE64"
00137 #define VCBBSProp               "BBS"
00138 #define VCBirthDateProp         "BDAY"
00139 #define VCBMPProp               "BMP"
00140 #define VCBodyProp              "BODY"
00141 #define VCBusinessRoleProp      "ROLE"
00142 #define VCCalProp               "VCALENDAR"
00143 #define VCCaptionProp           "CAP"
00144 #define VCCardProp              "VCARD"
00145 #define VCCarProp               "CAR"
00146 #define VCCategoriesProp        "CATEGORIES"
00147 #define VCCellularProp          "CELL"
00148 #define VCCGMProp               "CGM"
00149 #define VCCharSetProp           "CHARSET"
00150 #define VCCIDProp               "CID"
00151 #define VCCISProp               "CIS"
00152 #define VCCityProp              "L"
00153 #define VCClassProp             "CLASS"
00154 #define VCCommentProp           "NOTE"
00155 #define VCCompletedProp         "COMPLETED"
00156 #define VCContentIDProp         "CONTENT-ID"
00157 #define VCCountryNameProp       "C"
00158 #define VCDAlarmProp            "DALARM"
00159 #define VCDataSizeProp          "DATASIZE"
00160 #define VCDayLightProp          "DAYLIGHT"
00161 #define VCDCreatedProp          "DCREATED"
00162 #define VCDeliveryLabelProp     "LABEL"
00163 #define VCDescriptionProp       "DESCRIPTION"
00164 #define VCDIBProp               "DIB"
00165 #define VCDisplayStringProp     "DISPLAYSTRING"
00166 #define VCDomesticProp          "DOM"
00167 #define VCDTendProp             "DTEND"
00168 #define VCDTstartProp           "DTSTART"
00169 #define VCDueProp               "DUE"
00170 #define VCEmailAddressProp      "EMAIL"
00171 #define VCEncodingProp          "ENCODING"
00172 #define VCEndProp               "END"
00173 #define VCEventProp             "VEVENT"
00174 #define VCEWorldProp            "EWORLD"
00175 #define VCExNumProp             "EXNUM"
00176 #define VCExpDateProp           "EXDATE"
00177 #define VCExpectProp            "EXPECT"
00178 #define VCExtAddressProp        "EXT ADD"
00179 #define VCFamilyNameProp        "F"
00180 #define VCFaxProp               "FAX"
00181 #define VCFullNameProp          "FN"
00182 #define VCGeoProp               "GEO"
00183 #define VCGeoLocationProp       "GEO"
00184 #define VCGIFProp               "GIF"
00185 #define VCGivenNameProp         "G"
00186 #define VCGroupingProp          "Grouping"
00187 #define VCHomeProp              "HOME"
00188 #define VCIBMMailProp           "IBMMail"
00189 #define VCInlineProp            "INLINE"
00190 #define VCInternationalProp     "INTL"
00191 #define VCInternetProp          "INTERNET"
00192 #define VCISDNProp              "ISDN"
00193 #define VCJPEGProp              "JPEG"
00194 #define VCLanguageProp          "LANG"
00195 #define VCLastModifiedProp      "LAST-MODIFIED"
00196 #define VCLastRevisedProp       "REV"
00197 #define VCLocationProp          "LOCATION"
00198 #define VCLogoProp              "LOGO"
00199 #define VCMailerProp            "MAILER"
00200 #define VCMAlarmProp            "MALARM"
00201 #define VCMCIMailProp           "MCIMAIL"
00202 #define VCMessageProp           "MSG"
00203 #define VCMETProp               "MET"
00204 #define VCModemProp             "MODEM"
00205 #define VCMPEG2Prop             "MPEG2"
00206 #define VCMPEGProp              "MPEG"
00207 #define VCMSNProp               "MSN"
00208 #define VCNamePrefixesProp      "NPRE"
00209 #define VCNameProp              "N"
00210 #define VCNameSuffixesProp      "NSUF"
00211 #define VCNoteProp              "NOTE"
00212 #define VCOrgNameProp           "ORGNAME"
00213 #define VCOrgProp               "ORG"
00214 #define VCOrgUnit2Prop          "OUN2"
00215 #define VCOrgUnit3Prop          "OUN3"
00216 #define VCOrgUnit4Prop          "OUN4"
00217 #define VCOrgUnitProp           "OUN"
00218 #define VCPagerProp             "PAGER"
00219 #define VCPAlarmProp            "PALARM"
00220 #define VCParcelProp            "PARCEL"
00221 #define VCPartProp              "PART"
00222 #define VCPCMProp               "PCM"
00223 #define VCPDFProp               "PDF"
00224 #define VCPGPProp               "PGP"
00225 #define VCPhotoProp             "PHOTO"
00226 #define VCPICTProp              "PICT"
00227 #define VCPMBProp               "PMB"
00228 #define VCPostalBoxProp         "BOX"
00229 #define VCPostalCodeProp        "PC"
00230 #define VCPostalProp            "POSTAL"
00231 #define VCPowerShareProp        "POWERSHARE"
00232 #define VCPreferredProp         "PREF"
00233 #define VCPriorityProp          "PRIORITY"
00234 #define VCProcedureNameProp     "PROCEDURENAME"
00235 #define VCProdIdProp            "PRODID"
00236 #define VCProdigyProp           "PRODIGY"
00237 #define VCPronunciationProp     "SOUND"
00238 #define VCPSProp                "PS"
00239 #define VCPublicKeyProp         "KEY"
00240 #define VCQPProp                "QP"
00241 #define VCQuickTimeProp         "QTIME"
00242 #define VCQuotedPrintableProp   "QUOTED-PRINTABLE"
00243 #define VCRDateProp             "RDATE"
00244 #define VCRegionProp            "R"
00245 #define VCRelatedToProp         "RELATED-TO"
00246 #define VCRepeatCountProp       "REPEATCOUNT"
00247 #define VCResourcesProp         "RESOURCES"
00248 #define VCRNumProp              "RNUM"
00249 #define VCRoleProp              "ROLE"
00250 #define VCRRuleProp             "RRULE"
00251 #define VCRSVPProp              "RSVP"
00252 #define VCRunTimeProp           "RUNTIME"
00253 #define VCSequenceProp          "SEQUENCE"
00254 #define VCSnoozeTimeProp        "SNOOZETIME"
00255 #define VCStartProp             "START"
00256 #define VCStatusProp            "STATUS"
00257 #define VCStreetAddressProp     "STREET"
00258 #define VCSubTypeProp           "SUBTYPE"
00259 #define VCSummaryProp           "SUMMARY"
00260 #define VCTelephoneProp         "TEL"
00261 #define VCTIFFProp              "TIFF"
00262 #define VCTimeZoneProp          "TZ"
00263 #define VCTitleProp             "TITLE"
00264 #define VCTLXProp               "TLX"
00265 #define VCTodoProp              "VTODO"
00266 #define VCTranspProp            "TRANSP"
00267 #define VCUniqueStringProp      "UID"
00268 #define VCURLProp               "URL"
00269 #define VCURLValueProp          "URLVAL"
00270 #define VCValueProp             "VALUE"
00271 #define VCVersionProp           "VERSION"
00272 #define VCVideoProp             "VIDEO"
00273 #define VCVoiceProp             "VOICE"
00274 #define VCWAVEProp              "WAVE"
00275 #define VCWMFProp               "WMF"
00276 #define VCWorkProp              "WORK"
00277 #define VCX400Prop              "X400"
00278 #define VCX509Prop              "X509"
00279 #define VCXRuleProp             "XRULE"
00280 
00281 
00282 typedef struct VObject VObject;
00283 
00284 typedef struct VObjectIterator {
00285     VObject* start;
00286     VObject* next;
00287     } VObjectIterator;
00288 
00289 extern DLLEXPORT(VObject*) newVObject(const char *id);
00290 extern DLLEXPORT(void) deleteVObject(VObject *p);
00291 extern DLLEXPORT(char*) dupStr(const char *s, unsigned int size);
00292 extern DLLEXPORT(void) deleteStr(const char *p);
00293 extern DLLEXPORT(void) unUseStr(const char *s);
00294 
00295 extern DLLEXPORT(void) setVObjectName(VObject *o, const char* id);
00296 extern DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s);
00297 extern DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s);
00298 extern DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i);
00299 extern DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l);
00300 extern DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t);
00301 extern DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size);
00302 extern DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size);
00303 
00304 extern DLLEXPORT(const char*) vObjectName(VObject *o);
00305 extern DLLEXPORT(const char*) vObjectStringZValue(VObject *o);
00306 extern DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o);
00307 extern DLLEXPORT(unsigned long) vObjectLongValue(VObject *o);
00308 extern DLLEXPORT(void*) vObjectAnyValue(VObject *o);
00309 extern DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o);
00310 extern DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p);
00311 
00312 extern DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p);
00313 extern DLLEXPORT(VObject*) addProp(VObject *o, const char *id);
00314 extern DLLEXPORT(VObject*) addProp_(VObject *o, const char *id);
00315 extern DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v);
00316 extern DLLEXPORT(VObject*) addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size);
00317 extern DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size);
00318 extern DLLEXPORT(VObject*) addGroup(VObject *o, const char *g);
00319 extern DLLEXPORT(void) addList(VObject **o, VObject *p);
00320 
00321 extern DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id);
00322 
00323 extern DLLEXPORT(VObject*) nextVObjectInList(VObject *o);
00324 extern DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o);
00325 extern DLLEXPORT(int) moreIteration(VObjectIterator *i);
00326 extern DLLEXPORT(VObject*) nextVObject(VObjectIterator *i);
00327 
00328 extern DLLEXPORT(const char*) lookupStr(const char *s);
00329 extern DLLEXPORT(void) cleanStrTbl();
00330 
00331 extern DLLEXPORT(void) cleanVObject(VObject *o);
00332 extern DLLEXPORT(void) cleanVObjects(VObject *list);
00333 
00334 extern DLLEXPORT(const char*) lookupProp(const char* str);
00335 extern DLLEXPORT(const char*) lookupProp_(const char* str);
00336 
00337 extern DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o);
00338 extern DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list);
00339 
00340 extern DLLEXPORT(int) vObjectValueType(VObject *o);
00341 
00342 /* return type of vObjectValueType: */
00343 #define VCVT_NOVALUE    0
00344     /* if the VObject has no value associated with it. */
00345 #define VCVT_STRINGZ    1
00346     /* if the VObject has value set by setVObjectStringZValue. */
00347 #define VCVT_UINT       2
00348     /* if the VObject has value set by setVObjectIntegerValue. */
00349 #define VCVT_ULONG          3
00350     /* if the VObject has value set by setVObjectLongValue. */
00351 #define VCVT_RAW        4
00352     /* if the VObject has value set by setVObjectAnyValue. */
00353 #define VCVT_VOBJECT    5
00354     /* if the VObject has value set by setVObjectVObjectValue. */
00355 
00356 extern  DLLEXPORT(const char**) fieldedProp;
00357 
00358 /***************************************************
00359  * The methods below are implemented in vcc.c (generated from vcc.y )
00360  ***************************************************/
00361 
00362 /* NOTE regarding printVObject and writeVObject
00363 
00364 The functions below are not exported from the DLL because they
00365 take a FILE* as a parameter, which cannot be passed across a DLL
00366 interface (at least that is my experience). Instead you can use
00367 their companion functions which take file names or pointers
00368 to memory. However, if you are linking this code into
00369 your build directly then you may find them a more convenient API
00370 and you can go ahead and use them. If you try to use them with
00371 the DLL LIB you will get a link error.
00372 */
00373 extern DLLEXPORT(void) writeVObject(FILE *fp, VObject *o);
00374 
00375 
00376 
00377 typedef void (*MimeErrorHandler)(char *);
00378 
00379 extern DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler);
00380 
00381 extern DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len);
00382 extern DLLEXPORT(VObject*) Parse_MIME_FromFileName(char* fname);
00383 
00384 
00385 /* NOTE regarding Parse_MIME_FromFile
00386 The function above, Parse_MIME_FromFile, comes in two flavors,
00387 neither of which is exported from the DLL. Each version takes
00388 a CFile or FILE* as a parameter, neither of which can be
00389 passed across a DLL interface (at least that is my experience).
00390 If you are linking this code into your build directly then
00391 you may find them a more convenient API that the other flavors
00392 that take a file name. If you use them with the DLL LIB you
00393 will get a link error.
00394 */
00395 
00396 
00397 #if INCLUDEMFC
00398 extern DLLEXPORT(VObject*) Parse_MIME_FromFile(CFile *file);
00399 #else
00400 extern DLLEXPORT(VObject*) Parse_MIME_FromFile(FILE *file);
00401 #endif
00402 
00403 extern DLLEXPORT(const char *) vObjectTypeInfo(VObject *o);
00404 
00405 
00406 #endif /* __VOBJECT_H__ */
00407 
00408 
KDE Logo
This file is part of the documentation for OPIE Version 1.5.5.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:24:08 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001