Set license using %license
[platform/upstream/libical.git] / src / libicalss / icalspanlist_cxx.h
1 /* -*- Mode: C++ -*- */
2
3 /**
4  * @file     icalspanlist_cxx.h
5  * @author   Critical Path
6  * @brief    C++ class wrapping the icalspanlist data structure
7  *
8  * This class wraps the icalspanlist routines in libicalss
9  *
10  * Errors within libicalss are propagated via exceptions of type
11  * icalerrorenum.  See icalerror.h for the complete list of exceptions
12  * that might be thrown.
13  */
14
15 #ifndef ICALSPANLIST_CXX_H
16 #define ICALSPANLIST_CXX_H
17
18 #include <libical/ical.h>
19 #include <libicalss/icalset.h>
20 #include <libicalss/icalspanlist.h>
21 #include "vcomponent.h"
22 #include <vector>               /* For as_matrix.. */
23
24 class ICalSpanList {
25  public:
26   /** Construct an ICalSpanList from an icalset */
27   ICalSpanList(icalset *set, icaltimetype start, icaltimetype end) throw(icalerrorenum);
28
29   /** Construct an ICalSpanList from the VFREEBUSY chunk of a icalcomponent */
30   ICalSpanList(icalcomponent *comp) throw(icalerrorenum);
31
32   /** Construct an ICalSpanList from the VFREEBUSY chunk of a vcomponent */
33   ICalSpanList(VComponent &comp) throw(icalerrorenum);
34
35   /** Destructor */
36   ~ICalSpanList();
37
38   /** Return a VFREEBUSY icalcomponent */
39   VComponent* get_vfreebusy(const char *organizer, const char *attendee) throw(icalerrorenum);
40
41   /** Return the base data when casting */
42   operator icalspanlist*()    {return data;}
43
44   /** Return a vector of the number of events over delta t */
45   std::vector<int> as_vector(int delta_t) throw(icalerrorenum);
46
47   /** Dump the spanlist to stdout */
48   void dump()                 {icalspanlist_dump(data);}
49
50  private:
51   icalspanlist *data;
52 };
53
54 #endif