Add optimized indexing capabilities for phone number values.
[platform/upstream/evolution-data-server.git] / camel / camel-object.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* camel-object.h: Base class for Camel */
3 /*
4  * Authors:
5  *  Dan Winship <danw@ximian.com>
6  *  Michael Zucchi <notzed@ximian.com>
7  *
8  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of version 2 of the GNU Lesser General Public
12  * License as published by the Free Software Foundation.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
22  * USA
23  */
24
25 #if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
26 #error "Only <camel/camel.h> can be included directly."
27 #endif
28
29 #ifndef CAMEL_OBJECT_H
30 #define CAMEL_OBJECT_H
31
32 #include <stdio.h>              /* FILE */
33 #include <stdlib.h>             /* gsize */
34 #include <stdarg.h>
35 #include <gio/gio.h>
36
37 /* Standard GObject macros */
38 #define CAMEL_TYPE_OBJECT \
39         (camel_object_get_type ())
40 #define CAMEL_OBJECT(obj) \
41         (G_TYPE_CHECK_INSTANCE_CAST \
42         ((obj), CAMEL_TYPE_OBJECT, CamelObject))
43 #define CAMEL_OBJECT_CLASS(cls) \
44         (G_TYPE_CHECK_CLASS_CAST \
45         ((cls), CAMEL_TYPE_OBJECT, CamelObjectClass))
46 #define CAMEL_IS_OBJECT(obj) \
47         (G_TYPE_CHECK_INSTANCE_TYPE \
48         ((obj), CAMEL_TYPE_OBJECT))
49 #define CAMEL_IS_OBJECT_CLASS(cls) \
50         (G_TYPE_CHECK_CLASS_TYPE \
51         ((cls), CAMEL_TYPE_OBJECT))
52 #define CAMEL_OBJECT_GET_CLASS(obj) \
53         (G_TYPE_INSTANCE_GET_CLASS \
54         ((obj), CAMEL_TYPE_OBJECT, CamelObjectClass))
55
56 /**
57  * CAMEL_ERROR:
58  *
59  * Since: 2.32
60  **/
61 #define CAMEL_ERROR \
62         (camel_error_quark ())
63
64 G_BEGIN_DECLS
65
66 typedef struct _CamelObject CamelObject;
67 typedef struct _CamelObjectClass CamelObjectClass;
68 typedef struct _CamelObjectPrivate CamelObjectPrivate;
69
70 /**
71  * CamelParamFlags:
72  * @CAMEL_PARAM_PERSISTENT:
73  *     The parameter is persistent, which means its value is saved to
74  *     #CamelObject:state-filename during camel_object_state_write(),
75  *     and restored during camel_object_state_read().
76  *
77  * These flags extend #GParamFlags.  Most of the time you will use them
78  * in conjunction with g_object_class_install_property().
79  *
80  * Since: 2.32
81  **/
82 typedef enum {
83         CAMEL_PARAM_PERSISTENT = 1 << (G_PARAM_USER_SHIFT + 0)
84 } CamelParamFlags;
85
86 /**
87  * CamelError:
88  *
89  * Since: 2.32
90  **/
91 typedef enum {
92         CAMEL_ERROR_GENERIC             /* lazy fallback error */
93 } CamelError;
94
95 struct _CamelObject {
96         GObject parent;
97         CamelObjectPrivate *priv;
98 };
99
100 struct _CamelObjectClass {
101         GObjectClass parent_class;
102
103         gint            (*state_read)           (CamelObject *object,
104                                                  FILE *fp);
105         gint            (*state_write)          (CamelObject *object,
106                                                  FILE *fp);
107 };
108
109 GType           camel_object_get_type           (void);
110 GQuark          camel_error_quark               (void) G_GNUC_CONST;
111 gint            camel_object_state_read         (CamelObject *object);
112 gint            camel_object_state_write        (CamelObject *object);
113 const gchar *   camel_object_get_state_filename (CamelObject *object);
114 void            camel_object_set_state_filename (CamelObject *object,
115                                                  const gchar *state_filename);
116
117 G_END_DECLS
118
119 #endif /* CAMEL_OBJECT_H */