blob: 8335cbc4505bb90bc11df479850f6ee0d54305f4 (
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
|
#ifndef VCAL_H
#define VCAL_H
#include <stdlib.h>
#include "strbuf.h"
typedef struct {
string key;
string value;
string* vals;
int val_count;
} parameter;
typedef struct {
string key;
string val;
string* aux_values;
int value_count;
parameter* params;
int param_count;
} content_line;
#define TYPE content_line
#include "hash.h"
#undef TYPE
struct s_vevent {
/*
string dtstart;
string dtend;
string summary;
string description;
*/
TABLE(content_line) clines;
};
struct s_vevent;
typedef struct s_vevent vevent;
int vevent_init (vevent* ev, int init_size);
int init_content_line (content_line* c, int keylen, int vallen);
int content_line_free (content_line* c);
int content_line_copy (content_line* dest, content_line* src);
content_line* get_property (vevent* ev, char* key);
int add_content_line (vevent* ev, content_line* c);
/*
* Deep copy from src -> dest
* Requires dest to be initialized beforehand
* TODO possibly remove this.
*/
int copy_vevent(vevent* dest, vevent* src);
/*
* Copies src -> dest, initializing all the strings along the way.
* Requires dest to be initialized.
*/
int vevent_init_copy(vevent* dest, vevent* src);
int free_vevent(vevent* ev);
typedef struct {
size_t n_events;
size_t alloc;
vevent* events;
} vcalendar;
int init_vcalendar(vcalendar* cal);
int free_vcalendar(vcalendar* cal);
int push_event(vcalendar* cal, vevent* ev);
#endif /* VCAL_H */
|