icalproperty_cxx.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. /**
  2. * @file icalproperty_cxx.h
  3. * @author fnguyen (12/10/01)
  4. * @brief Definition of C++ Wrapper for icalproperty.c
  5. *
  6. * (C) COPYRIGHT 2001, Critical Path
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of either:
  9. The LGPL as published by the Free Software Foundation, version
  10. 2.1, available at: http://www.gnu.org/licenses/lgpl-2.1.html
  11. Or:
  12. The Mozilla Public License Version 1.0. You may obtain a copy of
  13. the License at http://www.mozilla.org/MPL/
  14. */
  15. #ifndef ICALPROPERTY_CXX_H
  16. #define ICALPROPERTY_CXX_H
  17. #include "libical_ical_export.h"
  18. #include "icptrholder_cxx.h"
  19. extern "C"
  20. {
  21. #include "icalerror.h"
  22. #include "icalproperty.h"
  23. };
  24. #include <string>
  25. namespace LibICal
  26. {
  27. class ICalParameter;
  28. class ICalValue;
  29. class LIBICAL_ICAL_EXPORT ICalProperty
  30. {
  31. public:
  32. ICalProperty();
  33. ICalProperty(const ICalProperty &) throw(icalerrorenum);
  34. ICalProperty & operator=(const ICalProperty &) throw(icalerrorenum);
  35. ~ICalProperty();
  36. explicit ICalProperty(icalproperty *v);
  37. explicit ICalProperty(std::string str);
  38. explicit ICalProperty(icalproperty_kind kind);
  39. ICalProperty(icalproperty_kind kind, std::string str);
  40. operator icalproperty *()
  41. {
  42. return imp;
  43. }
  44. int operator==(ICalProperty & rhs);
  45. void detach();
  46. public:
  47. std::string as_ical_string();
  48. icalproperty_kind isa();
  49. int isa_property(void *property);
  50. void add_parameter(ICalParameter & parameter);
  51. void set_parameter(ICalParameter & parameter);
  52. void set_parameter_from_string(const std::string & name, const std::string & val);
  53. std::string get_parameter_as_string(const std::string & name);
  54. void remove_parameter(const icalparameter_kind & kind);
  55. int count_parameters();
  56. /** Iterate through the parameters */
  57. ICalParameter *get_first_parameter(const icalparameter_kind & kind);
  58. ICalParameter *get_next_parameter(const icalparameter_kind & kind);
  59. /** Access the value of the property */
  60. void set_value(const ICalValue & val);
  61. void set_value_from_string(const std::string & val, const std::string & kind);
  62. ICalValue *get_value();
  63. std::string get_value_as_string();
  64. /** Return the name of the property -- the type name converted
  65. * to a string, or the value of get_x_name if the type is X
  66. * property
  67. */
  68. std::string get_name() const;
  69. public:
  70. /* Deal with X properties */
  71. static void set_x_name(ICalProperty & prop, const std::string & name);
  72. static std::string get_x_name(ICalProperty & prop);
  73. static icalvalue_kind value_to_value_kind(const icalparameter_value & val);
  74. /* Convert kinds to string and get default value type */
  75. static icalvalue_kind kind_to_value_kind(const icalproperty_kind & kind);
  76. static icalproperty_kind value_kind_to_kind(const icalvalue_kind & kind);
  77. static std::string kind_to_string(const icalproperty_kind & kind);
  78. static icalproperty_kind string_to_kind(const std::string & str);
  79. static icalproperty_method string_to_method(const std::string & str);
  80. static std::string method_to_string(const icalproperty_method & method);
  81. static std::string enum_to_string(const int &e);
  82. static int string_to_enum(const std::string & str);
  83. static std::string status_to_string(const icalproperty_status & status);
  84. static icalproperty_status string_to_status(const std::string & str);
  85. static int enum_belongs_to_property(const icalproperty_kind & kind, const int &e);
  86. public:
  87. /* ACTION */
  88. void set_action(const enum icalproperty_action &v);
  89. enum icalproperty_action get_action();
  90. /* ATTACH */
  91. void set_attach(icalattach *v);
  92. icalattach *get_attach() const;
  93. /* ATTENDEE */
  94. void set_attendee(const std::string & val);
  95. std::string get_attendee() const;
  96. /* CALSCALE */
  97. void set_calscale(const std::string & val);
  98. std::string get_calscale() const;
  99. /* CATEGORIES */
  100. void set_categories(const std::string & val);
  101. std::string get_categories() const;
  102. /* CLASS */
  103. void set_class(const enum icalproperty_class &val);
  104. enum icalproperty_class get_class() const;
  105. /* COMMENT */
  106. void set_comment(const std::string & val);
  107. std::string get_comment() const;
  108. /* COMPLETED */
  109. void set_completed(const struct icaltimetype &val);
  110. struct icaltimetype get_completed() const;
  111. /* CONTACT */
  112. void set_contact(const std::string & val);
  113. std::string get_contact() const;
  114. /* CREATED */
  115. void set_created(const struct icaltimetype &val);
  116. struct icaltimetype get_created() const;
  117. /* DESCRIPTION */
  118. void set_description(const std::string & val);
  119. std::string get_description() const;
  120. /* DTEND */
  121. void set_dtend(const struct icaltimetype &val);
  122. struct icaltimetype get_dtend() const;
  123. /* DTSTAMP */
  124. void set_dtstamp(const struct icaltimetype &val);
  125. struct icaltimetype get_dtstamp() const;
  126. /* DTSTART */
  127. void set_dtstart(const struct icaltimetype &val);
  128. struct icaltimetype get_dtstart() const;
  129. /* DUE */
  130. void set_due(const struct icaltimetype &val);
  131. struct icaltimetype get_due() const;
  132. /* DURATION */
  133. void set_duration(const struct icaldurationtype &val);
  134. struct icaldurationtype get_duration() const;
  135. /* EXDATE */
  136. void set_exdate(const struct icaltimetype &val);
  137. struct icaltimetype get_exdate() const;
  138. /* EXPAND */
  139. void set_expand(const int &val);
  140. int get_expand() const;
  141. /* EXRULE */
  142. void set_exrule(const struct icalrecurrencetype &val);
  143. struct icalrecurrencetype get_exrule() const;
  144. /* FREEBUSY */
  145. void set_freebusy(const struct icalperiodtype &val);
  146. struct icalperiodtype get_freebusy() const;
  147. /* GEO */
  148. void set_geo(const struct icalgeotype &val);
  149. struct icalgeotype get_geo() const;
  150. /* GRANT */
  151. void set_grant(const std::string & val);
  152. std::string get_grant() const;
  153. /* LAST-MODIFIED */
  154. void set_lastmodified(const struct icaltimetype &val);
  155. struct icaltimetype get_lastmodified() const;
  156. /* LOCATION */
  157. void set_location(const std::string & val);
  158. std::string get_location() const;
  159. /* MAXRESULTS */
  160. void set_maxresults(const int &val);
  161. int get_maxresults() const;
  162. /* MAXRESULTSSIZE */
  163. void set_maxresultsize(const int &val);
  164. int get_maxresultsize() const;
  165. /* METHOD */
  166. void set_method(const enum icalproperty_method &val);
  167. enum icalproperty_method get_method() const;
  168. /* OWNER */
  169. void set_owner(const std::string & val);
  170. std::string get_owner() const;
  171. /* ORGANIZER */
  172. void set_organizer(const std::string & val);
  173. std::string get_organizer() const;
  174. /* PERCENT-COMPLETE */
  175. void set_percentcomplete(const int &val);
  176. int get_percentcomplete() const;
  177. /* PRIORITY */
  178. void set_priority(const int &val);
  179. int get_priority() const;
  180. /* PRODID */
  181. void set_prodid(const std::string & val);
  182. std::string get_prodid() const;
  183. /* QUERY */
  184. void set_query(const std::string & val);
  185. std::string get_query() const;
  186. /* QUERYNAME */
  187. void set_queryname(const std::string & val);
  188. std::string get_queryname() const;
  189. /* RDATE */
  190. void set_rdate(const struct icaldatetimeperiodtype &val);
  191. struct icaldatetimeperiodtype get_rdate() const;
  192. /* RECURRENCE-ID */
  193. void set_recurrenceid(const struct icaltimetype &val);
  194. struct icaltimetype get_recurrenceid() const;
  195. /* RELATED-TO */
  196. void set_relatedto(const std::string & val);
  197. std::string get_relatedto() const;
  198. /* RELCALID */
  199. void set_relcalid(const std::string & val);
  200. std::string get_relcalid() const;
  201. /* REPEAT */
  202. void set_repeat(const int &val);
  203. int get_repeat() const;
  204. /* REQUEST-STATUS */
  205. void set_requeststatus(const std::string & val);
  206. std::string get_requeststatus() const;
  207. /* RESOURCES */
  208. void set_resources(const std::string & val);
  209. std::string get_resources() const;
  210. /* RRULE */
  211. void set_rrule(const struct icalrecurrencetype &val);
  212. struct icalrecurrencetype get_rrule() const;
  213. /* SCOPE */
  214. void set_scope(const std::string & val);
  215. std::string get_scope() const;
  216. /* SEQUENCE */
  217. void set_sequence(const int &val);
  218. int get_sequence() const;
  219. /* STATUS */
  220. void set_status(const enum icalproperty_status &val);
  221. enum icalproperty_status get_status() const;
  222. /* SUMMARY */
  223. void set_summary(const std::string & val);
  224. std::string get_summary() const;
  225. /* TARGET */
  226. void set_target(const std::string & val);
  227. std::string get_target() const;
  228. /* TRANSP */
  229. void set_transp(const enum icalproperty_transp &val);
  230. enum icalproperty_transp get_transp() const;
  231. /* TRIGGER */
  232. void set_trigger(const struct icaltriggertype &val);
  233. struct icaltriggertype get_trigger() const;
  234. /* TZID */
  235. void set_tzid(const std::string & val);
  236. std::string get_tzid() const;
  237. /* TZNAME */
  238. void set_tzname(const std::string & val);
  239. std::string get_tzname() const;
  240. /* TZOFFSETFROM */
  241. void set_tzoffsetfrom(const int &val);
  242. int get_tzoffsetfrom() const;
  243. /* TZOFFSETTO */
  244. void set_tzoffsetto(const int &val);
  245. int get_tzoffsetto() const;
  246. /* TZURL */
  247. void set_tzurl(const std::string & val);
  248. std::string get_tzurl() const;
  249. /* UID */
  250. void set_uid(const std::string & val);
  251. std::string get_uid() const;
  252. /* URL */
  253. void set_url(const std::string & val);
  254. std::string get_url() const;
  255. /* VERSION */
  256. void set_version(const std::string & val);
  257. std::string get_version() const;
  258. /* X */
  259. void set_x(const std::string & val);
  260. std::string get_x() const;
  261. /* X-LIC-CLUSTERCOUNT */
  262. void set_xlicclustercount(const std::string & val);
  263. std::string get_xlicclustercount() const;
  264. /* X-LIC-ERROR */
  265. void set_xlicerror(const std::string & val);
  266. std::string get_xlicerror() const;
  267. /* X-LIC-MIMECHARSET */
  268. void set_xlicmimecharset(const std::string & val);
  269. std::string get_xlicmimecharset() const;
  270. /* X-LIC-MIMECID */
  271. void set_xlicmimecid(const std::string & val);
  272. std::string get_xlicmimecid() const;
  273. /* X-LIC-MIMECONTENTTYPE */
  274. void set_xlicmimecontenttype(const std::string & val);
  275. std::string get_xlicmimecontenttype() const;
  276. /* X-LIC-MIMEENCODING */
  277. void set_xlicmimeencoding(const std::string & val);
  278. std::string get_xlicmimeencoding() const;
  279. /* X-LIC-MIMEFILENAME */
  280. void set_xlicmimefilename(const std::string & val);
  281. std::string get_xlicmimefilename() const;
  282. /* X-LIC-MIMEOPTINFO */
  283. void set_xlicmimeoptinfo(const std::string & val);
  284. std::string get_xlicmimeoptinfo() const;
  285. private:
  286. icalproperty *imp;
  287. /**< The actual C based icalproperty */
  288. };
  289. } // namespace LibICal
  290. typedef ICPointerHolder < LibICal::ICalProperty > ICalPropertyTmpPtr;
  291. #endif /* ICalProperty_H */