Back to index

lightning-sunbird  0.9+nobinonly
vcomponent.h
Go to the documentation of this file.
00001 /* -*- Mode: C++ -*- */
00002 
00011 #ifndef VCOMPONENT_H
00012 #define VCOMPONENT_H
00013 
00014 #include "ical.h"
00015 #include "icptrholder.h"
00016 
00017 typedef       char* string; // Will use the string library from STL
00018 
00019 class ICalProperty;
00020 
00029 class VComponent {
00030 public:
00031        VComponent()                             throw (icalerrorenum);
00032        VComponent(const VComponent&)            throw (icalerrorenum);
00033        VComponent& operator=(const VComponent&) throw (icalerrorenum);
00034        virtual ~VComponent();
00035 
00036        VComponent(icalcomponent* v)        throw (icalerrorenum);
00037        VComponent(string str)              throw (icalerrorenum);
00038        VComponent(icalcomponent_kind kind) throw (icalerrorenum);;
00039 
00040        operator icalcomponent* () { return imp; }
00041 
00042        void new_from_string(string str);
00043 
00044        // detach imp to this object. use with caution. it would cause
00045        // memory leak if you are not careful.
00046        void detach() {
00047            imp = NULL;
00048        }
00049 
00050 public:
00051        string as_ical_string() throw (icalerrorenum);
00052        bool is_valid();
00053        icalcomponent_kind isa();
00054        int isa_component(void* component);
00055 
00057        void add_property(ICalProperty* property);
00058        void remove_property(ICalProperty* property);
00059        int count_properties(icalproperty_kind kind);
00060 
00061        // Iterate through the properties
00062        ICalProperty* get_current_property();
00063        ICalProperty* get_first_property(icalproperty_kind kind);
00064        ICalProperty* get_next_property(icalproperty_kind kind);
00065 
00066        // Working with components
00067 
00073        VComponent* get_inner();
00074 
00075        void add_component(VComponent* child);
00076        void remove_component(VComponent* child);
00077        int count_components(icalcomponent_kind kind);
00078 
00087 
00088        VComponent* get_current_component();
00089        VComponent* get_first_component(icalcomponent_kind kind);
00090        VComponent* get_next_component(icalcomponent_kind kind);
00091 
00093        icalcompiter begin_component(icalcomponent_kind kind);
00094        icalcompiter end_component(icalcomponent_kind kind);
00095        VComponent* next(icalcompiter* i);
00096        VComponent* prev(icalcompiter* i);
00097        VComponent* current(icalcompiter* i);
00098 
00100        int count_errors();
00101 
00103        void strip_errors();
00104 
00106        void convert_errors();
00107 
00109        static icalcomponent_kind string_to_kind(string str);
00110        static string kind_to_string(icalcomponent_kind kind);
00111 
00112 public:
00113        struct icaltimetype get_dtstart();
00114        void set_dtstart(struct icaltimetype v);
00115 
00127        struct icaltimetype get_dtend();
00128        void set_dtend(struct icaltimetype v);
00129 
00130         struct icaltimetype get_due();
00131         void set_due(struct icaltimetype v);
00132 
00133        struct icaldurationtype get_duration();
00134        void set_duration(struct icaldurationtype v);
00135 
00136        icalproperty_method get_method();
00137        void set_method(icalproperty_method method);
00138 
00139        struct icaltimetype get_dtstamp();
00140        void set_dtstamp(struct icaltimetype v);
00141 
00142        string get_summary();
00143        void set_summary(string v);
00144 
00145         string get_location();
00146         void set_location(string v);
00147 
00148         string get_description();
00149         void set_description(string v);
00150 
00151        string get_comment();
00152        void set_comment(string v);
00153 
00154        string get_uid();
00155        void set_uid(string v);
00156 
00157        string get_relcalid();
00158        void set_relcalid(string v);
00159 
00160        struct icaltimetype get_recurrenceid();
00161        void set_recurrenceid(struct icaltimetype v);
00162 
00163         int get_sequence();
00164         void set_sequence(int v);
00165 
00166         int get_status();
00167         void set_status(enum icalproperty_status v);
00168 
00169 
00170 public:
00175        VComponent* get_first_real_component();
00176 
00181        virtual struct icaltime_span get_span();
00182 
00183         int recurrence_is_excluded(struct icaltimetype *dtstart,
00184                                    struct icaltimetype *recurtime);
00185 
00186 
00187 public:
00192 
00193 
00194        bool remove(VComponent&, bool ignoreValue);
00195        bool update(VComponent&, bool removeMissing);
00196        bool add(VComponent&);
00197 
00198 private:
00199        /* Internal operations. They are private, and you should not be using them. */
00200        VComponent* get_parent();
00201        void set_parent(VComponent *parent);
00202 
00203         char* quote_ical_string(char* str);
00204 
00205 private:
00206        icalcomponent* imp;
00207 };
00208 
00209 class VCalendar : public VComponent {
00210 public:
00211        VCalendar();
00212        VCalendar(const VCalendar&);
00213        VCalendar& operator=(const VCalendar&);
00214        ~VCalendar();
00215 
00216        VCalendar(icalcomponent* v);
00217        VCalendar(string str);
00218 };
00219 
00220 
00221 class VEvent : public VComponent {
00222 public:
00223        VEvent();
00224        VEvent(const VEvent&);
00225        VEvent& operator=(const VEvent&);
00226        ~VEvent();
00227 
00228        VEvent(icalcomponent* v);
00229        VEvent(string str);
00230 };
00231 
00232 class VToDo : public VComponent {
00233 public:
00234        VToDo();
00235        VToDo(const VToDo&);
00236        VToDo& operator=(const VToDo&);
00237        ~VToDo();
00238 
00239        VToDo(icalcomponent* v);
00240        VToDo(string str);
00241 };
00242 
00243 class VAgenda : public VComponent {
00244 public:
00245         VAgenda();
00246         VAgenda(const VAgenda&);
00247         VAgenda& operator=(const VAgenda&);
00248         ~VAgenda();
00249 
00250        VAgenda(icalcomponent* v);
00251         VAgenda(string str);
00252 };
00253 
00254 class VQuery : public VComponent {
00255 public:
00256        VQuery();
00257        VQuery(const VQuery&);
00258        VQuery& operator=(const VQuery&);
00259        ~VQuery();
00260 
00261        VQuery(icalcomponent* v);
00262        VQuery(string str);
00263 };
00264 
00265 class VJournal : public VComponent {
00266 public:
00267        VJournal();
00268        VJournal(const VJournal&);
00269        VJournal& operator=(const VJournal&);
00270        ~VJournal();
00271 
00272        VJournal(icalcomponent* v);
00273        VJournal(string str);
00274 };
00275 
00276 class VAlarm : public VComponent {
00277 public:
00278        VAlarm();
00279        VAlarm(const VAlarm&);
00280        VAlarm& operator=(const VAlarm&);
00281        ~VAlarm();
00282 
00283        VAlarm(icalcomponent* v);
00284        VAlarm(string str);
00285 
00291        icalrequeststatus getTriggerTime(VComponent &c, struct icaltriggertype *tr);
00292 };
00293 
00294 class VFreeBusy : public VComponent {
00295 public:
00296        VFreeBusy();
00297        VFreeBusy(const VFreeBusy&);
00298        VFreeBusy& operator=(const VFreeBusy&);
00299        ~VFreeBusy();
00300 
00301        VFreeBusy(icalcomponent* v);
00302        VFreeBusy(string str);
00303 };
00304 
00305 class VTimezone : public VComponent {
00306 public:
00307        VTimezone();
00308        VTimezone(const VTimezone&);
00309        VTimezone& operator=(const VTimezone&);
00310        ~VTimezone();
00311 
00312        VTimezone(icalcomponent* v);
00313        VTimezone(string str);
00314 };
00315 
00316 class XStandard : public VComponent {
00317 public:
00318        XStandard();
00319        XStandard(const XStandard&);
00320        XStandard& operator=(const XStandard&);
00321        ~XStandard();
00322 
00323        XStandard(icalcomponent* v);
00324        XStandard(string str);
00325 };
00326 
00327 class XDaylight : public VComponent {
00328 public:
00329        XDaylight();
00330        XDaylight(const XDaylight&);
00331        XDaylight& operator=(const XDaylight&);
00332        ~XDaylight();
00333 
00334        XDaylight(icalcomponent* v);
00335        XDaylight(string str);
00336 };
00337 
00338 typedef ICPointerHolder<VComponent> VComponentTmpPtr; /* see icptrholder.h for comments */
00339 
00340 #endif /* VComponent_H */