aboutsummaryrefslogtreecommitdiffstats
path: root/libical/src/libicalss/icalspanlist_cxx.h
blob: cf81f13003af6fa6ba97e8ba6a7841e5d3caeae3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* -*- Mode: C++ -*- */

/**
 * @file     icalspanlist_cxx.h
 * @author   Critical Path
 * @brief    C++ class wrapping the icalspanlist data structure
 *
 * This class wraps the icalspanlist routines in libicalss
 *
 * Errors within libicalss are propagated via exceptions of type
 * icalerrorenum.  See icalerror.h for the complete list of exceptions
 * that might be thrown.
 */

#ifndef ICALSPANLIST_CXX_H
#define ICALSPANLIST_CXX_H

#include <libical/ical.h>
#include <libicalss/icalss.h>
#include "vcomponent.h"
#include <vector>       /* For as_matrix.. */

class ICalSpanList {
 public:
  /** Construct an ICalSpanList from an icalset */
  ICalSpanList(icalset *set, icaltimetype start, icaltimetype end) throw(icalerrorenum);

  /** Construct an ICalSpanList from the VFREEBUSY chunk of a icalcomponent */
  ICalSpanList(icalcomponent *comp) throw(icalerrorenum);

  /** Construct an ICalSpanList from the VFREEBUSY chunk of a vcomponent */
  ICalSpanList(VComponent &comp) throw(icalerrorenum);

  /** Destructor */
  ~ICalSpanList();

  /** Return a VFREEBUSY icalcomponent */
  VComponent* get_vfreebusy(const char *organizer, const char *attendee) throw(icalerrorenum);

  /** Return the base data when casting */
  operator icalspanlist*()    {return data;}

  /** Return a vector of the number of events over delta t */
  std::vector<int> as_vector(int delta_t) throw(icalerrorenum);

  /** Dump the spanlist to stdout */
  void dump()                 {icalspanlist_dump(data);}

 private:
  icalspanlist *data;
};

#endif