From c374807e9d73014ce57eacbbaa56e05460288368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sat, 9 Feb 2019 00:19:58 +0100 Subject: Extend parsing to handle tree's of vcomponents. --- vcal.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'vcal.h') diff --git a/vcal.h b/vcal.h index 6b3667bf..08d706a6 100644 --- a/vcal.h +++ b/vcal.h @@ -29,6 +29,8 @@ INIT_F(content_line); INIT_F(content_line, int keylen, int vallen); FREE_F(content_line); +int content_line_copy (content_line* dest, content_line* src); + /* * Resolves a collision in some form of structure (probably a hash-map * or a trie). If dest is NULL just return new. Otherwise mutates dest @@ -50,17 +52,19 @@ typedef struct s_vcomponent vcomponent; struct s_vcomponent { char* filename; + char* type; vcomponent* parent; TRIE(content_line) clines; VECT(vcomponent) components; }; +#define FCHILD(v) GET(VECT(vcomponent))(&(v)->components, 0) + INIT_F(vcomponent); -INIT_F(vcomponent, char* filename); +INIT_F(vcomponent, char* type); +INIT_F(vcomponent, char* type, char* filename); FREE_F(vcomponent); -int content_line_copy (content_line* dest, content_line* src); - content_line* get_property (vcomponent* ev, char* key); int add_content_line (vcomponent* ev, content_line* c); @@ -71,4 +75,6 @@ int add_content_line (vcomponent* ev, content_line* c); */ int PUSH(vcomponent)(vcomponent*, vcomponent*); +int DEEP_COPY(vcomponent)(vcomponent*, vcomponent*); + #endif /* VCAL_H */ -- cgit v1.2.3