icalfileset.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*======================================================================
  2. FILE: icalfileset.h
  3. CREATOR: eric 23 December 1999
  4. (C) COPYRIGHT 2000, Eric Busboom <eric@softwarestudio.org>
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of either:
  7. The LGPL as published by the Free Software Foundation, version
  8. 2.1, available at: http://www.gnu.org/licenses/lgpl-2.1.html
  9. Or:
  10. The Mozilla Public License Version 1.0. You may obtain a copy of
  11. the License at http://www.mozilla.org/MPL/
  12. The Original Code is eric. The Initial Developer of the Original
  13. Code is Eric Busboom
  14. ======================================================================*/
  15. #ifndef ICALFILESET_H
  16. #define ICALFILESET_H
  17. #include "libical_icalss_export.h"
  18. #include "icalcluster.h"
  19. #include "icalset.h"
  20. typedef struct icalfileset_impl icalfileset;
  21. LIBICAL_ICALSS_EXPORT icalset *icalfileset_new(const char *path);
  22. LIBICAL_ICALSS_EXPORT icalset *icalfileset_new_reader(const char *path);
  23. LIBICAL_ICALSS_EXPORT icalset *icalfileset_new_writer(const char *path);
  24. LIBICAL_ICALSS_EXPORT icalset *icalfileset_init(icalset *set, const char *dsn, void *options);
  25. LIBICAL_ICALSS_EXPORT icalfileset *icalfileset_new_from_cluster(const char *path,
  26. icalcluster *cluster);
  27. LIBICAL_ICALSS_EXPORT icalcluster *icalfileset_produce_icalcluster(const char *path);
  28. LIBICAL_ICALSS_EXPORT void icalfileset_free(icalset *cluster);
  29. LIBICAL_ICALSS_EXPORT const char *icalfileset_path(icalset *cluster);
  30. /* Mark the cluster as changed, so it will be written to disk when it
  31. is freed. Commit writes to disk immediately. */
  32. LIBICAL_ICALSS_EXPORT void icalfileset_mark(icalset *set);
  33. LIBICAL_ICALSS_EXPORT icalerrorenum icalfileset_commit(icalset *set);
  34. LIBICAL_ICALSS_EXPORT icalerrorenum icalfileset_add_component(icalset *set, icalcomponent *child);
  35. LIBICAL_ICALSS_EXPORT icalerrorenum icalfileset_remove_component(icalset *set,
  36. icalcomponent *child);
  37. LIBICAL_ICALSS_EXPORT int icalfileset_count_components(icalset *set, icalcomponent_kind kind);
  38. /**
  39. * Restrict the component returned by icalfileset_first, _next to those
  40. * that pass the gauge. _clear removes the gauge
  41. */
  42. LIBICAL_ICALSS_EXPORT icalerrorenum icalfileset_select(icalset *set, icalgauge *gauge);
  43. /** clear the gauge **/
  44. LIBICAL_ICALSS_EXPORT void icalfileset_clear(icalset *set);
  45. /** Get and search for a component by uid **/
  46. LIBICAL_ICALSS_EXPORT icalcomponent *icalfileset_fetch(icalset *set,
  47. icalcomponent_kind kind, const char *uid);
  48. LIBICAL_ICALSS_EXPORT int icalfileset_has_uid(icalset *set, const char *uid);
  49. LIBICAL_ICALSS_EXPORT icalcomponent *icalfileset_fetch_match(icalset *set, icalcomponent *c);
  50. /**
  51. * Modify components according to the MODIFY method of CAP. Works on the
  52. * currently selected components.
  53. */
  54. LIBICAL_ICALSS_EXPORT icalerrorenum icalfileset_modify(icalset *set,
  55. icalcomponent *oldcomp,
  56. icalcomponent *newcomp);
  57. /* Iterate through components. If a gauge has been defined, these
  58. will skip over components that do not pass the gauge */
  59. LIBICAL_ICALSS_EXPORT icalcomponent *icalfileset_get_current_component(icalset *cluster);
  60. LIBICAL_ICALSS_EXPORT icalcomponent *icalfileset_get_first_component(icalset *cluster);
  61. LIBICAL_ICALSS_EXPORT icalcomponent *icalfileset_get_next_component(icalset *cluster);
  62. /* External iterator for thread safety */
  63. LIBICAL_ICALSS_EXPORT icalsetiter icalfileset_begin_component(icalset *set,
  64. icalcomponent_kind kind,
  65. icalgauge *gauge, const char *tzid);
  66. LIBICAL_ICALSS_EXPORT icalcomponent *icalfilesetiter_to_next(icalset *set, icalsetiter *iter);
  67. LIBICAL_ICALSS_EXPORT icalcomponent *icalfileset_form_a_matched_recurrence_component(icalsetiter *
  68. itr);
  69. /** Return a reference to the internal component. You probably should
  70. not be using this. */
  71. LIBICAL_ICALSS_EXPORT icalcomponent *icalfileset_get_component(icalset *cluster);
  72. /**
  73. * @brief options for opening an icalfileset.
  74. *
  75. * These options should be passed to the icalset_new() function
  76. */
  77. typedef struct icalfileset_options
  78. {
  79. int flags; /**< flags for open() O_RDONLY, etc */
  80. int mode; /**< file mode */
  81. int safe_saves; /**< to lock or not */
  82. icalcluster *cluster; /**< use this cluster to initialize data */
  83. } icalfileset_options;
  84. extern icalfileset_options icalfileset_options_default;
  85. #endif /* !ICALFILESET_H */