]> git.datanom.net - vcard-parser.git/blob - src/vcard-parser.h
Completed initialization
[vcard-parser.git] / src / vcard-parser.h
1 /*
2 * vcard-parser.h
3 *
4 * Copyright 2019 Michael Rasmussen <mir@datanom.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21
22 #ifndef __VCARD_PARSER_H__
23 #define __VCARD_PARSER_H__
24
25 #include <glib.h>
26
27 G_BEGIN_DECLS
28
29 #include <globals.h>
30
31 typedef enum {
32 // vCard 2.1 properties and up
33 // https://github.com/emacsmirror/addressbook/blob/master/vcard-21.txt
34 N = 0,
35 FN,
36 PHOTO,
37 BDAY,
38 ADR,
39 LABEL, // Removed in vCard 4.0
40 TEL,
41 EMAIL,
42 MAILER, // Removed in vCard 4.0
43 GEO,
44 TITLE,
45 ROLE,
46 LOGO,
47 ORG,
48 NOTE,
49 REV,
50 SOUND,
51 URL,
52 UID,
53 VERSION,
54 KEY,
55 TZ,
56 SOURCE,
57 AGENT, // Removed in vCard 4.0
58 PROFILE, // Removed in vCard 4.0
59 // vCard 3.0 properties
60 // https://tools.ietf.org/html/rfc2426
61 CATEGORIES,
62 SORT_STRING,
63 PRODID,
64 NICKNAME,
65 NAME, // Removed in vCard 4.0
66 CLASS, // Removed in vCard 4.0
67 // rfc2739 properties
68 FBURL,
69 CAPURI,
70 CALURI,
71 CALADRURI,
72 // rfc4770 properties
73 IMPP,
74 // vCard 4.0 properties
75 // https://tools.ietf.org/html/rfc6350
76 XML,
77 ANNIVERSARY,
78 CLIENTPIDMAP,
79 LANG,
80 GENDER,
81 KIND,
82 MEMBER,
83 RELATED,
84 // rfc6474 properties
85 BIRTHPLACE,
86 DEATHPLACE,
87 DEATHDATE,
88 // rfc6715 properties
89 EXPERTISE,
90 HOBBY,
91 INTEREST,
92 ORG_DIRECTORY,
93 VCARD_PROPERTIES,
94 } Property;
95
96 typedef enum {
97 VCARD_PARSER_OK,
98 VCARD_PARSER_VERSION_MISSING,
99 VCARD_PARSER_VERSION_MISMATCH,
100 VCARD_PARSER_ATTRIBUTE_VERSION_MISMATCH,
101 VCARD_PARSER_BAD_FORMAT,
102 VCARD_PARSER_ERROR,
103 } VCardParserResponse;
104
105 typedef struct {
106 gchar* name;
107 gchar* value;
108 } VCardProperty;
109
110 VCardVersion str_2_vcard_version(const gchar* version);
111 gchar* vcard_version_2_str(VCardVersion version);
112 Property vcard_max_property(VCardVersion version);
113 VCardParserResponse vcard_parse_text(const gchar* text, VCardVersion* version, GHashTable** vcard);
114 void destroy_hash_table(GHashTable* ht);
115
116 G_END_DECLS
117
118 #endif
This page took 0.064378 seconds and 6 git commands to generate.