summaryrefslogtreecommitdiffabout
path: root/libkcal/versit/vobject.h
authorzautrix <zautrix>2004-06-26 19:01:18 (UTC)
committer zautrix <zautrix>2004-06-26 19:01:18 (UTC)
commitb9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff)
tree2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /libkcal/versit/vobject.h
downloadkdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2
Initial revision
Diffstat (limited to 'libkcal/versit/vobject.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/versit/vobject.h384
1 files changed, 384 insertions, 0 deletions
diff --git a/libkcal/versit/vobject.h b/libkcal/versit/vobject.h
new file mode 100644
index 0000000..0ec8b31
--- a/dev/null
+++ b/libkcal/versit/vobject.h
@@ -0,0 +1,384 @@
1/***************************************************************************
2(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
3Business Machines Corporation and Siemens Rolm Communications Inc.
4
5For purposes of this license notice, the term Licensors shall mean,
6collectively, Apple Computer, Inc., AT&T Corp., International
7Business Machines Corporation and Siemens Rolm Communications Inc.
8The term Licensor shall mean any of the Licensors.
9
10Subject to acceptance of the following conditions, permission is hereby
11granted by Licensors without the need for written agreement and without
12license or royalty fees, to use, copy, modify and distribute this
13software for any purpose.
14
15The above copyright notice and the following four paragraphs must be
16reproduced in all copies of this software and any software including
17this software.
18
19THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
20ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
21MODIFICATIONS.
22
23IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
24INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
25OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
26DAMAGE.
27
28EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
29INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
30IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31PURPOSE.
32
33The software is provided with RESTRICTED RIGHTS. Use, duplication, or
34disclosure by the government are subject to restrictions set forth in
35DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
36
37***************************************************************************/
38
39/*
40
41The vCard/vCalendar C interface is implemented in the set
42of files as follows:
43
44vcc.y, yacc source, and vcc.c, the yacc output you will use
45implements the core parser
46
47vobject.c implements an API that insulates the caller from
48the parser and changes in the vCard/vCalendar BNF
49
50port.h defines compilation environment dependent stuff
51
52vcc.h and vobject.h are header files for their .c counterparts
53
54vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions
55which you may find useful.
56
57test.c is a standalone test driver that exercises some of
58the features of the APIs provided. Invoke test.exe on a
59VCARD/VCALENDAR input text file and you will see the pretty
60print output of the internal representation (this pretty print
61output should give you a good idea of how the internal
62representation looks like -- there is one such output in the
63following too). Also, a file with the .out suffix is generated
64to show that the internal representation can be written back
65in the original text format.
66
67For more information on this API see the readme.txt file
68which accompanied this distribution.
69
70 Also visit:
71
72 http://www.versit.com
73 http://www.ralden.com
74
75*/
76
77
78#ifndef __VOBJECT_H__
79#define __VOBJECT_H__ 1
80
81
82#include "port.h"
83#include <stdlib.h>
84#include <stdio.h>
85
86#if defined(__CPLUSPLUS__) || defined(__cplusplus)
87extern "C" {
88#endif
89
90
91 #define VC7bitProp "7BIT"
92 #define VC8bitProp "8BIT"
93 #define VCAAlarmProp "AALARM"
94 #define VCAdditionalNamesProp"ADDN"
95 #define VCAdrProp "ADR"
96 #define VCAgentProp "AGENT"
97 #define VCAIFFProp "AIFF"
98 #define VCAOLProp "AOL"
99 #define VCAppleLinkProp "APPLELINK"
100 #define VCAttachProp "ATTACH"
101 #define VCAttendeeProp "ATTENDEE"
102 #define VCATTMailProp "ATTMAIL"
103 #define VCAudioContentProp "AUDIOCONTENT"
104 #define VCAVIProp "AVI"
105 #define VCBase64Prop "BASE64"
106 #define VCBBSProp "BBS"
107 #define VCBirthDateProp "BDAY"
108 #define VCBMPProp "BMP"
109 #define VCBodyProp "BODY"
110 #define VCBusinessRoleProp "ROLE"
111 #define VCCalProp "VCALENDAR"
112 #define VCCaptionProp "CAP"
113 #define VCCardProp "VCARD"
114 #define VCCarProp "CAR"
115 #define VCCategoriesProp "CATEGORIES"
116 #define VCCellularProp "CELL"
117 #define VCCGMProp "CGM"
118 #define VCCharSetProp "CS"
119 #define VCCIDProp "CID"
120 #define VCCISProp "CIS"
121 #define VCCityProp "L"
122 #define VCClassProp "CLASS"
123 #define VCCommentProp "NOTE"
124 #define VCCompletedProp "COMPLETED"
125 #define VCContentIDProp "CONTENT-ID"
126 #define VCCountryNameProp "C"
127 #define VCDAlarmProp "DALARM"
128 #define VCDataSizeProp "DATASIZE"
129 #define VCDayLightProp "DAYLIGHT"
130 #define VCDCreatedProp "DCREATED"
131#define VCDeliveryLabelProp "LABEL"
132 #define VCDescriptionProp "DESCRIPTION"
133 #define VCDIBProp "DIB"
134 #define VCDisplayStringProp "DISPLAYSTRING"
135 #define VCDomesticProp "DOM"
136 #define VCDTendProp "DTEND"
137 #define VCDTstartProp "DTSTART"
138 #define VCDueProp "DUE"
139 #define VCEmailAddressProp "EMAIL"
140 #define VCEncodingProp "ENCODING"
141 #define VCEndProp "END"
142 #define VCEventProp "VEVENT"
143 #define VCEWorldProp "EWORLD"
144 #define VCExNumProp "EXNUM"
145 #define VCExDateProp "EXDATE"
146 #define VCExpectProp "EXPECT"
147 #define VCExtAddressProp "EXT ADD"
148 #define VCFamilyNameProp "F"
149 #define VCFaxProp "FAX"
150 #define VCFullNameProp "FN"
151 #define VCGeoProp "GEO"
152 #define VCGeoLocationProp "GEO"
153 #define VCGIFProp "GIF"
154 #define VCGivenNameProp "G"
155 #define VCGroupingProp "Grouping"
156 #define VCHomeProp "HOME"
157 #define VCIBMMailProp "IBMMail"
158 #define VCInlineProp "INLINE"
159 #define VCInternationalProp "INTL"
160 #define VCInternetProp "INTERNET"
161 #define VCISDNProp "ISDN"
162 #define VCJPEGProp "JPEG"
163 #define VCLanguageProp "LANG"
164 #define VCLastModifiedProp "LAST-MODIFIED"
165 #define VCLastRevisedProp "REV"
166 #define VCLocationProp "LOCATION"
167 #define VCLogoProp "LOGO"
168 #define VCMailerProp "MAILER"
169 #define VCMAlarmProp "MALARM"
170 #define VCMCIMailProp "MCIMAIL"
171 #define VCMessageProp "MSG"
172 #define VCMETProp "MET"
173 #define VCModemProp "MODEM"
174 #define VCMPEG2Prop "MPEG2"
175 #define VCMPEGProp "MPEG"
176 #define VCMSNProp "MSN"
177 #define VCNamePrefixesProp "NPRE"
178 #define VCNameProp "N"
179 #define VCNameSuffixesProp "NSUF"
180 #define VCNoteProp "NOTE"
181 #define VCOrgNameProp "ORGNAME"
182 #define VCOrgProp "ORG"
183 #define VCOrgUnit2Prop "OUN2"
184 #define VCOrgUnit3Prop "OUN3"
185 #define VCOrgUnit4Prop "OUN4"
186 #define VCOrgUnitProp "OUN"
187 #define VCPagerProp "PAGER"
188 #define VCPAlarmProp "PALARM"
189 #define VCParcelProp "PARCEL"
190 #define VCPartProp "PART"
191 #define VCPCMProp "PCM"
192 #define VCPDFProp "PDF"
193 #define VCPGPProp "PGP"
194 #define VCPhotoProp "PHOTO"
195 #define VCPICTProp "PICT"
196 #define VCPMBProp "PMB"
197 #define VCPostalBoxProp "BOX"
198 #define VCPostalCodeProp "PC"
199 #define VCPostalProp "POSTAL"
200 #define VCPowerShareProp "POWERSHARE"
201 #define VCPreferredProp "PREF"
202 #define VCPriorityProp "PRIORITY"
203 #define VCProcedureNameProp "PROCEDURENAME"
204 #define VCProdIdProp "PRODID"
205 #define VCProdigyProp "PRODIGY"
206 #define VCPronunciationProp "SOUND"
207 #define VCPSProp "PS"
208 #define VCPublicKeyProp "KEY"
209 #define VCQPProp "QP"
210 #define VCQuickTimeProp "QTIME"
211 #define VCQuotedPrintableProp"QUOTED-PRINTABLE"
212 #define VCRDateProp "RDATE"
213 #define VCRegionProp "R"
214 #define VCRelatedToProp "RELATED-TO"
215 #define VCRepeatCountProp "REPEATCOUNT"
216 #define VCResourcesProp "RESOURCES"
217 #define VCRNumProp "RNUM"
218 #define VCRoleProp "ROLE"
219 #define VCRRuleProp "RRULE"
220 #define VCRSVPProp "RSVP"
221 #define VCRunTimeProp "RUNTIME"
222 #define VCSequenceProp "SEQUENCE"
223 #define VCSnoozeTimeProp "SNOOZETIME"
224 #define VCStartProp "START"
225 #define VCStatusProp "STATUS"
226 #define VCStreetAddressProp "STREET"
227 #define VCSubTypeProp "SUBTYPE"
228 #define VCSummaryProp "SUMMARY"
229 #define VCTelephoneProp "TEL"
230 #define VCTIFFProp "TIFF"
231 #define VCTimeZoneProp "TZ"
232 #define VCTitleProp "TITLE"
233 #define VCTLXProp "TLX"
234 #define VCTodoProp "VTODO"
235 #define VCTranspProp "TRANSP"
236 #define VCUniqueStringProp "UID"
237 #define VCURLProp "URL"
238 #define VCURLValueProp "URLVAL"
239 #define VCValueProp "VALUE"
240 #define VCVersionProp "VERSION"
241 #define VCVideoProp "VIDEO"
242 #define VCVoiceProp "VOICE"
243 #define VCWAVEProp "WAVE"
244 #define VCWMFProp "WMF"
245 #define VCWorkProp "WORK"
246 #define VCX400Prop "X400"
247 #define VCX509Prop "X509"
248 #define VCXRuleProp "XRULE"
249
250/* extensions for KOrganizer / KPilot */
251#define KPilotIdProp "X-PILOTID"
252#define KPilotStatusProp "X-PILOTSTAT"
253
254/* extensions for iMIP / iTIP */
255#define ICOrganizerProp "X-ORGANIZER"
256#define ICMethodProp "X-METHOD"
257#define ICRequestStatusProp "X-REQUEST-STATUS"
258
259typedef struct VObject VObject;
260
261typedef union ValueItem {
262 const char *strs;
263 const wchar_t *ustrs;
264 unsigned int i;
265 unsigned long l;
266 void *any;
267 VObject *vobj;
268 } ValueItem;
269
270struct VObject {
271 VObject *next;
272 const char *id;
273 VObject *prop;
274 unsigned short valType;
275 ValueItem val;
276 };
277
278typedef struct StrItem StrItem;
279
280struct StrItem {
281 StrItem *next;
282 const char *s;
283 unsigned int refCnt;
284 };
285
286typedef struct VObjectIterator {
287 VObject* start;
288 VObject* next;
289 } VObjectIterator;
290
291extern VObject* newVObject(const char *id);
292extern void deleteVObject(VObject *p);
293extern char* dupStr(const char *s, unsigned int size);
294extern void deleteStr(const char *p);
295extern void unUseStr(const char *s);
296
297extern void setVObjectName(VObject *o, const char* id);
298extern void setVObjectStringZValue(VObject *o, const char *s);
299extern void setVObjectStringZValue_(VObject *o, const char *s);
300extern void setVObjectUStringZValue(VObject *o, const wchar_t *s);
301extern void setVObjectUStringZValue_(VObject *o, const wchar_t *s);
302extern void setVObjectIntegerValue(VObject *o, unsigned int i);
303extern void setVObjectLongValue(VObject *o, unsigned long l);
304extern void setVObjectAnyValue(VObject *o, void *t);
305extern VObject* setValueWithSize(VObject *prop, void *val, unsigned int size);
306extern VObject* setValueWithSize_(VObject *prop, void *val, unsigned int size);
307
308extern const char* vObjectName(VObject *o);
309extern const char* vObjectStringZValue(VObject *o);
310extern const wchar_t* vObjectUStringZValue(VObject *o);
311extern unsigned int vObjectIntegerValue(VObject *o);
312extern unsigned long vObjectLongValue(VObject *o);
313extern void* vObjectAnyValue(VObject *o);
314extern VObject* vObjectVObjectValue(VObject *o);
315extern void setVObjectVObjectValue(VObject *o, VObject *p);
316
317extern VObject* addVObjectProp(VObject *o, VObject *p);
318extern VObject* addProp(VObject *o, const char *id);
319extern VObject* addProp_(VObject *o, const char *id);
320extern VObject* addPropValue(VObject *o, const char *p, const char *v);
321extern VObject* addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size);
322extern VObject* addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size);
323extern VObject* addGroup(VObject *o, const char *g);
324extern void addList(VObject **o, VObject *p);
325
326extern VObject* isAPropertyOf(VObject *o, const char *id);
327
328extern VObject* nextVObjectInList(VObject *o);
329extern void initPropIterator(VObjectIterator *i, VObject *o);
330extern int moreIteration(VObjectIterator *i);
331extern VObject* nextVObject(VObjectIterator *i);
332
333extern char* writeMemVObject(char *s, int *len, VObject *o);
334extern char* writeMemVObjects(char *s, int *len, VObject *list);
335
336extern const char* lookupStr(const char *s);
337extern void cleanStrTbl();
338
339extern void cleanVObject(VObject *o);
340extern void cleanVObjects(VObject *list);
341
342extern const char* lookupProp(const char* str);
343extern const char* lookupProp_(const char* str);
344
345extern wchar_t* fakeUnicode(const char *ps, int *bytes);
346extern int uStrLen(const wchar_t *u);
347extern char* fakeCString(const wchar_t *u);
348
349extern void printVObjectToFile(char *fname,VObject *o);
350extern void printVObjectsToFile(char *fname,VObject *list);
351extern void writeVObjectToFile(char *fname, VObject *o);
352extern void writeVObjectsToFile(char *fname, VObject *list);
353
354extern int vObjectValueType(VObject *o);
355
356/* return type of vObjectValueType: */
357 #define VCVT_NOVALUE0
358 /* if the VObject has no value associated with it. */
359 #define VCVT_STRINGZ1
360 /* if the VObject has value set by setVObjectStringZValue. */
361 #define VCVT_USTRINGZ2
362 /* if the VObject has value set by setVObjectUStringZValue. */
363 #define VCVT_UINT 3
364 /* if the VObject has value set by setVObjectIntegerValue. */
365 #define VCVT_ULONG 4
366 /* if the VObject has value set by setVObjectLongValue. */
367 #define VCVT_RAW 5
368 /* if the VObject has value set by setVObjectAnyValue. */
369 #define VCVT_VOBJECT6
370 /* if the VObject has value set by setVObjectVObjectValue. */
371
372extern const char** fieldedProp;
373
374extern void printVObject(FILE *fp,VObject *o);
375extern void writeVObject(FILE *fp, VObject *o);
376
377
378#if defined(__CPLUSPLUS__) || defined(__cplusplus)
379}
380#endif
381
382#endif /* __VOBJECT_H__ */
383
384