]> git.sur5r.net Git - glabels/blob - src/merge.h
Imported Upstream version 3.0.0
[glabels] / src / merge.h
1 /*
2  *  merge.h
3  *  Copyright (C) 2002-2009  Jim Evins <evins@snaught.com>.
4  *
5  *  This file is part of gLabels.
6  *
7  *  gLabels is free software: you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation, either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  gLabels is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #ifndef __MERGE_H__
22 #define __MERGE_H__
23
24 #include <glib-object.h>
25
26 G_BEGIN_DECLS
27
28 typedef enum {
29         GL_MERGE_SRC_IS_FIXED,
30         GL_MERGE_SRC_IS_FILE
31 } glMergeSrcType;
32
33 typedef struct {
34         gchar *key;
35         gchar *value;
36 } glMergeField;
37
38 typedef struct {
39         gboolean select_flag;
40         GList    *field_list;  /* List of glMergeFields */
41 } glMergeRecord;
42
43
44 #define GL_TYPE_MERGE              (gl_merge_get_type ())
45 #define GL_MERGE(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_MERGE, glMerge))
46 #define GL_MERGE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_MERGE, glMergeClass))
47 #define GL_IS_MERGE(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_MERGE))
48 #define GL_IS_MERGE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_MERGE))
49 #define GL_MERGE_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), GL_TYPE_MERGE, glMergeClass))
50
51
52 typedef struct _glMerge          glMerge;
53 typedef struct _glMergeClass     glMergeClass;
54
55 typedef struct _glMergePrivate   glMergePrivate;
56
57
58 struct _glMerge {
59         GObject          object;
60
61         glMergePrivate  *priv;
62 };
63
64 struct _glMergeClass {
65         GObjectClass     parent_class;
66
67         GList         *(*get_key_list)    (const glMerge *merge);
68
69         gchar         *(*get_primary_key) (const glMerge *merge);
70
71         void           (*open)            (glMerge       *merge);
72
73         void           (*close)           (glMerge       *merge);
74
75         glMergeRecord *(*get_record)      (glMerge       *merge);
76
77         void           (*copy)            (glMerge       *dst_merge,
78                                            const glMerge *src_merge);
79 };
80
81
82 void              gl_merge_register_backend    (GType              type,
83                                                 gchar             *name,
84                                                 gchar             *description,
85                                                 glMergeSrcType     src_type,
86                                                 const gchar       *first_arg_name,
87                                                 ...);
88
89 GList            *gl_merge_get_descriptions    (void);
90
91 void              gl_merge_free_descriptions   (GList **descriptions);
92
93 gchar            *gl_merge_description_to_name (gchar *description);
94
95 GType             gl_merge_get_type            (void) G_GNUC_CONST;
96
97 glMerge          *gl_merge_new                 (const gchar         *name);
98
99 glMerge          *gl_merge_dup                 (const glMerge       *orig);
100
101 gchar            *gl_merge_get_name            (const glMerge       *merge);
102
103 gchar            *gl_merge_get_description     (const glMerge       *merge);
104
105 glMergeSrcType    gl_merge_get_src_type        (const glMerge       *merge);
106
107 void              gl_merge_set_src             (glMerge             *merge,
108                                                 const gchar         *src);
109
110 gchar            *gl_merge_get_src             (const glMerge       *merge);
111
112 GList            *gl_merge_get_key_list        (const glMerge       *merge);
113
114 void              gl_merge_free_key_list       (GList              **keys);
115
116 gchar            *gl_merge_get_primary_key     (const glMerge       *merge);
117
118 gchar            *gl_merge_eval_key            (const glMergeRecord *record,
119                                                 const gchar         *key);
120
121 const GList      *gl_merge_get_record_list     (const glMerge       *merge);
122
123 gint              gl_merge_get_record_count    (const glMerge       *merge);
124
125 G_END_DECLS
126
127 #endif
128
129
130
131 /*
132  * Local Variables:       -- emacs
133  * mode: C                -- emacs
134  * c-basic-offset: 8      -- emacs
135  * tab-width: 8           -- emacs
136  * indent-tabs-mode: nil  -- emacs
137  * End:                   -- emacs
138  */