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