Libical API Documentation  3.0
vcomponent_cxx.h
Go to the documentation of this file.
1 
20 #ifndef ICAL_VCOMPONENT_CXX_H
21 #define ICAL_VCOMPONENT_CXX_H
22 
23 #include "libical_ical_export.h"
24 #include "icptrholder_cxx.h"
25 
26 extern "C"
27 {
28 #include "icalerror.h"
29 #include "icalcomponent.h"
30 }
31 
32 #include <string>
33 
34 namespace LibICal
35 {
36 
37 class ICalProperty;
38 
47 class LIBICAL_ICAL_EXPORT VComponent
48 {
49 public:
50  VComponent();
51  VComponent(const VComponent &);
52  VComponent &operator=(const VComponent &);
53  virtual ~VComponent();
54 
55  explicit VComponent(icalcomponent *v);
56  explicit VComponent(const std::string &str);
57  explicit VComponent(const icalcomponent_kind &kind);
58 
59  operator icalcomponent *()
60  {
61  return imp;
62  }
63 
64  void new_from_string(const std::string &str);
65 
66  // detach imp to this object. use with caution. it would cause
67  // memory leak if you are not careful.
68  void detach();
69 
70 public:
71  std::string as_ical_string();
72  bool is_valid();
73  icalcomponent_kind isa();
74  int isa_component(void *component);
75 
77  void add_property(ICalProperty *property);
78  void remove_property(ICalProperty *property);
79  int count_properties(const icalproperty_kind &kind);
80 
81  // Iterate through the properties
82  ICalProperty *get_current_property();
83  ICalProperty *get_first_property(const icalproperty_kind &kind);
84  ICalProperty *get_next_property(const icalproperty_kind &kind);
85 
86  // Working with components
87 
93  VComponent *get_inner();
94 
95  void add_component(VComponent *child);
96  void remove_component(VComponent *child);
97  int count_components(const icalcomponent_kind &kind);
98 
107  VComponent *get_current_component();
109  VComponent *get_first_component(const icalcomponent_kind &kind);
110  VComponent *get_next_component(const icalcomponent_kind &kind);
111 
113  icalcompiter begin_component(const icalcomponent_kind &kind);
114  icalcompiter end_component(const icalcomponent_kind &kind);
115  VComponent *next(icalcompiter *i);
116  VComponent *prev(icalcompiter *i);
117  VComponent *current(icalcompiter *i);
118 
120  int count_errors();
121 
123  void strip_errors();
124 
126  void convert_errors();
127 
129  static icalcomponent_kind string_to_kind(const std::string &str);
130  static std::string kind_to_string(const icalcomponent_kind &kind);
131 
132 public:
133  struct icaltimetype get_dtstart() const;
134  void set_dtstart(const struct icaltimetype &v);
135 
147  struct icaltimetype get_dtend() const;
148  void set_dtend(const struct icaltimetype &v);
149 
150  struct icaltimetype get_due() const;
151  void set_due(const struct icaltimetype &v);
152 
153  struct icaldurationtype get_duration() const;
154  void set_duration(const struct icaldurationtype &v);
155 
156  icalproperty_method get_method() const;
157  void set_method(const icalproperty_method &method);
158 
159  struct icaltimetype get_dtstamp() const;
160  void set_dtstamp(const struct icaltimetype &v);
161 
162  std::string get_summary() const;
163  void set_summary(const std::string &v);
164 
165  std::string get_location() const;
166  void set_location(const std::string &v);
167 
168  std::string get_description() const;
169  void set_description(const std::string &v);
170 
171  std::string get_comment() const;
172  void set_comment(const std::string &v);
173 
174  std::string get_uid() const;
175  void set_uid(const std::string &v);
176 
177  std::string get_relcalid() const;
178  void set_relcalid(const std::string &v);
179 
180  struct icaltimetype get_recurrenceid() const;
181  void set_recurrenceid(const struct icaltimetype &v);
182 
183  int get_sequence() const;
184  void set_sequence(const int &v);
185 
186  int get_status() const;
187  void set_status(const enum icalproperty_status &v);
188 
189 public:
194  VComponent *get_first_real_component();
195 
200  virtual struct icaltime_span get_span();
201 
202  int recurrence_is_excluded(struct icaltimetype *dtstart, struct icaltimetype *recurtime);
203 
204 public:
205  /* helper functions for adding/removing/updating property and sub-components */
206 
208 
209  bool remove(VComponent &, bool ignoreValue);
210  bool update(VComponent &, bool removeMissing);
211  bool add(VComponent &);
212 
213 private:
214  /* Internal operations. They are private, and you should not be using them. */
215  VComponent *get_parent();
216  void set_parent(VComponent *parent);
217 
218  char *quote_ical_string(char *str);
219 
220 private:
221  icalcomponent *imp;
222 };
223 
224 class LIBICAL_ICAL_EXPORT VCalendar: public VComponent
225 {
226 public:
227  VCalendar();
228  VCalendar(const VCalendar &);
229  VCalendar &operator=(const VCalendar &);
230  ~VCalendar();
231 
232  explicit VCalendar(icalcomponent *v);
233  explicit VCalendar(const std::string &str);
234 };
235 
236 class LIBICAL_ICAL_EXPORT VEvent: public VComponent
237 {
238 public:
239  VEvent();
240  VEvent(const VEvent &);
241  VEvent &operator=(const VEvent &);
242  ~VEvent();
243 
244  explicit VEvent(icalcomponent *v);
245  explicit VEvent(const std::string &str);
246 };
247 
248 class LIBICAL_ICAL_EXPORT VToDo: public VComponent
249 {
250 public:
251  VToDo();
252  VToDo(const VToDo &);
253  VToDo &operator=(const VToDo &);
254  ~VToDo();
255 
256  explicit VToDo(icalcomponent *v);
257  explicit VToDo(const std::string &str);
258 };
259 
260 class LIBICAL_ICAL_EXPORT VAgenda: public VComponent
261 {
262 public:
263  VAgenda();
264  VAgenda(const VAgenda &);
265  VAgenda &operator=(const VAgenda &);
266  ~VAgenda();
267 
268  explicit VAgenda(icalcomponent *v);
269  explicit VAgenda(const std::string &str);
270 };
271 
272 class LIBICAL_ICAL_EXPORT VQuery: public VComponent
273 {
274 public:
275  VQuery();
276  VQuery(const VQuery &);
277  VQuery &operator=(const VQuery &);
278  ~VQuery();
279 
280  explicit VQuery(icalcomponent *v);
281  explicit VQuery(const std::string &str);
282 };
283 
284 class LIBICAL_ICAL_EXPORT VJournal: public VComponent
285 {
286 public:
287  VJournal();
288  VJournal(const VJournal &);
289  VJournal &operator=(const VJournal &);
290  ~VJournal();
291 
292  explicit VJournal(icalcomponent *v);
293  explicit VJournal(const std::string &str);
294 };
295 
296 class LIBICAL_ICAL_EXPORT VAlarm: public VComponent
297 {
298 public:
299  VAlarm();
300  VAlarm(const VAlarm &);
301  VAlarm &operator=(const VAlarm &);
302  ~VAlarm();
303 
304  explicit VAlarm(icalcomponent *v);
305  explicit VAlarm(const std::string &str);
306 
312  icalrequeststatus getTriggerTime(VComponent &c, struct icaltriggertype *tr);
313 };
314 
315 class LIBICAL_ICAL_EXPORT VFreeBusy: public VComponent
316 {
317 public:
318  VFreeBusy();
319  VFreeBusy(const VFreeBusy &);
320  VFreeBusy &operator=(const VFreeBusy &);
321  ~VFreeBusy();
322 
323  explicit VFreeBusy(icalcomponent *v);
324  explicit VFreeBusy(const std::string &str);
325 };
326 
327 class LIBICAL_ICAL_EXPORT VTimezone: public VComponent
328 {
329 public:
330  VTimezone();
331  VTimezone(const VTimezone &);
332  VTimezone &operator=(const VTimezone &);
333  ~VTimezone();
334 
335  explicit VTimezone(icalcomponent *v);
336  explicit VTimezone(const std::string &str);
337 };
338 
339 class LIBICAL_ICAL_EXPORT XStandard: public VComponent
340 {
341 public:
342  XStandard();
343  XStandard(const XStandard &);
344  XStandard &operator=(const XStandard &);
345  ~XStandard();
346 
347  explicit XStandard(icalcomponent *v);
348  explicit XStandard(const std::string &str);
349 };
350 
351 class LIBICAL_ICAL_EXPORT XDaylight: public VComponent
352 {
353 public:
354  XDaylight();
355  XDaylight(const XDaylight &);
356  XDaylight &operator=(const XDaylight &);
357  ~XDaylight();
358 
359  explicit XDaylight(icalcomponent *v);
360  explicit XDaylight(const std::string &str);
361 };
362 
363 } // namespace LibICal;
364 
366 
367 #endif /* ICAL_VCOMPONENT_H */
Definition: icalparameter_cxx.h:34
Definition: icaltime.h:95
Definition: vcomponent_cxx.h:339
Definition: vcomponent_cxx.h:272
Definition: icalproperty_cxx.h:40
Definition: vcomponent_cxx.h:248
Definition: icptrholder_cxx.h:47
Error handling for libical.
A struct representing a duration.
Definition: icalduration.h:36
Definition: icaltypes.h:39
Definition: icalcomponent.c:35
Definition: icalcomponent.h:35
Definition: icaltime.h:104
C++ template classes for managing C++ pointers returned by VComponent::get_..._component, VComponent::get_..._property, ICalProperty::get_..._value.
Definition: vcomponent_cxx.h:224
Definition: vcomponent_cxx.h:315
Definition: vcomponent_cxx.h:327
Definition: vcomponent_cxx.h:296
Definition: vcomponent_cxx.h:351
Definition: vcomponent_cxx.h:236
Definition: vcomponent_cxx.h:284
Definition: vcomponent_cxx.h:260
A class wrapping the libical icalcomponent functions.
Definition: vcomponent_cxx.h:47