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 #ifndef TAGS_H
30 #define TAGS_H
31
32 #include <cx/string.h>
33 #include <cx/buffer.h>
34 #include <cx/list.h>
35
36 #include <libidav/webdav.h>
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42
43
44 #define DAV_SYNC_TAGFILTER_OFF 0
45 #define DAV_SYNC_TAGFILTER_AND 1
46 #define DAV_SYNC_TAGFILTER_OR 2
47 #define DAV_SYNC_TAGFILTER_ONE 3
48 #define DAV_SYNC_TAGFILTER_NONE 4
49
50 #define DAV_SYNC_TAGFILTER_SCOPE_RESOURCE 1
51 #define DAV_SYNC_TAGFILTER_SCOPE_COLLECTION 2
52
53 typedef struct DavTag {
54 char *name;
55 char *color;
56 } DavTag;
57
58
59
60
61
62
63 typedef struct SyncTagFilter SyncTagFilter;
64
65 struct SyncTagFilter {
66 int scope;
67 int mode;
68 CxList* tags;
69 size_t subfilter_count;
70 SyncTagFilter** subfilters;
71 };
72
73 void free_dav_tag(DavTag* tag);
74
75 void free_taglist(CxList *list);
76
77 int compare_tagname(DavTag* left, DavTag* right,
void* ignorecase);
78
79 CxMap* taglist2map(CxList *tags);
80
81 CxList* parse_text_taglist(
const char *buf,
size_t length);
82 CxBuffer* create_text_taglist(CxList *tags);
83
84 CxList* parse_csv_taglist(
const char *buf,
size_t length);
85 CxBuffer* create_csv_taglist(CxList *tags);
86
87 CxList* parse_dav_xml_taglist(DavXmlNode *taglistnode);
88 DavXmlNode* create_xml_taglist(CxList *tags);
89
90 CxList* parse_macos_taglist(
const char *buf,
size_t length);
91 CxBuffer* create_macos_taglist(CxList *tags);
92
93 int compare_taglists(CxList *tags1, CxList *tags2);
94
95 char* create_tags_hash(CxList *tags);
96
97 CxList* merge_tags(CxList *tags1, CxList *tags2);
98
99
100
101
102 void add_tag_colors(CxList *taglist, CxList *colored);
103
104
105
106 SyncTagFilter* parse_tagfilter_string(
const char* filterstring,
int scope);
107 void free_tagfilter(SyncTagFilter* filter);
108
109 int matches_tagfilter(CxList *dav_tags, SyncTagFilter *tagfilter);
110
111 #ifdef __cplusplus
112 }
113 #endif
114
115 #endif
116
117