1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3  *  anjuta-serializer.h
4  *  Copyright (C) 2000 Naba Kumar  <naba@gnome.org>
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 Library 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, MA 02110-1301, USA.
19  */
20 
21 #ifndef ANJUTA_SERIALIZER_H
22 #define ANJUTA_SERIALIZER_H
23 
24 #include <glib.h>
25 #include <glib-object.h>
26 
27 G_BEGIN_DECLS
28 
29 #define ANJUTA_TYPE_SERIALIZER         (anjuta_serializer_get_type ())
30 #define ANJUTA_SERIALIZER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), ANJUTA_TYPE_SERIALIZER, AnjutaSerializer))
31 #define ANJUTA_SERIALIZER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), ANJUTA_TYPE_SERIALIZER, AnjutaSerializerClass))
32 #define ANJUTA_IS_SERIALIZER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), ANJUTA_TYPE_SERIALIZER))
33 #define ANJUTA_IS_SERIALIZER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), ANJUTA_TYPE_SERIALIZER))
34 #define ANJUTA_SERIALIZER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ANJUTA_TYPE_SERIALIZER, AnjutaSerializerClass))
35 
36 typedef enum
37 {
38 	ANJUTA_SERIALIZER_READ,
39 	ANJUTA_SERIALIZER_WRITE
40 } AnjutaSerializerMode;
41 
42 typedef struct _AnjutaSerializer AnjutaSerializer;
43 typedef struct _AnjutaSerializerPrivate AnjutaSerializerPrivate;
44 typedef struct _AnjutaSerializerClass AnjutaSerializerClass;
45 
46 struct _AnjutaSerializer {
47 	GObject parent;
48 	AnjutaSerializerPrivate *priv;
49 };
50 
51 struct _AnjutaSerializerClass {
52 	GObjectClass parent_class;
53 };
54 
55 GType anjuta_serializer_get_type (void);
56 AnjutaSerializer *anjuta_serializer_new (const gchar *filepath,
57 										 AnjutaSerializerMode mode);
58 
59 gboolean
60 anjuta_serializer_write_int (AnjutaSerializer *serializer,
61 							 const gchar *name, gint value);
62 gboolean
63 anjuta_serializer_write_float (AnjutaSerializer *serializer,
64 							   const gchar *name, gfloat value);
65 gboolean
66 anjuta_serializer_write_string (AnjutaSerializer *serializer,
67 								const gchar *name, const gchar *value);
68 gboolean
69 anjuta_serializer_read_int (AnjutaSerializer *serializer,
70 							 const gchar *name, gint *value);
71 gboolean
72 anjuta_serializer_read_float (AnjutaSerializer *serializer,
73 							  const gchar *name, gfloat *value);
74 gboolean
75 anjuta_serializer_read_string (AnjutaSerializer *serializer,
76 							   const gchar *name, gchar **value,
77 							   gboolean replace);
78 
79 G_END_DECLS
80 
81 #endif /* ANJUTA_SERIALIZER_H */
82