Libical API Documentation
4.0 STABLE VERSION
[Visit the v3.0 documentation]
Toggle main menu visibility
Loading...
Searching...
No Matches
src
libicalss
icalspanlist_cxx.cpp
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
11
12
#include "
icalspanlist_cxx.hpp
"
13
#include "
icalerror.h
"
14
#include "
vcomponent_cxx.hpp
"
15
16
#include <cstdlib>
// for free()
17
#include <vector>
18
19
using namespace
LibICal
;
20
21
ICalSpanList::ICalSpanList
()
22
: data(0)
23
{
24
throw
icalerrno
;
25
}
26
27
ICalSpanList::ICalSpanList
(
const
ICalSpanList
&v)
28
: data(v.data)
29
{
30
if
(data == NULL) {
31
throw
icalerrno
;
32
}
33
}
34
40
ICalSpanList::ICalSpanList
(icalset *set,
const
icaltimetype
&start,
const
icaltimetype
&end)
41
: data(
icalspanlist_new
(set, start, end))
42
{
43
if
(data == NULL) {
44
throw
icalerrno
;
45
}
46
}
47
51
52
ICalSpanList::ICalSpanList
(icalcomponent *comp)
53
: data(
icalspanlist_from_vfreebusy
(comp))
54
{
55
if
(data == NULL) {
56
throw
icalerrno
;
57
}
58
}
59
63
ICalSpanList::ICalSpanList
(
VComponent
&comp)
64
: data(
icalspanlist_from_vfreebusy
(static_cast<icalcomponent *>(comp)))
65
{
66
if
(data == NULL) {
67
throw
icalerrno
;
68
}
69
}
70
71
void
ICalSpanList::dump
()
72
{
73
icalspanlist_dump
(data);
74
}
75
77
ICalSpanList::~ICalSpanList
()
78
{
79
if
(data == NULL) {
80
icalspanlist_free
(data);
81
}
82
}
83
89
90
VComponent
*
ICalSpanList::get_vfreebusy
(
const
char
*organizer,
const
char
*attendee)
91
{
92
icalcomponent *comp;
93
VComponent
*vcomp;
94
95
comp =
icalspanlist_as_vfreebusy
(data, organizer, attendee);
96
if
(comp == NULL) {
97
throw
icalerrno
;
98
}
99
100
vcomp =
new
VComponent
(comp);
101
if
(vcomp == NULL) {
102
throw
icalerrno
;
103
}
104
105
return
vcomp;
106
}
107
119
120
std::vector<int>
ICalSpanList::as_vector
(
int
delta_t)
121
{
122
int
*matrix;
123
const
int
i = 0;
124
std::vector<int> event_vec;
125
126
matrix =
icalspanlist_as_freebusy_matrix
(data, delta_t);
127
128
if
(matrix == NULL) {
129
throw
icalerrno
;
130
}
131
132
while
(matrix[i] != -1) {
133
event_vec.push_back(matrix[i]);
// Add item at end of vector
134
}
135
136
free(matrix);
137
return
event_vec;
138
}
LibICal::ICalSpanList::ICalSpanList
ICalSpanList()
Definition
icalspanlist_cxx.cpp:21
LibICal::ICalSpanList::get_vfreebusy
VComponent * get_vfreebusy(const char *organizer, const char *attendee)
Returns a VFREEBUSY component for the object.
Definition
icalspanlist_cxx.cpp:90
LibICal::ICalSpanList::as_vector
std::vector< int > as_vector(int delta_t)
Returns a summary of events over delta_t.
Definition
icalspanlist_cxx.cpp:120
LibICal::ICalSpanList::dump
void dump()
Definition
icalspanlist_cxx.cpp:71
LibICal::ICalSpanList::~ICalSpanList
~ICalSpanList()
Definition
icalspanlist_cxx.cpp:77
LibICal::VComponent
A class wrapping the libical icalcomponent functions.
Definition
vcomponent_cxx.hpp:38
LibICal::VComponent::VComponent
VComponent()
Definition
vcomponent_cxx.cpp:30
icalerror.h
Error handling for libical.
icalerrno
#define icalerrno
Access the current icalerrno value.
Definition
icalerror.h:133
icalspanlist_dump
void icalspanlist_dump(icalspanlist *sl)
Definition
icalspanlist.c:203
icalspanlist_from_vfreebusy
icalspanlist * icalspanlist_from_vfreebusy(icalcomponent *comp)
Definition
icalspanlist.c:402
icalspanlist_as_freebusy_matrix
int * icalspanlist_as_freebusy_matrix(icalspanlist *spanlist, int delta_t)
Definition
icalspanlist.c:281
icalspanlist_free
void icalspanlist_free(icalspanlist *sl)
Definition
icalspanlist.c:184
icalspanlist_new
icalspanlist * icalspanlist_new(icalset *set, struct icaltimetype start, struct icaltimetype end)
Definition
icalspanlist.c:82
icalspanlist_as_vfreebusy
icalcomponent * icalspanlist_as_vfreebusy(icalspanlist *sl, const char *organizer, const char *attendee)
Definition
icalspanlist.c:356
icalspanlist_cxx.hpp
C++ class wrapping the icalspanlist data structure.
LibICal
Definition
icalparameter_cxx.hpp:26
icaltimetype
Definition
icaltime.h:90
vcomponent_cxx.hpp
C++ classes for the icalcomponent wrapper (VToDo VEvent, etc..).
Generated on
for Libical API Documentation by
1.18.0