summaryrefslogtreecommitdiff
path: root/library/backend/vobject_p.h
Unidiff
Diffstat (limited to 'library/backend/vobject_p.h') (more/less context) (show whitespace changes)
-rw-r--r--library/backend/vobject_p.h401
1 files changed, 401 insertions, 0 deletions
diff --git a/library/backend/vobject_p.h b/library/backend/vobject_p.h
new file mode 100644
index 0000000..b6a2c0a
--- a/dev/null
+++ b/library/backend/vobject_p.h
@@ -0,0 +1,401 @@
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#include <qstring.h>
82
83 #define vCardClipboardFormat "+//ISBN 1-887687-00-9::versit::PDI//vCard"
84 #define vCalendarClipboardFormat"+//ISBN 1-887687-00-9::versit::PDI//vCalendar"
85
86/* The above strings vCardClipboardFormat and vCalendarClipboardFormat
87are globally unique IDs which can be used to generate clipboard format
88ID's as per the requirements of a specific platform. For example, in
89Windows they are used as the parameter in a call to RegisterClipboardFormat.
90For example:
91
92 CLIPFORMAT foo = RegisterClipboardFormat(vCardClipboardFormat);
93
94*/
95
96 #define vCardMimeType "text/x-vCard"
97 #define vCalendarMimeType"text/x-vCalendar"
98
99#undef DLLEXPORT
100#include <qglobal.h>
101#if defined(Q_WS_WIN)
102#define DLLEXPORT(t) __declspec(dllexport) t
103#else
104#define DLLEXPORT(t) t
105#endif
106
107#ifndef FALSE
108 #define FALSE0
109#endif
110#ifndef TRUE
111 #define TRUE1
112#endif
113
114#include <stdlib.h>
115#include <stdio.h>
116
117
118 #define VC7bitProp "7BIT"
119 #define VC8bitProp "8BIT"
120 #define VCAAlarmProp "AALARM"
121 #define VCAdditionalNamesProp"ADDN"
122 #define VCAdrProp "ADR"
123 #define VCAgentProp "AGENT"
124 #define VCAIFFProp "AIFF"
125 #define VCAOLProp "AOL"
126 #define VCAppleLinkProp "APPLELINK"
127 #define VCAttachProp "ATTACH"
128 #define VCAttendeeProp "ATTENDEE"
129 #define VCATTMailProp "ATTMAIL"
130 #define VCAudioContentProp "AUDIOCONTENT"
131 #define VCAVIProp "AVI"
132 #define VCBase64Prop "BASE64"
133 #define VCBBSProp "BBS"
134 #define VCBirthDateProp "BDAY"
135 #define VCBMPProp "BMP"
136 #define VCBodyProp "BODY"
137 #define VCBusinessRoleProp "ROLE"
138 #define VCCalProp "VCALENDAR"
139 #define VCCaptionProp "CAP"
140 #define VCCardProp "VCARD"
141 #define VCCarProp "CAR"
142 #define VCCategoriesProp "CATEGORIES"
143 #define VCCellularProp "CELL"
144 #define VCCGMProp "CGM"
145 #define VCCharSetProp "CS"
146 #define VCCIDProp "CID"
147 #define VCCISProp "CIS"
148 #define VCCityProp "L"
149 #define VCClassProp "CLASS"
150 #define VCCommentProp "NOTE"
151 #define VCCompletedProp "COMPLETED"
152 #define VCContentIDProp "CONTENT-ID"
153 #define VCCountryNameProp "C"
154 #define VCDAlarmProp "DALARM"
155 #define VCDataSizeProp "DATASIZE"
156 #define VCDayLightProp "DAYLIGHT"
157 #define VCDCreatedProp "DCREATED"
158#define VCDeliveryLabelProp "LABEL"
159 #define VCDescriptionProp "DESCRIPTION"
160 #define VCDIBProp "DIB"
161 #define VCDisplayStringProp "DISPLAYSTRING"
162 #define VCDomesticProp "DOM"
163 #define VCDTendProp "DTEND"
164 #define VCDTstartProp "DTSTART"
165 #define VCDueProp "DUE"
166 #define VCEmailAddressProp "EMAIL"
167 #define VCEncodingProp "ENCODING"
168 #define VCEndProp "END"
169 #define VCEventProp "VEVENT"
170 #define VCEWorldProp "EWORLD"
171 #define VCExNumProp "EXNUM"
172 #define VCExpDateProp "EXDATE"
173 #define VCExpectProp "EXPECT"
174 #define VCExtAddressProp "EXT ADD"
175 #define VCFamilyNameProp "F"
176 #define VCFaxProp "FAX"
177 #define VCFullNameProp "FN"
178 #define VCGeoProp "GEO"
179 #define VCGeoLocationProp "GEO"
180 #define VCGIFProp "GIF"
181 #define VCGivenNameProp "G"
182 #define VCGroupingProp "Grouping"
183 #define VCHomeProp "HOME"
184 #define VCIBMMailProp "IBMMail"
185 #define VCInlineProp "INLINE"
186 #define VCInternationalProp "INTL"
187 #define VCInternetProp "INTERNET"
188 #define VCISDNProp "ISDN"
189 #define VCJPEGProp "JPEG"
190 #define VCLanguageProp "LANG"
191 #define VCLastModifiedProp "LAST-MODIFIED"
192 #define VCLastRevisedProp "REV"
193 #define VCLocationProp "LOCATION"
194 #define VCLogoProp "LOGO"
195 #define VCMailerProp "MAILER"
196 #define VCMAlarmProp "MALARM"
197 #define VCMCIMailProp "MCIMAIL"
198 #define VCMessageProp "MSG"
199 #define VCMETProp "MET"
200 #define VCModemProp "MODEM"
201 #define VCMPEG2Prop "MPEG2"
202 #define VCMPEGProp "MPEG"
203 #define VCMSNProp "MSN"
204 #define VCNamePrefixesProp "NPRE"
205 #define VCNameProp "N"
206 #define VCNameSuffixesProp "NSUF"
207 #define VCNoteProp "NOTE"
208 #define VCOrgNameProp "ORGNAME"
209 #define VCOrgProp "ORG"
210 #define VCOrgUnit2Prop "OUN2"
211 #define VCOrgUnit3Prop "OUN3"
212 #define VCOrgUnit4Prop "OUN4"
213 #define VCOrgUnitProp "OUN"
214 #define VCPagerProp "PAGER"
215 #define VCPAlarmProp "PALARM"
216 #define VCParcelProp "PARCEL"
217 #define VCPartProp "PART"
218 #define VCPCMProp "PCM"
219 #define VCPDFProp "PDF"
220 #define VCPGPProp "PGP"
221 #define VCPhotoProp "PHOTO"
222 #define VCPICTProp "PICT"
223 #define VCPMBProp "PMB"
224 #define VCPostalBoxProp "BOX"
225 #define VCPostalCodeProp "PC"
226 #define VCPostalProp "POSTAL"
227 #define VCPowerShareProp "POWERSHARE"
228 #define VCPreferredProp "PREF"
229 #define VCPriorityProp "PRIORITY"
230 #define VCProcedureNameProp "PROCEDURENAME"
231 #define VCProdIdProp "PRODID"
232 #define VCProdigyProp "PRODIGY"
233 #define VCPronunciationProp "SOUND"
234 #define VCPSProp "PS"
235 #define VCPublicKeyProp "KEY"
236 #define VCQPProp "QP"
237 #define VCQuickTimeProp "QTIME"
238 #define VCQuotedPrintableProp"QUOTED-PRINTABLE"
239 #define VCRDateProp "RDATE"
240 #define VCRegionProp "R"
241 #define VCRelatedToProp "RELATED-TO"
242 #define VCRepeatCountProp "REPEATCOUNT"
243 #define VCResourcesProp "RESOURCES"
244 #define VCRNumProp "RNUM"
245 #define VCRoleProp "ROLE"
246 #define VCRRuleProp "RRULE"
247 #define VCRSVPProp "RSVP"
248 #define VCRunTimeProp "RUNTIME"
249 #define VCSequenceProp "SEQUENCE"
250 #define VCSnoozeTimeProp "SNOOZETIME"
251 #define VCStartProp "START"
252 #define VCStatusProp "STATUS"
253 #define VCStreetAddressProp "STREET"
254 #define VCSubTypeProp "SUBTYPE"
255 #define VCSummaryProp "SUMMARY"
256 #define VCTelephoneProp "TEL"
257 #define VCTIFFProp "TIFF"
258 #define VCTimeZoneProp "TZ"
259 #define VCTitleProp "TITLE"
260 #define VCTLXProp "TLX"
261 #define VCTodoProp "VTODO"
262 #define VCTranspProp "TRANSP"
263 #define VCUniqueStringProp "UID"
264 #define VCURLProp "URL"
265 #define VCURLValueProp "URLVAL"
266 #define VCValueProp "VALUE"
267 #define VCVersionProp "VERSION"
268 #define VCVideoProp "VIDEO"
269 #define VCVoiceProp "VOICE"
270 #define VCWAVEProp "WAVE"
271 #define VCWMFProp "WMF"
272 #define VCWorkProp "WORK"
273 #define VCX400Prop "X400"
274 #define VCX509Prop "X509"
275 #define VCXRuleProp "XRULE"
276
277
278typedef struct VObject VObject;
279
280typedef struct VObjectIterator {
281 VObject* start;
282 VObject* next;
283 } VObjectIterator;
284
285extern DLLEXPORT(VObject*) newVObject(const char *id);
286extern DLLEXPORT(void) deleteVObject(VObject *p);
287extern DLLEXPORT(char*) dupStr(const char *s, unsigned int size);
288extern DLLEXPORT(void) deleteStr(const char *p);
289extern DLLEXPORT(void) unUseStr(const char *s);
290
291extern DLLEXPORT(void) setVObjectName(VObject *o, const char* id);
292extern DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s);
293extern DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s);
294extern DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i);
295extern DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l);
296extern DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t);
297extern DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size);
298extern DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size);
299
300extern DLLEXPORT(const char*) vObjectName(VObject *o);
301extern DLLEXPORT(const char*) vObjectStringZValue(VObject *o);
302extern DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o);
303extern DLLEXPORT(unsigned long) vObjectLongValue(VObject *o);
304extern DLLEXPORT(void*) vObjectAnyValue(VObject *o);
305extern DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o);
306extern DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p);
307
308extern DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p);
309extern DLLEXPORT(VObject*) addProp(VObject *o, const char *id);
310extern DLLEXPORT(VObject*) addProp_(VObject *o, const char *id);
311extern DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v);
312extern DLLEXPORT(VObject*) addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size);
313extern DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size);
314extern DLLEXPORT(VObject*) addGroup(VObject *o, const char *g);
315extern DLLEXPORT(void) addList(VObject **o, VObject *p);
316
317extern DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id);
318
319extern DLLEXPORT(VObject*) nextVObjectInList(VObject *o);
320extern DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o);
321extern DLLEXPORT(int) moreIteration(VObjectIterator *i);
322extern DLLEXPORT(VObject*) nextVObject(VObjectIterator *i);
323
324extern DLLEXPORT(const char*) lookupStr(const char *s);
325extern DLLEXPORT(void) cleanStrTbl();
326
327extern DLLEXPORT(void) cleanVObject(VObject *o);
328extern DLLEXPORT(void) cleanVObjects(VObject *list);
329
330extern DLLEXPORT(const char*) lookupProp(const char* str);
331extern DLLEXPORT(const char*) lookupProp_(const char* str);
332
333extern DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o);
334extern DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list);
335
336extern DLLEXPORT(int) vObjectValueType(VObject *o);
337
338/* return type of vObjectValueType: */
339 #define VCVT_NOVALUE0
340 /* if the VObject has no value associated with it. */
341 #define VCVT_STRINGZ1
342 /* if the VObject has value set by setVObjectStringZValue. */
343 #define VCVT_UINT 2
344 /* if the VObject has value set by setVObjectIntegerValue. */
345 #define VCVT_ULONG 3
346 /* if the VObject has value set by setVObjectLongValue. */
347 #define VCVT_RAW 4
348 /* if the VObject has value set by setVObjectAnyValue. */
349 #define VCVT_VOBJECT5
350 /* if the VObject has value set by setVObjectVObjectValue. */
351
352extern const char** fieldedProp;
353
354/***************************************************
355 * The methods below are implemented in vcc.c (generated from vcc.y )
356 ***************************************************/
357
358/* NOTE regarding printVObject and writeVObject
359
360The functions below are not exported from the DLL because they
361take a FILE* as a parameter, which cannot be passed across a DLL
362interface (at least that is my experience). Instead you can use
363their companion functions which take file names or pointers
364to memory. However, if you are linking this code into
365your build directly then you may find them a more convenient API
366and you can go ahead and use them. If you try to use them with
367the DLL LIB you will get a link error.
368*/
369extern void writeVObject(FILE *fp, VObject *o);
370
371
372
373typedef void (*MimeErrorHandler)(char *);
374
375extern DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler);
376
377extern DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len);
378extern DLLEXPORT(VObject*) Parse_MIME_FromFileName(char* fname);
379
380
381/* NOTE regarding Parse_MIME_FromFile
382The function above, Parse_MIME_FromFile, comes in two flavors,
383neither of which is exported from the DLL. Each version takes
384a CFile or FILE* as a parameter, neither of which can be
385passed across a DLL interface (at least that is my experience).
386If you are linking this code into your build directly then
387you may find them a more convenient API that the other flavors
388that take a file name. If you use them with the DLL LIB you
389will get a link error.
390*/
391
392
393#if INCLUDEMFC
394extern VObject* Parse_MIME_FromFile(CFile *file);
395#else
396extern VObject* Parse_MIME_FromFile(FILE *file);
397#endif
398
399#endif /* __VOBJECT_H__ */
400
401