summaryrefslogtreecommitdiff
path: root/src/libical/icalvalue_cxx.h
blob: 229b008da0ca7a0b93113e65eb97674aa6d92838 (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
/* -*- Mode: C -*- */
/*======================================================================
 FILE: icalvalue_cxx.h
 CREATOR: fnguyen 12/13/01
 (C) COPYRIGHT 2001, Critical Path

 This program is free software; you can redistribute it and/or modify
 it under the terms of either: 

    The LGPL as published by the Free Software Foundation, version
    2.1, available at: http://www.fsf.org/copyleft/lesser.html

  Or:

    The Mozilla Public License Version 1.0. You may obtain a copy of
    the License at http://www.mozilla.org/MPL/
======================================================================*/

#ifndef CP_ICALVALUE_H
#define CP_ICALVALUE_H

extern "C" {
#include "ical.h"
};
                          
#include "icptrholder.h"
                          
typedef	char* string; // Will use the string library from STL

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

	ICalValue(icalvalue*)                        throw(icalerrorenum);
	ICalValue(icalvalue_kind kind)               throw(icalerrorenum);
	ICalValue(icalvalue_kind kind, string  str)  throw(icalerrorenum);

	operator icalvalue* () { return imp; }

	void detach() {
	    imp = NULL;
	}

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

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

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

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

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

	/* Convert enumerations */
	static icalvalue_kind string_to_kind(string  str);
	string kind_to_string(icalvalue_kind kind);

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

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

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

	/* CAL-ADDRESS */ 
	string get_caladdress(); 
	void set_caladdress(string  v);

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

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

	/* BINARY */ 
	string get_binary(); 
	void set_binary(string  v);

	/* TEXT */ 
	string get_text(); 
	void set_text(string  v);

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

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

	/* URI */ 
	string get_uri(); 
	void set_uri(string  v);

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

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

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

	/* QUERY */ 
	string get_query(); 
	void set_query(string  v);

	/* STRING */ 
	string get_string(); 
	void set_string(string  v);

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

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

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

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

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

private:
	icalvalue* imp;
};


typedef ICPointerHolder<ICalValue> ICalValueTmpPtr;    /* see icptrholder.h for comments */

#endif /*ICALVALUE_H*/