summaryrefslogtreecommitdiff
path: root/src/libical/icalvalue_cxx.h
blob: b922debf13f334ea9f8c3e659929b0a96a142409 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*======================================================================
 FILE: icalvalue_cxx.h
 CREATOR: fnguyen 12/13/01
 SPDX-FileCopyrightText: 2001, Critical Path

 SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0

======================================================================*/

#ifndef ICALVALUE_CXX_H
#define ICALVALUE_CXX_H

#include "libical_ical_export.h"
#include "icptrholder_cxx.h"

extern "C"
{
#include "icalerror.h"
#include "icalvalue.h"
}

#include <string>

namespace LibICal
{

class LIBICAL_ICAL_EXPORT ICalValue
{
public:
    ICalValue();
    ICalValue(const ICalValue &);
    ICalValue &operator=(const ICalValue &);
    ~ICalValue();

    explicit ICalValue(icalvalue *);
    explicit ICalValue(const icalvalue_kind &kind);
    ICalValue(const icalvalue_kind &kind, const std::string &str);

    operator  icalvalue *()
    {
        return imp;
    }

    void detach();

public:
    std::string as_ical_string();
    bool is_valid();
    icalvalue_kind isa();
    int isa_value(void *);

    /* Special, non autogenerated value accessors */
    void set_recur(const struct icalrecurrencetype &v);
    struct icalrecurrencetype get_recur();

    void set_trigger(const struct icaltriggertype &v);
    struct icaltriggertype get_trigger();

    void set_datetimeperiod(const struct icaldatetimeperiodtype &v);
    struct icaldatetimeperiodtype get_datetimeperiod();

public:
    static icalparameter_xliccomparetype compare(ICalValue &a, ICalValue &b);

    /* Convert enumerations */
    static icalvalue_kind string_to_kind(const std::string &str);
    std::string kind_to_string(const icalvalue_kind &kind);

public:
    /* BOOLEAN */
    int get_boolean() const;
    void set_boolean(const int &v);

    /* UTC-OFFSET */
    int get_utcoffset() const;
    void set_utcoffset(const int &v);

    /* METHOD */
    enum icalproperty_method get_method() const;
    void set_method(const enum icalproperty_method &v);

    /* CAL-ADDRESS */
    std::string get_caladdress() const;
    void set_caladdress(const std::string &v);

    /* PERIOD */
    struct icalperiodtype get_period() const;
    void set_period(const struct icalperiodtype &v);

    /* STATUS */
    enum icalproperty_status get_status() const;
    void set_status(const enum icalproperty_status &v);

    /* BINARY */
    std::string get_binary() const;
    void set_binary(const std::string &v);

    /* TEXT */
    std::string get_text() const;
    void set_text(const std::string &v);

    /* DURATION */
    struct icaldurationtype get_duration() const;
    void set_duration(const struct icaldurationtype &v);

    /* INTEGER */
    int get_integer() const;
    void set_integer(const int &v);

    /* URI */
    std::string get_uri() const;
    void set_uri(const std::string &v);

    /* ATTACH */
    icalattach *get_attach();
    void set_attach(icalattach *v);

    /* CLASS */
    enum icalproperty_class get_class() const;
    void set_class(const enum icalproperty_class &v);

    /* FLOAT */
    float get_float() const;
    void set_float(const float &v);

    /* QUERY */
    std::string get_query() const;
    void set_query(const std::string &v);

    /* STRING */
    std::string get_string() const;
    void set_string(const std::string &v);

    /* TRANSP */
    enum icalproperty_transp get_transp() const;
    void set_transp(const enum icalproperty_transp &v);

    /* DATE-TIME */
    struct icaltimetype get_datetime() const;
    void set_datetime(const struct icaltimetype &v);

    /* GEO */
    struct icalgeotype get_geo() const;
    void set_geo(const struct icalgeotype &v);

    /* DATE */
    struct icaltimetype get_date() const;
    void set_date(const struct icaltimetype &v);

    /* ACTION */
    enum icalproperty_action get_action() const;
    void set_action(const enum icalproperty_action &v);

private:
    icalvalue *imp;
};

} // namespace LibICal

typedef ICPointerHolder < LibICal::ICalValue > ICalValueTmpPtr;

#endif