Libical API Documentation 4.0
Loading...
Searching...
No Matches
vobject.h
1/***************************************************************************
2SPDX-FileCopyrightText: 1996 Apple Computer, Inc., AT&T Corp., International
3Business Machines Corporation and Siemens Rolm Communications Inc.
4
5SPDX-License-Identifier: LicenseRef-APPLEMIT
6
7The software is provided with RESTRICTED RIGHTS. Use, duplication, or
8disclosure by the government are subject to restrictions set forth in
9DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
10
11***************************************************************************/
12
13/*
14
15The vCard/vCalendar C interface is implemented in the set
16of files as follows:
17
18vcc.y, yacc source, and vcc.c, the yacc output you will use
19implements the core parser
20
21vobject.c implements an API that insulates the caller from
22the parser and changes in the vCard/vCalendar BNF
23
24vcc.h and vobject.h are header files for their .c counterparts
25
26vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions
27which you may find useful.
28
29test.c is a standalone test driver that exercises some of
30the features of the APIs provided. Invoke test.exe on a
31VCARD/VCALENDAR input text file and you will see the pretty
32print output of the internal representation (this pretty print
33output should give you a good idea of how the internal
34representation looks like -- there is one such output in the
35following too). Also, a file with the .out suffix is generated
36to show that the internal representation can be written back
37in the original text format.
38
39For more information on this API see the readme.txt file
40which accompanied this distribution.
41*/
42
43#ifndef VOBJECT_H
44#define VOBJECT_H
45
46#include "libical_vcal_export.h"
47#include <stdlib.h>
48#include <stdio.h>
49
50#if defined(__CPLUSPLUS__) || defined(__cplusplus)
51extern "C"
52{
53#endif
54
55#define VC7bitProp "7BIT"
56#define VC8bitProp "8BIT"
57#define VCAAlarmProp "AALARM"
58#define VCAdditionalNamesProp "ADDN"
59#define VCAdrProp "ADR"
60#define VCAgentProp "AGENT"
61#define VCAIFFProp "AIFF"
62#define VCAOLProp "AOL"
63#define VCAppleLinkProp "APPLELINK"
64#define VCAttachProp "ATTACH"
65#define VCAttendeeProp "ATTENDEE"
66#define VCATTMailProp "ATTMAIL"
67#define VCAudioContentProp "AUDIOCONTENT"
68#define VCAVIProp "AVI"
69#define VCBase64Prop "BASE64"
70#define VCBBSProp "BBS"
71#define VCBirthDateProp "BDAY"
72#define VCBMPProp "BMP"
73#define VCBodyProp "BODY"
74#define VCBusinessRoleProp "ROLE"
75#define VCCalProp "VCALENDAR"
76#define VCCaptionProp "CAP"
77#define VCCardProp "VCARD"
78#define VCCarProp "CAR"
79#define VCCategoriesProp "CATEGORIES"
80#define VCCellularProp "CELL"
81#define VCCGMProp "CGM"
82#define VCCharSetProp "CS"
83#define VCCIDProp "CID"
84#define VCCISProp "CIS"
85#define VCCityProp "L"
86#define VCClassProp "CLASS"
87#define VCCommentProp "NOTE"
88#define VCCompletedProp "COMPLETED"
89#define VCContentIDProp "CONTENT-ID"
90#define VCCountryNameProp "C"
91#define VCDAlarmProp "DALARM"
92#define VCDataSizeProp "DATASIZE"
93#define VCDayLightProp "DAYLIGHT"
94#define VCDCreatedProp "DCREATED"
95#define VCDeliveryLabelProp "LABEL"
96#define VCDescriptionProp "DESCRIPTION"
97#define VCDIBProp "DIB"
98#define VCDisplayStringProp "DISPLAYSTRING"
99#define VCDomesticProp "DOM"
100#define VCDTendProp "DTEND"
101#define VCDTstartProp "DTSTART"
102#define VCDueProp "DUE"
103#define VCEmailAddressProp "EMAIL"
104#define VCEncodingProp "ENCODING"
105#define VCEndProp "END"
106#define VCEventProp "VEVENT"
107#define VCEWorldProp "EWORLD"
108#define VCExNumProp "EXNUM"
109#define VCExpDateProp "EXDATE"
110#define VCExpectProp "EXPECT"
111#define VCExtAddressProp "EXT ADD"
112#define VCFamilyNameProp "F"
113#define VCFaxProp "FAX"
114#define VCFullNameProp "FN"
115#define VCGeoProp "GEO"
116#define VCGeoLocationProp "GEO"
117#define VCGIFProp "GIF"
118#define VCGivenNameProp "G"
119#define VCGroupingProp "Grouping"
120#define VCHomeProp "HOME"
121#define VCIBMMailProp "IBMMail"
122#define VCInlineProp "INLINE"
123#define VCInternationalProp "INTL"
124#define VCInternetProp "INTERNET"
125#define VCISDNProp "ISDN"
126#define VCJPEGProp "JPEG"
127#define VCLanguageProp "LANG"
128#define VCLastModifiedProp "LAST-MODIFIED"
129#define VCLastRevisedProp "REV"
130#define VCLocationProp "LOCATION"
131#define VCLogoProp "LOGO"
132#define VCMailerProp "MAILER"
133#define VCMAlarmProp "MALARM"
134#define VCMCIMailProp "MCIMAIL"
135#define VCMessageProp "MSG"
136#define VCMETProp "MET"
137#define VCModemProp "MODEM"
138#define VCMPEG2Prop "MPEG2"
139#define VCMPEGProp "MPEG"
140#define VCMSNProp "MSN"
141#define VCNamePrefixesProp "NPRE"
142#define VCNameProp "N"
143#define VCNameSuffixesProp "NSUF"
144#define VCNoteProp "NOTE"
145#define VCOrgNameProp "ORGNAME"
146#define VCOrgProp "ORG"
147#define VCOrgUnit2Prop "OUN2"
148#define VCOrgUnit3Prop "OUN3"
149#define VCOrgUnit4Prop "OUN4"
150#define VCOrgUnitProp "OUN"
151#define VCPagerProp "PAGER"
152#define VCPAlarmProp "PALARM"
153#define VCParcelProp "PARCEL"
154#define VCPartProp "PART"
155#define VCPCMProp "PCM"
156#define VCPDFProp "PDF"
157#define VCPGPProp "PGP"
158#define VCPhotoProp "PHOTO"
159#define VCPICTProp "PICT"
160#define VCPMBProp "PMB"
161#define VCPostalBoxProp "BOX"
162#define VCPostalCodeProp "PC"
163#define VCPostalProp "POSTAL"
164#define VCPowerShareProp "POWERSHARE"
165#define VCPreferredProp "PREF"
166#define VCPriorityProp "PRIORITY"
167#define VCProcedureNameProp "PROCEDURENAME"
168#define VCProdIdProp "PRODID"
169#define VCProdigyProp "PRODIGY"
170#define VCPronunciationProp "SOUND"
171#define VCPSProp "PS"
172#define VCPublicKeyProp "KEY"
173#define VCQPProp "QP"
174#define VCQuickTimeProp "QTIME"
175#define VCQuotedPrintableProp "QUOTED-PRINTABLE"
176#define VCRDateProp "RDATE"
177#define VCRegionProp "R"
178#define VCRelatedToProp "RELATED-TO"
179#define VCRepeatCountProp "REPEATCOUNT"
180#define VCResourcesProp "RESOURCES"
181#define VCRNumProp "RNUM"
182#define VCRoleProp "ROLE"
183#define VCRRuleProp "RRULE"
184#define VCRSVPProp "RSVP"
185#define VCRunTimeProp "RUNTIME"
186#define VCSequenceProp "SEQUENCE"
187#define VCSnoozeTimeProp "SNOOZETIME"
188#define VCStartProp "START"
189#define VCStatusProp "STATUS"
190#define VCStreetAddressProp "STREET"
191#define VCSubTypeProp "SUBTYPE"
192#define VCSummaryProp "SUMMARY"
193#define VCTelephoneProp "TEL"
194#define VCTIFFProp "TIFF"
195#define VCTimeZoneProp "TZ"
196#define VCTitleProp "TITLE"
197#define VCTLXProp "TLX"
198#define VCTodoProp "VTODO"
199#define VCTranspProp "TRANSP"
200#define VCUniqueStringProp "UID"
201#define VCURLProp "URL"
202#define VCURLValueProp "URLVAL"
203#define VCValueProp "VALUE"
204#define VCVersionProp "VERSION"
205#define VCVideoProp "VIDEO"
206#define VCVoiceProp "VOICE"
207#define VCWAVEProp "WAVE"
208#define VCWMFProp "WMF"
209#define VCWorkProp "WORK"
210#define VCX400Prop "X400"
211#define VCX509Prop "X509"
212#define VCXRuleProp "XRULE"
213
214/* Extensions */
215
216#define XPilotIdProp "X-PILOTID"
217#define XPilotStatusProp "X-PILOTSTAT"
218
219 typedef struct VObject VObject;
220
221 typedef struct VObjectIterator
222 {
223 VObject *start;
224 VObject *next;
226
227 LIBICAL_VCAL_EXPORT VObject *newVObject(const char *id);
228 LIBICAL_VCAL_EXPORT void deleteVObject(VObject *p);
229 LIBICAL_VCAL_EXPORT char *dupStr(const char *s, size_t size);
230 LIBICAL_VCAL_EXPORT void deleteStr(const char *p);
231 LIBICAL_VCAL_EXPORT void unUseStr(const char *s);
232
233 LIBICAL_VCAL_EXPORT void setVObjectName(VObject *o, const char *id);
234 LIBICAL_VCAL_EXPORT void setVObjectStringZValue(VObject *o, const char *s);
235 LIBICAL_VCAL_EXPORT void setVObjectStringZValue_(VObject *o, const char *s);
236 LIBICAL_VCAL_EXPORT void setVObjectUStringZValue(VObject *o, const wchar_t *s);
237 LIBICAL_VCAL_EXPORT void setVObjectUStringZValue_(VObject *o, const wchar_t *s);
238 LIBICAL_VCAL_EXPORT void setVObjectIntegerValue(VObject *o, unsigned int i);
239 LIBICAL_VCAL_EXPORT void setVObjectLongValue(VObject *o, unsigned long l);
240 LIBICAL_VCAL_EXPORT void setVObjectAnyValue(VObject *o, void *t);
241 LIBICAL_VCAL_EXPORT VObject *setValueWithSize(VObject *prop, void *val, unsigned int size);
242 LIBICAL_VCAL_EXPORT VObject *setValueWithSize_(VObject *prop, void *val, unsigned int size);
243
244 LIBICAL_VCAL_EXPORT const char *vObjectName(VObject *o);
245 LIBICAL_VCAL_EXPORT const char *vObjectStringZValue(VObject *o);
246 LIBICAL_VCAL_EXPORT const wchar_t *vObjectUStringZValue(VObject *o);
247 LIBICAL_VCAL_EXPORT unsigned int vObjectIntegerValue(VObject *o);
248 LIBICAL_VCAL_EXPORT unsigned long vObjectLongValue(VObject *o);
249 LIBICAL_VCAL_EXPORT void *vObjectAnyValue(VObject *o);
250 LIBICAL_VCAL_EXPORT VObject *vObjectVObjectValue(VObject *o);
251 LIBICAL_VCAL_EXPORT void setVObjectVObjectValue(VObject *o, VObject *p);
252
253 LIBICAL_VCAL_EXPORT VObject *addVObjectProp(VObject *o, VObject *p);
254 LIBICAL_VCAL_EXPORT VObject *addProp(VObject *o, const char *id);
255 LIBICAL_VCAL_EXPORT VObject *addPropValue(VObject *o, const char *p, const char *v);
256 LIBICAL_VCAL_EXPORT VObject *addPropSizedValue_(VObject *o, const char *p, const char *v,
257 unsigned int size);
258 LIBICAL_VCAL_EXPORT VObject *addPropSizedValue(VObject *o, const char *p, const char *v,
259 unsigned int size);
260 LIBICAL_VCAL_EXPORT VObject *addGroup(VObject *o, const char *g);
261 LIBICAL_VCAL_EXPORT void addList(VObject ** o, VObject *p);
262
263 LIBICAL_VCAL_EXPORT VObject *isAPropertyOf(VObject *o, const char *id);
264
265 LIBICAL_VCAL_EXPORT VObject *nextVObjectInList(VObject *o);
266 LIBICAL_VCAL_EXPORT void initPropIterator(VObjectIterator * i, VObject *o);
267 LIBICAL_VCAL_EXPORT int moreIteration(VObjectIterator * i);
268 LIBICAL_VCAL_EXPORT VObject *nextVObject(VObjectIterator * i);
269
270 LIBICAL_VCAL_EXPORT char *writeMemVObject(char *s, int *len, VObject *o);
271 LIBICAL_VCAL_EXPORT char *writeMemVObjects(char *s, int *len, VObject *list);
272
273 LIBICAL_VCAL_EXPORT const char *lookupStr(const char *s);
274 LIBICAL_VCAL_EXPORT void cleanStrTbl(void);
275
276 LIBICAL_VCAL_EXPORT void cleanVObject(VObject *o);
277 LIBICAL_VCAL_EXPORT void cleanVObjects(VObject *list);
278
279 LIBICAL_VCAL_EXPORT const char *lookupProp(const char *str);
280 LIBICAL_VCAL_EXPORT const char *lookupProp_(const char *str);
281
282 LIBICAL_VCAL_EXPORT wchar_t *fakeUnicode(const char *ps, size_t *bytes);
283 LIBICAL_VCAL_EXPORT int uStrLen(const wchar_t *u);
284 LIBICAL_VCAL_EXPORT char *fakeCString(const wchar_t *u);
285
286 LIBICAL_VCAL_EXPORT void printVObjectToFile(char *fname, VObject *o);
287 LIBICAL_VCAL_EXPORT void printVObjectsToFile(char *fname, VObject *list);
288 LIBICAL_VCAL_EXPORT void writeVObjectToFile(char *fname, VObject *o);
289 LIBICAL_VCAL_EXPORT void writeVObjectsToFile(char *fname, VObject *list);
290
291 LIBICAL_VCAL_EXPORT int vObjectValueType(VObject *o);
292
293/* return type of vObjectValueType: */
294#define VCVT_NOVALUE 0
295 /* if the VObject has no value associated with it. */
296#define VCVT_STRINGZ 1
297 /* if the VObject has value set by setVObjectStringZValue. */
298#define VCVT_USTRINGZ 2
299 /* if the VObject has value set by setVObjectUStringZValue. */
300#define VCVT_UINT 3
301 /* if the VObject has value set by setVObjectIntegerValue. */
302#define VCVT_ULONG 4
303 /* if the VObject has value set by setVObjectLongValue. */
304#define VCVT_RAW 5
305 /* if the VObject has value set by setVObjectAnyValue. */
306#define VCVT_VOBJECT 6
307 /* if the VObject has value set by setVObjectVObjectValue. */
308
309 extern const char **fieldedProp;
310
311/* NOTE regarding printVObject and writeVObject
312
313The functions below are not exported from the DLL because they
314take a FILE* as a parameter, which cannot be passed across a DLL
315interface (at least that is my experience). Instead you can use
316their companion functions which take file names or pointers
317to memory. However, if you are linking this code into
318your build directly then you may find them a more convenient API
319and you can go ahead and use them. If you try to use them with
320the DLL LIB you will get a link error.
321*/
322 extern void printVObject(FILE *fp, VObject *o);
323 extern void writeVObject(FILE *fp, VObject *o);
324
325#if defined(__CPLUSPLUS__) || defined(__cplusplus)
326}
327
328#endif
329
330#endif /* VOBJECT_H */
Definition vobject.h:222
Definition vobject.c:43