summaryrefslogtreecommitdiffabout
path: root/libkcal/versit/vobject.h
Unidiff
Diffstat (limited to 'libkcal/versit/vobject.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/versit/vobject.h173
1 files changed, 79 insertions, 94 deletions
diff --git a/libkcal/versit/vobject.h b/libkcal/versit/vobject.h
index 0ec8b31..85c299e 100644
--- a/libkcal/versit/vobject.h
+++ b/libkcal/versit/vobject.h
@@ -142,7 +142,7 @@ extern "C" {
142 #define VCEventProp "VEVENT" 142 #define VCEventProp "VEVENT"
143 #define VCEWorldProp "EWORLD" 143 #define VCEWorldProp "EWORLD"
144 #define VCExNumProp "EXNUM" 144 #define VCExNumProp "EXNUM"
145 #define VCExDateProp "EXDATE" 145 #define VCExpDateProp "EXDATE"
146 #define VCExpectProp "EXPECT" 146 #define VCExpectProp "EXPECT"
147 #define VCExtAddressProp "EXT ADD" 147 #define VCExtAddressProp "EXT ADD"
148 #define VCFamilyNameProp "F" 148 #define VCFamilyNameProp "F"
@@ -247,111 +247,85 @@ extern "C" {
247 #define VCX509Prop "X509" 247 #define VCX509Prop "X509"
248 #define VCXRuleProp "XRULE" 248 #define VCXRuleProp "XRULE"
249 249
250/* extensions for KOrganizer / KPilot */ 250/* Extensions */
251#define KPilotIdProp "X-PILOTID"
252#define KPilotStatusProp "X-PILOTSTAT"
253 251
252#define XPilotIdProp "X-PILOTID"
253#define XPilotStatusProp "X-PILOTSTAT"
254/* extensions for iMIP / iTIP */ 254/* extensions for iMIP / iTIP */
255#define ICOrganizerProp "X-ORGANIZER" 255#define ICOrganizerProp "X-ORGANIZER"
256#define ICMethodProp "X-METHOD" 256#define ICMethodProp "X-METHOD"
257#define ICRequestStatusProp "X-REQUEST-STATUS" 257#define ICRequestStatusProp "X-REQUEST-STATUS"
258
259typedef struct VObject VObject; 258typedef struct VObject VObject;
260 259
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 { 260typedef struct VObjectIterator {
287 VObject* start; 261 VObject* start;
288 VObject* next; 262 VObject* next;
289 } VObjectIterator; 263 } VObjectIterator;
290 264
291extern VObject* newVObject(const char *id); 265extern DLLEXPORT(VObject*) newVObject(const char *id);
292extern void deleteVObject(VObject *p); 266extern DLLEXPORT(void) deleteVObject(VObject *p);
293extern char* dupStr(const char *s, unsigned int size); 267extern DLLEXPORT(char*) dupStr(const char *s, unsigned int size);
294extern void deleteStr(const char *p); 268extern DLLEXPORT(void) deleteStr(const char *p);
295extern void unUseStr(const char *s); 269extern DLLEXPORT(void) unUseStr(const char *s);
296 270
297extern void setVObjectName(VObject *o, const char* id); 271extern DLLEXPORT(void) setVObjectName(VObject *o, const char* id);
298extern void setVObjectStringZValue(VObject *o, const char *s); 272extern DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s);
299extern void setVObjectStringZValue_(VObject *o, const char *s); 273extern DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s);
300extern void setVObjectUStringZValue(VObject *o, const wchar_t *s); 274extern DLLEXPORT(void) setVObjectUStringZValue(VObject *o, const wchar_t *s);
301extern void setVObjectUStringZValue_(VObject *o, const wchar_t *s); 275extern DLLEXPORT(void) setVObjectUStringZValue_(VObject *o, const wchar_t *s);
302extern void setVObjectIntegerValue(VObject *o, unsigned int i); 276extern DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i);
303extern void setVObjectLongValue(VObject *o, unsigned long l); 277extern DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l);
304extern void setVObjectAnyValue(VObject *o, void *t); 278extern DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t);
305extern VObject* setValueWithSize(VObject *prop, void *val, unsigned int size); 279extern DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size);
306extern VObject* setValueWithSize_(VObject *prop, void *val, unsigned int size); 280extern DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size);
307 281
308extern const char* vObjectName(VObject *o); 282extern DLLEXPORT(const char*) vObjectName(VObject *o);
309extern const char* vObjectStringZValue(VObject *o); 283extern DLLEXPORT(const char*) vObjectStringZValue(VObject *o);
310extern const wchar_t* vObjectUStringZValue(VObject *o); 284extern DLLEXPORT(const wchar_t*) vObjectUStringZValue(VObject *o);
311extern unsigned int vObjectIntegerValue(VObject *o); 285extern DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o);
312extern unsigned long vObjectLongValue(VObject *o); 286extern DLLEXPORT(unsigned long) vObjectLongValue(VObject *o);
313extern void* vObjectAnyValue(VObject *o); 287extern DLLEXPORT(void*) vObjectAnyValue(VObject *o);
314extern VObject* vObjectVObjectValue(VObject *o); 288extern DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o);
315extern void setVObjectVObjectValue(VObject *o, VObject *p); 289extern DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p);
316 290
317extern VObject* addVObjectProp(VObject *o, VObject *p); 291extern DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p);
318extern VObject* addProp(VObject *o, const char *id); 292extern DLLEXPORT(VObject*) addProp(VObject *o, const char *id);
319extern VObject* addProp_(VObject *o, const char *id); 293extern DLLEXPORT(VObject*) addProp_(VObject *o, const char *id);
320extern VObject* addPropValue(VObject *o, const char *p, const char *v); 294extern DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v);
321extern VObject* addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size); 295extern DLLEXPORT(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); 296extern DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size);
323extern VObject* addGroup(VObject *o, const char *g); 297extern DLLEXPORT(VObject*) addGroup(VObject *o, const char *g);
324extern void addList(VObject **o, VObject *p); 298extern DLLEXPORT(void) addList(VObject **o, VObject *p);
325 299
326extern VObject* isAPropertyOf(VObject *o, const char *id); 300extern DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id);
327 301
328extern VObject* nextVObjectInList(VObject *o); 302extern DLLEXPORT(VObject*) nextVObjectInList(VObject *o);
329extern void initPropIterator(VObjectIterator *i, VObject *o); 303extern DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o);
330extern int moreIteration(VObjectIterator *i); 304extern DLLEXPORT(int) moreIteration(VObjectIterator *i);
331extern VObject* nextVObject(VObjectIterator *i); 305extern DLLEXPORT(VObject*) nextVObject(VObjectIterator *i);
332 306
333extern char* writeMemVObject(char *s, int *len, VObject *o); 307extern DLLEXPORT(char*) writeMemVObject(char *s, int *len, VObject *o);
334extern char* writeMemVObjects(char *s, int *len, VObject *list); 308extern DLLEXPORT(char*) writeMemVObjects(char *s, int *len, VObject *list);
335 309
336extern const char* lookupStr(const char *s); 310extern DLLEXPORT(const char*) lookupStr(const char *s);
337extern void cleanStrTbl(); 311extern DLLEXPORT(void) cleanStrTbl();
338 312
339extern void cleanVObject(VObject *o); 313extern DLLEXPORT(void) cleanVObject(VObject *o);
340extern void cleanVObjects(VObject *list); 314extern DLLEXPORT(void) cleanVObjects(VObject *list);
341 315
342extern const char* lookupProp(const char* str); 316extern DLLEXPORT(const char*) lookupProp(const char* str);
343extern const char* lookupProp_(const char* str); 317extern DLLEXPORT(const char*) lookupProp_(const char* str);
344 318
345extern wchar_t* fakeUnicode(const char *ps, int *bytes); 319extern DLLEXPORT(wchar_t*) fakeUnicode(const char *ps, int *bytes);
346extern int uStrLen(const wchar_t *u); 320extern DLLEXPORT(int) uStrLen(const wchar_t *u);
347extern char* fakeCString(const wchar_t *u); 321extern DLLEXPORT(char*) fakeCString(const wchar_t *u);
348 322
349extern void printVObjectToFile(char *fname,VObject *o); 323extern DLLEXPORT(void) printVObjectToFile(char *fname,VObject *o);
350extern void printVObjectsToFile(char *fname,VObject *list); 324extern DLLEXPORT(void) printVObjectsToFile(char *fname,VObject *list);
351extern void writeVObjectToFile(char *fname, VObject *o); 325extern DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o);
352extern void writeVObjectsToFile(char *fname, VObject *list); 326extern DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list);
353 327
354extern int vObjectValueType(VObject *o); 328extern DLLEXPORT(int) vObjectValueType(VObject *o);
355 329
356/* return type of vObjectValueType: */ 330/* return type of vObjectValueType: */
357 #define VCVT_NOVALUE0 331 #define VCVT_NOVALUE0
@@ -371,6 +345,17 @@ extern int vObjectValueType(VObject *o);
371 345
372extern const char** fieldedProp; 346extern const char** fieldedProp;
373 347
348/* NOTE regarding printVObject and writeVObject
349
350The functions below are not exported from the DLL because they
351take a FILE* as a parameter, which cannot be passed across a DLL
352interface (at least that is my experience). Instead you can use
353their companion functions which take file names or pointers
354to memory. However, if you are linking this code into
355your build directly then you may find them a more convenient API
356and you can go ahead and use them. If you try to use them with
357the DLL LIB you will get a link error.
358*/
374extern void printVObject(FILE *fp,VObject *o); 359extern void printVObject(FILE *fp,VObject *o);
375extern void writeVObject(FILE *fp, VObject *o); 360extern void writeVObject(FILE *fp, VObject *o);
376 361