1 
2 /*
3  * Osmo - a handy personal organizer
4  *
5  * Copyright (C) 2015 Tomasz Mąka <pasp@users.sourceforge.net>
6  *               2015 Piotr Mąka <silloz@users.sourceforge.net>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  */
22 
23 #ifndef VCF_H
24 #define	VCF_H
25 
26 #include <stddef.h>
27 #include <glib.h>
28 
29 #define VCF_TYPE_TEL_VOICE "voice"
30 #define VCF_TYPE_TEL_FAX "fax"
31 #define VCF_TYPE_TEL_CELL "cell"
32 #define VCF_TYPE_HOME "home"
33 #define VCF_TYPE_WORK "work"
34 
35 
36 typedef struct vcf_writer vcf_writer;
37 
38 typedef void(vcf_writer_callback) (gchar const *buffer, gsize buffer_size, void *user_data);
39 
40 vcf_writer *vcf_create_writer(vcf_writer_callback *callback, void *user_data);
41 
42 void vcf_close_writer(vcf_writer *writer);
43 
44 void vcf_write_begin(vcf_writer *writer);
45 void vcf_write_end(vcf_writer *writer);
46 
47 void vcf_write_property(vcf_writer *writer, gchar const *property_name);
48 void vcf_write_FN(vcf_writer *writer, gchar const *first_name, gchar const *last_name);
49 void vcf_write_N(vcf_writer *writer, gchar const *last_name, gchar const *first_name, gchar const *second_name);
50 void vcf_write_NICKNAME(vcf_writer *writer, gchar const *nick_name);
51 void vcf_write_BDAY(vcf_writer *writer, guint32 julian_day);
52 void vcf_write_ADR(vcf_writer *writer, gchar const *type, gchar const *address, gchar const *city, gchar const *state, gchar const *post_code, gchar const *country);
53 void vcf_write_ORG(vcf_writer *writer, gchar const *organization, gchar const *department);
54 #define vcf_write_TEL(writer, number, pref, ...) { \
55 gchar const **types=(gchar const *[]){__VA_ARGS__, NULL}; \
56 vcf_write_TEL_internal(writer, number, pref, types); \
57 }
58 void vcf_write_EMAIL(vcf_writer *writer, gchar const *email, gint pref);
59 void vcf_write_URL(vcf_writer *writer, gchar const *url);
60 void vcf_write_URL_pref(vcf_writer *writer, gchar const *url, gint pref);
61 void vcf_write_IMPP(vcf_writer *writer, gchar const *url, gchar const *type);
62 void vcf_write_NOTE(vcf_writer *writer, gchar const *note);
63 
64 /* Do not call the functions below directly, use the provided macros instead. */
65 void vcf_write_TEL_internal(vcf_writer *writer, gchar const *number, gint pref, gchar const **types);
66 
67 #endif	/* VCF_H */
68 
69