KCal Library
vobject.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 00078 #ifndef __VOBJECT_H__ 00079 #define __VOBJECT_H__ 1 00080 00081 00082 #include "port.h" 00083 #include <stdlib.h> 00084 #include <stdio.h> 00085 00086 #if defined(__CPLUSPLUS__) || defined(__cplusplus) 00087 extern "C" { 00088 #endif 00089 00090 00091 #define VC7bitProp "7BIT" 00092 #define VC8bitProp "8BIT" 00093 #define VCAAlarmProp "AALARM" 00094 #define VCAdditionalNamesProp "ADDN" 00095 #define VCAdrProp "ADR" 00096 #define VCAgentProp "AGENT" 00097 #define VCAIFFProp "AIFF" 00098 #define VCAOLProp "AOL" 00099 #define VCAppleLinkProp "APPLELINK" 00100 #define VCAttachProp "ATTACH" 00101 #define VCAttendeeProp "ATTENDEE" 00102 #define VCATTMailProp "ATTMAIL" 00103 #define VCAudioContentProp "AUDIOCONTENT" 00104 #define VCAVIProp "AVI" 00105 #define VCBase64Prop "BASE64" 00106 #define VCBBSProp "BBS" 00107 #define VCBirthDateProp "BDAY" 00108 #define VCBMPProp "BMP" 00109 #define VCBodyProp "BODY" 00110 #define VCBusinessRoleProp "ROLE" 00111 #define VCCalProp "VCALENDAR" 00112 #define VCCaptionProp "CAP" 00113 #define VCCardProp "VCARD" 00114 #define VCCarProp "CAR" 00115 #define VCCategoriesProp "CATEGORIES" 00116 #define VCCellularProp "CELL" 00117 #define VCCGMProp "CGM" 00118 #define VCCharSetProp "CS" 00119 #define VCCIDProp "CID" 00120 #define VCCISProp "CIS" 00121 #define VCCityProp "L" 00122 #define VCClassProp "CLASS" 00123 #define VCCommentProp "NOTE" 00124 #define VCCompletedProp "COMPLETED" 00125 #define VCContentIDProp "CONTENT-ID" 00126 #define VCCountryNameProp "C" 00127 #define VCDAlarmProp "DALARM" 00128 #define VCDataSizeProp "DATASIZE" 00129 #define VCDayLightProp "DAYLIGHT" 00130 #define VCDCreatedProp "DCREATED" 00131 #define VCDeliveryLabelProp "LABEL" 00132 #define VCDescriptionProp "DESCRIPTION" 00133 #define VCDIBProp "DIB" 00134 #define VCDisplayStringProp "DISPLAYSTRING" 00135 #define VCDomesticProp "DOM" 00136 #define VCDTendProp "DTEND" 00137 #define VCDTstartProp "DTSTART" 00138 #define VCDueProp "DUE" 00139 #define VCEmailAddressProp "EMAIL" 00140 #define VCEncodingProp "ENCODING" 00141 #define VCEndProp "END" 00142 #define VCEventProp "VEVENT" 00143 #define VCEWorldProp "EWORLD" 00144 #define VCExNumProp "EXNUM" 00145 #define VCExpDateProp "EXDATE" 00146 #define VCExpectProp "EXPECT" 00147 #define VCExtAddressProp "EXT ADD" 00148 #define VCFamilyNameProp "F" 00149 #define VCFaxProp "FAX" 00150 #define VCFullNameProp "FN" 00151 #define VCGeoProp "GEO" 00152 #define VCGeoLocationProp "GEO" 00153 #define VCGIFProp "GIF" 00154 #define VCGivenNameProp "G" 00155 #define VCGroupingProp "Grouping" 00156 #define VCHomeProp "HOME" 00157 #define VCIBMMailProp "IBMMail" 00158 #define VCInlineProp "INLINE" 00159 #define VCInternationalProp "INTL" 00160 #define VCInternetProp "INTERNET" 00161 #define VCISDNProp "ISDN" 00162 #define VCJPEGProp "JPEG" 00163 #define VCLanguageProp "LANG" 00164 #define VCLastModifiedProp "LAST-MODIFIED" 00165 #define VCLastRevisedProp "REV" 00166 #define VCLocationProp "LOCATION" 00167 #define VCLogoProp "LOGO" 00168 #define VCMailerProp "MAILER" 00169 #define VCMAlarmProp "MALARM" 00170 #define VCMCIMailProp "MCIMAIL" 00171 #define VCMessageProp "MSG" 00172 #define VCMETProp "MET" 00173 #define VCModemProp "MODEM" 00174 #define VCMPEG2Prop "MPEG2" 00175 #define VCMPEGProp "MPEG" 00176 #define VCMSNProp "MSN" 00177 #define VCNamePrefixesProp "NPRE" 00178 #define VCNameProp "N" 00179 #define VCNameSuffixesProp "NSUF" 00180 #define VCNoteProp "NOTE" 00181 #define VCOrgNameProp "ORGNAME" 00182 #define VCOrgProp "ORG" 00183 #define VCOrgUnit2Prop "OUN2" 00184 #define VCOrgUnit3Prop "OUN3" 00185 #define VCOrgUnit4Prop "OUN4" 00186 #define VCOrgUnitProp "OUN" 00187 #define VCPagerProp "PAGER" 00188 #define VCPAlarmProp "PALARM" 00189 #define VCParcelProp "PARCEL" 00190 #define VCPartProp "PART" 00191 #define VCPCMProp "PCM" 00192 #define VCPDFProp "PDF" 00193 #define VCPGPProp "PGP" 00194 #define VCPhotoProp "PHOTO" 00195 #define VCPICTProp "PICT" 00196 #define VCPMBProp "PMB" 00197 #define VCPostalBoxProp "BOX" 00198 #define VCPostalCodeProp "PC" 00199 #define VCPostalProp "POSTAL" 00200 #define VCPowerShareProp "POWERSHARE" 00201 #define VCPreferredProp "PREF" 00202 #define VCPriorityProp "PRIORITY" 00203 #define VCProcedureNameProp "PROCEDURENAME" 00204 #define VCProdIdProp "PRODID" 00205 #define VCProdigyProp "PRODIGY" 00206 #define VCPronunciationProp "SOUND" 00207 #define VCPSProp "PS" 00208 #define VCPublicKeyProp "KEY" 00209 #define VCQPProp "QP" 00210 #define VCQuickTimeProp "QTIME" 00211 #define VCQuotedPrintableProp "QUOTED-PRINTABLE" 00212 #define VCRDateProp "RDATE" 00213 #define VCRegionProp "R" 00214 #define VCRelatedToProp "RELATED-TO" 00215 #define VCRepeatCountProp "REPEATCOUNT" 00216 #define VCResourcesProp "RESOURCES" 00217 #define VCRNumProp "RNUM" 00218 #define VCRoleProp "ROLE" 00219 #define VCRRuleProp "RRULE" 00220 #define VCRSVPProp "RSVP" 00221 #define VCRunTimeProp "RUNTIME" 00222 #define VCSequenceProp "SEQUENCE" 00223 #define VCSnoozeTimeProp "SNOOZETIME" 00224 #define VCStartProp "START" 00225 #define VCStatusProp "STATUS" 00226 #define VCStreetAddressProp "STREET" 00227 #define VCSubTypeProp "SUBTYPE" 00228 #define VCSummaryProp "SUMMARY" 00229 #define VCTelephoneProp "TEL" 00230 #define VCTIFFProp "TIFF" 00231 #define VCTimeZoneProp "TZ" 00232 #define VCTitleProp "TITLE" 00233 #define VCTLXProp "TLX" 00234 #define VCTodoProp "VTODO" 00235 #define VCTranspProp "TRANSP" 00236 #define VCUniqueStringProp "UID" 00237 #define VCURLProp "URL" 00238 #define VCURLValueProp "URLVAL" 00239 #define VCValueProp "VALUE" 00240 #define VCVersionProp "VERSION" 00241 #define VCVideoProp "VIDEO" 00242 #define VCVoiceProp "VOICE" 00243 #define VCWAVEProp "WAVE" 00244 #define VCWMFProp "WMF" 00245 #define VCWorkProp "WORK" 00246 #define VCX400Prop "X400" 00247 #define VCX509Prop "X509" 00248 #define VCXRuleProp "XRULE" 00249 00250 /* extensions for KOrganizer / KPilot */ 00251 #define KPilotIdProp "X-PILOTID" 00252 #define KPilotStatusProp "X-PILOTSTAT" 00253 00254 /* extensions for iMIP / iTIP */ 00255 #define ICOrganizerProp "X-ORGANIZER" 00256 #define ICMethodProp "X-METHOD" 00257 #define ICRequestStatusProp "X-REQUEST-STATUS" 00258 00259 typedef struct VObject VObject; 00260 00261 typedef union ValueItem { 00262 const char *strs; 00263 const wchar_t *ustrs; 00264 unsigned int i; 00265 unsigned long l; 00266 void *any; 00267 VObject *vobj; 00268 } ValueItem; 00269 00270 struct VObject { 00271 VObject *next; 00272 const char *id; 00273 VObject *prop; 00274 unsigned short valType; 00275 ValueItem val; 00276 }; 00277 00278 typedef struct StrItem StrItem; 00279 00280 struct StrItem { 00281 StrItem *next; 00282 const char *s; 00283 unsigned int refCnt; 00284 }; 00285 00286 typedef struct VObjectIterator { 00287 VObject* start; 00288 VObject* next; 00289 } VObjectIterator; 00290 00291 extern VObject* newVObject(const char *id); 00292 extern void deleteVObject(VObject *p); 00293 extern char* dupStr(const char *s, unsigned int size); 00294 extern void deleteStr(const char *p); 00295 extern void unUseStr(const char *s); 00296 00297 extern void setVObjectName(VObject *o, const char* id); 00298 extern void setVObjectStringZValue(VObject *o, const char *s); 00299 extern void setVObjectStringZValue_(VObject *o, const char *s); 00300 extern void setVObjectUStringZValue(VObject *o, const wchar_t *s); 00301 extern void setVObjectUStringZValue_(VObject *o, const wchar_t *s); 00302 extern void setVObjectIntegerValue(VObject *o, unsigned int i); 00303 extern void setVObjectLongValue(VObject *o, unsigned long l); 00304 extern void setVObjectAnyValue(VObject *o, void *t); 00305 extern VObject* setValueWithSize(VObject *prop, void *val, unsigned int size); 00306 extern VObject* setValueWithSize_(VObject *prop, void *val, unsigned int size); 00307 00308 extern const char* vObjectName(VObject *o); 00309 extern const char* vObjectStringZValue(VObject *o); 00310 extern const wchar_t* vObjectUStringZValue(VObject *o); 00311 extern unsigned int vObjectIntegerValue(VObject *o); 00312 extern unsigned long vObjectLongValue(VObject *o); 00313 extern void* vObjectAnyValue(VObject *o); 00314 extern VObject* vObjectVObjectValue(VObject *o); 00315 extern void setVObjectVObjectValue(VObject *o, VObject *p); 00316 00317 extern VObject* addVObjectProp(VObject *o, VObject *p); 00318 extern VObject* addProp(VObject *o, const char *id); 00319 extern VObject* addProp_(VObject *o, const char *id); 00320 extern VObject* addPropValue(VObject *o, const char *p, const char *v); 00321 extern VObject* addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size); 00322 extern VObject* addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size); 00323 extern VObject* addGroup(VObject *o, const char *g); 00324 extern void addList(VObject **o, VObject *p); 00325 00326 extern VObject* isAPropertyOf(VObject *o, const char *id); 00327 00328 extern VObject* nextVObjectInList(VObject *o); 00329 extern void initPropIterator(VObjectIterator *i, VObject *o); 00330 extern int moreIteration(VObjectIterator *i); 00331 extern VObject* nextVObject(VObjectIterator *i); 00332 00333 extern char* writeMemVObject(char *s, int *len, VObject *o); 00334 extern char* writeMemVObjects(char *s, int *len, VObject *list); 00335 00336 extern const char* lookupStr(const char *s); 00337 extern void cleanStrTbl(); 00338 00339 extern void cleanVObject(VObject *o); 00340 extern void cleanVObjects(VObject *list); 00341 00342 extern const char* lookupProp(const char* str); 00343 extern const char* lookupProp_(const char* str); 00344 00345 extern wchar_t* fakeUnicode(const char *ps, int *bytes); 00346 extern unsigned int uStrLen(const wchar_t *u); 00347 extern char* fakeCString(const wchar_t *u); 00348 00349 extern void printVObjectToFile(char *fname,VObject *o); 00350 extern void printVObjectsToFile(char *fname,VObject *list); 00351 extern void writeVObjectToFile(char *fname, VObject *o); 00352 extern void writeVObjectsToFile(char *fname, VObject *list); 00353 00354 extern int vObjectValueType(VObject *o); 00355 00356 /* return type of vObjectValueType: */ 00357 #define VCVT_NOVALUE 0 00358 /* if the VObject has no value associated with it. */ 00359 #define VCVT_STRINGZ 1 00360 /* if the VObject has value set by setVObjectStringZValue. */ 00361 #define VCVT_USTRINGZ 2 00362 /* if the VObject has value set by setVObjectUStringZValue. */ 00363 #define VCVT_UINT 3 00364 /* if the VObject has value set by setVObjectIntegerValue. */ 00365 #define VCVT_ULONG 4 00366 /* if the VObject has value set by setVObjectLongValue. */ 00367 #define VCVT_RAW 5 00368 /* if the VObject has value set by setVObjectAnyValue. */ 00369 #define VCVT_VOBJECT 6 00370 /* if the VObject has value set by setVObjectVObjectValue. */ 00371 00372 extern const char** fieldedProp; 00373 00374 extern void printVObject(FILE *fp,VObject *o); 00375 extern void writeVObject(FILE *fp, VObject *o); 00376 00377 00378 #if defined(__CPLUSPLUS__) || defined(__cplusplus) 00379 } 00380 #endif 00381 00382 #endif /* __VOBJECT_H__ */ 00383 00384
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Aug 27 2012 22:10:05 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Aug 27 2012 22:10:05 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.