-rw-r--r-- | libkcal/versit/vobject.h | 173 |
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 | |||
259 | typedef struct VObject VObject; | 258 | typedef struct VObject VObject; |
260 | 259 | ||
261 | typedef 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 | |||
270 | struct VObject { | ||
271 | VObject *next; | ||
272 | const char *id; | ||
273 | VObject *prop; | ||
274 | unsigned short valType; | ||
275 | ValueItem val; | ||
276 | }; | ||
277 | |||
278 | typedef struct StrItem StrItem; | ||
279 | |||
280 | struct StrItem { | ||
281 | StrItem *next; | ||
282 | const char *s; | ||
283 | unsigned int refCnt; | ||
284 | }; | ||
285 | |||
286 | typedef struct VObjectIterator { | 260 | typedef struct VObjectIterator { |
287 | VObject* start; | 261 | VObject* start; |
288 | VObject* next; | 262 | VObject* next; |
289 | } VObjectIterator; | 263 | } VObjectIterator; |
290 | 264 | ||
291 | extern VObject* newVObject(const char *id); | 265 | extern DLLEXPORT(VObject*) newVObject(const char *id); |
292 | extern void deleteVObject(VObject *p); | 266 | extern DLLEXPORT(void) deleteVObject(VObject *p); |
293 | extern char* dupStr(const char *s, unsigned int size); | 267 | extern DLLEXPORT(char*) dupStr(const char *s, unsigned int size); |
294 | extern void deleteStr(const char *p); | 268 | extern DLLEXPORT(void) deleteStr(const char *p); |
295 | extern void unUseStr(const char *s); | 269 | extern DLLEXPORT(void) unUseStr(const char *s); |
296 | 270 | ||
297 | extern void setVObjectName(VObject *o, const char* id); | 271 | extern DLLEXPORT(void) setVObjectName(VObject *o, const char* id); |
298 | extern void setVObjectStringZValue(VObject *o, const char *s); | 272 | extern DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s); |
299 | extern void setVObjectStringZValue_(VObject *o, const char *s); | 273 | extern DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s); |
300 | extern void setVObjectUStringZValue(VObject *o, const wchar_t *s); | 274 | extern DLLEXPORT(void) setVObjectUStringZValue(VObject *o, const wchar_t *s); |
301 | extern void setVObjectUStringZValue_(VObject *o, const wchar_t *s); | 275 | extern DLLEXPORT(void) setVObjectUStringZValue_(VObject *o, const wchar_t *s); |
302 | extern void setVObjectIntegerValue(VObject *o, unsigned int i); | 276 | extern DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i); |
303 | extern void setVObjectLongValue(VObject *o, unsigned long l); | 277 | extern DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l); |
304 | extern void setVObjectAnyValue(VObject *o, void *t); | 278 | extern DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t); |
305 | extern VObject* setValueWithSize(VObject *prop, void *val, unsigned int size); | 279 | extern DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size); |
306 | extern VObject* setValueWithSize_(VObject *prop, void *val, unsigned int size); | 280 | extern DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size); |
307 | 281 | ||
308 | extern const char* vObjectName(VObject *o); | 282 | extern DLLEXPORT(const char*) vObjectName(VObject *o); |
309 | extern const char* vObjectStringZValue(VObject *o); | 283 | extern DLLEXPORT(const char*) vObjectStringZValue(VObject *o); |
310 | extern const wchar_t* vObjectUStringZValue(VObject *o); | 284 | extern DLLEXPORT(const wchar_t*) vObjectUStringZValue(VObject *o); |
311 | extern unsigned int vObjectIntegerValue(VObject *o); | 285 | extern DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o); |
312 | extern unsigned long vObjectLongValue(VObject *o); | 286 | extern DLLEXPORT(unsigned long) vObjectLongValue(VObject *o); |
313 | extern void* vObjectAnyValue(VObject *o); | 287 | extern DLLEXPORT(void*) vObjectAnyValue(VObject *o); |
314 | extern VObject* vObjectVObjectValue(VObject *o); | 288 | extern DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o); |
315 | extern void setVObjectVObjectValue(VObject *o, VObject *p); | 289 | extern DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p); |
316 | 290 | ||
317 | extern VObject* addVObjectProp(VObject *o, VObject *p); | 291 | extern DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p); |
318 | extern VObject* addProp(VObject *o, const char *id); | 292 | extern DLLEXPORT(VObject*) addProp(VObject *o, const char *id); |
319 | extern VObject* addProp_(VObject *o, const char *id); | 293 | extern DLLEXPORT(VObject*) addProp_(VObject *o, const char *id); |
320 | extern VObject* addPropValue(VObject *o, const char *p, const char *v); | 294 | extern DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v); |
321 | extern VObject* addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size); | 295 | extern DLLEXPORT(VObject*) addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size); |
322 | extern VObject* addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size); | 296 | extern DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size); |
323 | extern VObject* addGroup(VObject *o, const char *g); | 297 | extern DLLEXPORT(VObject*) addGroup(VObject *o, const char *g); |
324 | extern void addList(VObject **o, VObject *p); | 298 | extern DLLEXPORT(void) addList(VObject **o, VObject *p); |
325 | 299 | ||
326 | extern VObject* isAPropertyOf(VObject *o, const char *id); | 300 | extern DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id); |
327 | 301 | ||
328 | extern VObject* nextVObjectInList(VObject *o); | 302 | extern DLLEXPORT(VObject*) nextVObjectInList(VObject *o); |
329 | extern void initPropIterator(VObjectIterator *i, VObject *o); | 303 | extern DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o); |
330 | extern int moreIteration(VObjectIterator *i); | 304 | extern DLLEXPORT(int) moreIteration(VObjectIterator *i); |
331 | extern VObject* nextVObject(VObjectIterator *i); | 305 | extern DLLEXPORT(VObject*) nextVObject(VObjectIterator *i); |
332 | 306 | ||
333 | extern char* writeMemVObject(char *s, int *len, VObject *o); | 307 | extern DLLEXPORT(char*) writeMemVObject(char *s, int *len, VObject *o); |
334 | extern char* writeMemVObjects(char *s, int *len, VObject *list); | 308 | extern DLLEXPORT(char*) writeMemVObjects(char *s, int *len, VObject *list); |
335 | 309 | ||
336 | extern const char* lookupStr(const char *s); | 310 | extern DLLEXPORT(const char*) lookupStr(const char *s); |
337 | extern void cleanStrTbl(); | 311 | extern DLLEXPORT(void) cleanStrTbl(); |
338 | 312 | ||
339 | extern void cleanVObject(VObject *o); | 313 | extern DLLEXPORT(void) cleanVObject(VObject *o); |
340 | extern void cleanVObjects(VObject *list); | 314 | extern DLLEXPORT(void) cleanVObjects(VObject *list); |
341 | 315 | ||
342 | extern const char* lookupProp(const char* str); | 316 | extern DLLEXPORT(const char*) lookupProp(const char* str); |
343 | extern const char* lookupProp_(const char* str); | 317 | extern DLLEXPORT(const char*) lookupProp_(const char* str); |
344 | 318 | ||
345 | extern wchar_t* fakeUnicode(const char *ps, int *bytes); | 319 | extern DLLEXPORT(wchar_t*) fakeUnicode(const char *ps, int *bytes); |
346 | extern int uStrLen(const wchar_t *u); | 320 | extern DLLEXPORT(int) uStrLen(const wchar_t *u); |
347 | extern char* fakeCString(const wchar_t *u); | 321 | extern DLLEXPORT(char*) fakeCString(const wchar_t *u); |
348 | 322 | ||
349 | extern void printVObjectToFile(char *fname,VObject *o); | 323 | extern DLLEXPORT(void) printVObjectToFile(char *fname,VObject *o); |
350 | extern void printVObjectsToFile(char *fname,VObject *list); | 324 | extern DLLEXPORT(void) printVObjectsToFile(char *fname,VObject *list); |
351 | extern void writeVObjectToFile(char *fname, VObject *o); | 325 | extern DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o); |
352 | extern void writeVObjectsToFile(char *fname, VObject *list); | 326 | extern DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list); |
353 | 327 | ||
354 | extern int vObjectValueType(VObject *o); | 328 | extern 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 | ||
372 | extern const char** fieldedProp; | 346 | extern const char** fieldedProp; |
373 | 347 | ||
348 | /* NOTE regarding printVObject and writeVObject | ||
349 | |||
350 | The functions below are not exported from the DLL because they | ||
351 | take a FILE* as a parameter, which cannot be passed across a DLL | ||
352 | interface (at least that is my experience). Instead you can use | ||
353 | their companion functions which take file names or pointers | ||
354 | to memory. However, if you are linking this code into | ||
355 | your build directly then you may find them a more convenient API | ||
356 | and you can go ahead and use them. If you try to use them with | ||
357 | the DLL LIB you will get a link error. | ||
358 | */ | ||
374 | extern void printVObject(FILE *fp,VObject *o); | 359 | extern void printVObject(FILE *fp,VObject *o); |
375 | extern void writeVObject(FILE *fp, VObject *o); | 360 | extern void writeVObject(FILE *fp, VObject *o); |
376 | 361 | ||