icaldirset.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*======================================================================
  2. FILE: icaldirset.h
  3. CREATOR: eric 28 November 1999
  4. (C) COPYRIGHT 2000, Eric Busboom <eric@softwarestudio.org>
  5. http://www.softwarestudio.org
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of either:
  8. The LGPL as published by the Free Software Foundation, version
  9. 2.1, available at: http://www.gnu.org/licenses/lgpl-2.1.html
  10. Or:
  11. The Mozilla Public License Version 1.0. You may obtain a copy of
  12. the License at http://www.mozilla.org/MPL/
  13. The Original Code is eric. The Initial Developer of the Original
  14. Code is Eric Busboom
  15. ======================================================================*/
  16. #ifndef ICALDIRSET_H
  17. #define ICALDIRSET_H
  18. #include "libical_icalss_export.h"
  19. #include "icalset.h"
  20. /* icaldirset Routines for storing, fetching, and searching for ical
  21. * objects in a database */
  22. typedef struct icaldirset_impl icaldirset;
  23. LIBICAL_ICALSS_EXPORT icalset *icaldirset_new(const char *path);
  24. LIBICAL_ICALSS_EXPORT icalset *icaldirset_new_reader(const char *path);
  25. LIBICAL_ICALSS_EXPORT icalset *icaldirset_new_writer(const char *path);
  26. LIBICAL_ICALSS_EXPORT icalset *icaldirset_init(icalset *set, const char *dsn, void *options);
  27. LIBICAL_ICALSS_EXPORT void icaldirset_free(icalset *set);
  28. LIBICAL_ICALSS_EXPORT const char *icaldirset_path(icalset *set);
  29. /* Mark the cluster as changed, so it will be written to disk when it
  30. is freed. Commit writes to disk immediately*/
  31. LIBICAL_ICALSS_EXPORT void icaldirset_mark(icalset *set);
  32. LIBICAL_ICALSS_EXPORT icalerrorenum icaldirset_commit(icalset *set);
  33. LIBICAL_ICALSS_EXPORT icalerrorenum icaldirset_add_component(icalset *store, icalcomponent *comp);
  34. LIBICAL_ICALSS_EXPORT icalerrorenum icaldirset_remove_component(icalset *store,
  35. icalcomponent *comp);
  36. LIBICAL_ICALSS_EXPORT int icaldirset_count_components(icalset *store, icalcomponent_kind kind);
  37. /* Restrict the component returned by icaldirset_first, _next to those
  38. that pass the gauge. _clear removes the gauge. */
  39. LIBICAL_ICALSS_EXPORT icalerrorenum icaldirset_select(icalset *store, icalgauge *gauge);
  40. LIBICAL_ICALSS_EXPORT void icaldirset_clear(icalset *store);
  41. /* Get a component by uid */
  42. LIBICAL_ICALSS_EXPORT icalcomponent *icaldirset_fetch(icalset *store,
  43. icalcomponent_kind kind, const char *uid);
  44. LIBICAL_ICALSS_EXPORT int icaldirset_has_uid(icalset *store, const char *uid);
  45. LIBICAL_ICALSS_EXPORT icalcomponent *icaldirset_fetch_match(icalset *set, icalcomponent *c);
  46. /* Modify components according to the MODIFY method of CAP. Works on
  47. the currently selected components. */
  48. LIBICAL_ICALSS_EXPORT icalerrorenum icaldirset_modify(icalset *store,
  49. icalcomponent *oldc, icalcomponent *newc);
  50. /* Iterate through the components. If a gauge has been defined, these
  51. will skip over components that do not pass the gauge */
  52. LIBICAL_ICALSS_EXPORT icalcomponent *icaldirset_get_current_component(icalset *store);
  53. LIBICAL_ICALSS_EXPORT icalcomponent *icaldirset_get_first_component(icalset *store);
  54. LIBICAL_ICALSS_EXPORT icalcomponent *icaldirset_get_next_component(icalset *store);
  55. /* External iterator for thread safety */
  56. LIBICAL_ICALSS_EXPORT icalsetiter icaldirset_begin_component(icalset *set,
  57. icalcomponent_kind kind,
  58. icalgauge *gauge, const char *tzid);
  59. LIBICAL_ICALSS_EXPORT icalcomponent *icaldirsetiter_to_next(icalset *set, icalsetiter *i);
  60. LIBICAL_ICALSS_EXPORT icalcomponent *icaldirsetiter_to_prior(icalset *set, icalsetiter *i);
  61. typedef struct icaldirset_options
  62. {
  63. int flags; /**< flags corresponding to the open() system call O_RDWR, etc. */
  64. } icaldirset_options;
  65. #endif /* !ICALDIRSET_H */