$darkmode
Libical API Documentation 4.0 STABLE VERSION Visit the v3.0 documentation
vcomponent_cxx.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2001, Critical Path
3  * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
4  */
5 
12 #ifndef ICAL_VCOMPONENT_CXX_H
13 #define ICAL_VCOMPONENT_CXX_H
14 
15 #include "libical_ical_export.h"
16 #include "icptrholder_cxx.hpp"
17 
18 extern "C" {
19 #include "icalcomponent.h"
20 }
21 
22 #include <string>
23 
24 namespace LibICal
25 {
26 
27 class ICalProperty;
28 
37 class LIBICAL_ICAL_EXPORT VComponent
38 {
39 public:
40  VComponent();
41  VComponent(const VComponent &);
42  VComponent &operator=(const VComponent &);
43  virtual ~VComponent();
44 
45  explicit VComponent(icalcomponent *v);
46  explicit VComponent(const std::string &str);
47  explicit VComponent(const icalcomponent_kind &kind);
48 
49  operator icalcomponent *()
50  {
51  return imp;
52  }
53 
54  void new_from_string(const std::string &str);
55 
56  // detach imp to this object. use with caution. it would cause
57  // memory leak if you are not careful.
58  void detach();
59 
60  std::string as_ical_string();
61  bool is_valid();
62  icalcomponent_kind isa();
63  bool isa_component(const void *component);
64 
66  void add_property(ICalProperty *property);
67  void remove_property(ICalProperty *property);
68  int count_properties(const icalproperty_kind &kind);
69 
70  // Iterate through the properties
71  ICalProperty *get_current_property();
72  ICalProperty *get_first_property(const icalproperty_kind &kind);
73  ICalProperty *get_next_property(const icalproperty_kind &kind);
74 
75  // Working with components
76 
82  VComponent *get_inner();
83 
84  void add_component(VComponent *child);
85  void remove_component(VComponent *child);
86  int count_components(const icalcomponent_kind &kind);
87 
96  VComponent *get_current_component();
98  VComponent *get_first_component(const icalcomponent_kind &kind);
99  VComponent *get_next_component(const icalcomponent_kind &kind);
100 
102  icalcompiter begin_component(const icalcomponent_kind &kind);
103  icalcompiter end_component(const icalcomponent_kind &kind);
104  static VComponent *next(icalcompiter *i);
105  static VComponent *prev(icalcompiter *i);
106  static VComponent *current(icalcompiter *i);
107 
109  int count_errors();
110 
112  void strip_errors();
113 
115  void convert_errors();
116 
118  static icalcomponent_kind string_to_kind(const std::string &str);
119  static std::string kind_to_string(const icalcomponent_kind &kind);
120 
121  struct icaltimetype get_dtstart() const;
122  void set_dtstart(const struct icaltimetype &v);
123 
135  struct icaltimetype get_dtend() const;
136  void set_dtend(const struct icaltimetype &v);
137 
138  struct icaltimetype get_due() const;
139  void set_due(const struct icaltimetype &v);
140 
141  struct icaldurationtype get_duration() const;
142  void set_duration(const struct icaldurationtype &v);
143 
144  icalproperty_method get_method() const;
145  void set_method(const icalproperty_method &method);
146 
147  struct icaltimetype get_dtstamp() const;
148  void set_dtstamp(const struct icaltimetype &v);
149 
150  std::string get_summary() const;
151  void set_summary(const std::string &v);
152 
153  std::string get_location() const;
154  void set_location(const std::string &v);
155 
156  std::string get_description() const;
157  void set_description(const std::string &v);
158 
159  std::string get_comment() const;
160  void set_comment(const std::string &v);
161 
162  std::string get_uid() const;
163  void set_uid(const std::string &v);
164 
165  std::string get_relcalid() const;
166  void set_relcalid(const std::string &v);
167 
168  struct icaltimetype get_recurrenceid() const;
169  void set_recurrenceid(const struct icaltimetype &v);
170 
171  int get_sequence() const;
172  void set_sequence(const int &v);
173 
179  int get_status() const;
180  void set_status(const enum icalproperty_status &v);
181 
186  VComponent *get_first_real_component();
187 
192  virtual struct icaltime_span get_span();
193 
194  bool recurrence_is_excluded(struct icaltimetype *dtstart, struct icaltimetype *recurtime);
195 
196  /* helper functions for adding/removing/updating property and sub-components */
197 
199 
200  bool remove(VComponent &, bool ignoreValue);
201  bool update(VComponent &, bool removeMissing);
202  bool add(VComponent &);
203 
204 private:
205  icalcomponent *imp;
206 };
207 
208 class LIBICAL_ICAL_EXPORT VCalendar : public VComponent
209 {
210 public:
211  VCalendar();
212  VCalendar(const VCalendar &);
213  VCalendar &operator=(const VCalendar &);
214  ~VCalendar() override;
215 
216  explicit VCalendar(icalcomponent *v);
217  explicit VCalendar(const std::string &str);
218 };
219 
220 class LIBICAL_ICAL_EXPORT VEvent : public VComponent
221 {
222 public:
223  VEvent();
224  VEvent(const VEvent &);
225  VEvent &operator=(const VEvent &);
226  ~VEvent() override;
227 
228  explicit VEvent(icalcomponent *v);
229  explicit VEvent(const std::string &str);
230 };
231 
232 class LIBICAL_ICAL_EXPORT VToDo : public VComponent
233 {
234 public:
235  VToDo();
236  VToDo(const VToDo &);
237  VToDo &operator=(const VToDo &);
238  ~VToDo() override;
239 
240  explicit VToDo(icalcomponent *v);
241  explicit VToDo(const std::string &str);
242 };
243 
244 class LIBICAL_ICAL_EXPORT VAgenda : public VComponent
245 {
246 public:
247  VAgenda();
248  VAgenda(const VAgenda &);
249  VAgenda &operator=(const VAgenda &);
250  ~VAgenda() override;
251 
252  explicit VAgenda(icalcomponent *v);
253  explicit VAgenda(const std::string &str);
254 };
255 
256 class LIBICAL_ICAL_EXPORT VQuery : public VComponent
257 {
258 public:
259  VQuery();
260  VQuery(const VQuery &);
261  VQuery &operator=(const VQuery &);
262  ~VQuery() override;
263 
264  explicit VQuery(icalcomponent *v);
265  explicit VQuery(const std::string &str);
266 };
267 
268 class LIBICAL_ICAL_EXPORT VJournal : public VComponent
269 {
270 public:
271  VJournal();
272  VJournal(const VJournal &);
273  VJournal &operator=(const VJournal &);
274  ~VJournal() override;
275 
276  explicit VJournal(icalcomponent *v);
277  explicit VJournal(const std::string &str);
278 };
279 
280 class LIBICAL_ICAL_EXPORT VAlarm : public VComponent
281 {
282 public:
283  VAlarm();
284  VAlarm(const VAlarm &);
285  VAlarm &operator=(const VAlarm &);
286  ~VAlarm() override;
287 
288  explicit VAlarm(icalcomponent *v);
289  explicit VAlarm(const std::string &str);
290 
296  icalrequeststatus getTriggerTime(VComponent &c, struct icaltriggertype *tr);
297 };
298 
299 class LIBICAL_ICAL_EXPORT VFreeBusy : public VComponent
300 {
301 public:
302  VFreeBusy();
303  VFreeBusy(const VFreeBusy &);
304  VFreeBusy &operator=(const VFreeBusy &);
305  ~VFreeBusy() override;
306 
307  explicit VFreeBusy(icalcomponent *v);
308  explicit VFreeBusy(const std::string &str);
309 };
310 
311 class LIBICAL_ICAL_EXPORT VTimezone : public VComponent
312 {
313 public:
314  VTimezone();
315  VTimezone(const VTimezone &);
316  VTimezone &operator=(const VTimezone &);
317  ~VTimezone() override;
318 
319  explicit VTimezone(icalcomponent *v);
320  explicit VTimezone(const std::string &str);
321 };
322 
323 class LIBICAL_ICAL_EXPORT XStandard : public VComponent
324 {
325 public:
326  XStandard();
327  XStandard(const XStandard &);
328  XStandard &operator=(const XStandard &);
329  ~XStandard() override;
330 
331  explicit XStandard(icalcomponent *v);
332  explicit XStandard(const std::string &str);
333 };
334 
335 class LIBICAL_ICAL_EXPORT XDaylight : public VComponent
336 {
337 public:
338  XDaylight();
339  XDaylight(const XDaylight &);
340  XDaylight &operator=(const XDaylight &);
341  ~XDaylight() override;
342 
343  explicit XDaylight(icalcomponent *v);
344  explicit XDaylight(const std::string &str);
345 };
346 
347 } // namespace LibICal;
348 
350 
351 #endif /* ICAL_VCOMPONENT_H */
C++ template classes for managing C++ pointers returned by VComponent::get_..._component, VComponent::get_..._property, ICalProperty::get_..._value.
Defines the data structure for iCalendar components.
icalcomponent_kind
Definition: icalenums.h:28
icalrequeststatus
Definition: icalenums.h:78
A class wrapping the libical icalcomponent functions.