1 /*
2  * Copyright (C) YEAR The GNOME Foundation.
3  *
4  * AUTHORS:
5  *      TO_ADD: your name and email
6  *      Vivien Malerba <malerba@gnome-db.org>
7  *
8  * This Library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public License as
10  * published by the Free Software Foundation; either version 2 of the
11  * License, or (at your option) any later version.
12  *
13  * This Library 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 GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this Library; see the file COPYING.LIB.  If not,
20  * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA  02110-1301, USA.
22  */
23 
main(int,char **)24 #include <string.h>
25 #include <glib/gi18n-lib.h>
26 #include "gda-capi-pstmt.h"
27 #include <libgda/gda-debug-macros.h>
28 
29 static void gda_capi_pstmt_class_init (GdaCapiPStmtClass *klass);
30 static void gda_capi_pstmt_init       (GdaCapiPStmt *pstmt, GdaCapiPStmtClass *klass);
31 static void gda_capi_pstmt_finalize    (GObject *object);
32 
33 static GObjectClass *parent_class = NULL;
34 
35 /**
36  * gda_capi_pstmt_get_type
37  *
38  * Returns: the #GType of GdaCapiPStmt.
39  */
40 GType
41 gda_capi_pstmt_get_type (void)
42 {
43 	static GType type = 0;
44 
45 	if (G_UNLIKELY (type == 0)) {
46 		static GMutex registering;
47 		static const GTypeInfo info = {
48 			sizeof (GdaCapiPStmtClass),
49 			(GBaseInitFunc) NULL,
50 			(GBaseFinalizeFunc) NULL,
51 			(GClassInitFunc) gda_capi_pstmt_class_init,
52 			NULL,
53 			NULL,
54 			sizeof (GdaCapiPStmt),
55 			0,
56 			(GInstanceInitFunc) gda_capi_pstmt_init,
57 			0
58 		};
59 
60 		g_mutex_lock (&registering);
61 		if (type == 0)
62 			type = g_type_register_static (GDA_TYPE_PSTMT, "GdaCapiPStmt", &info, 0);
63 		g_mutex_unlock (&registering);
64 	}
65 	return type;
66 }
67 
68 static void
69 gda_capi_pstmt_class_init (GdaCapiPStmtClass *klass)
70 {
71 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
72 	parent_class = g_type_class_peek_parent (klass);
73 
74 	/* virtual functions */
75 	object_class->finalize = gda_capi_pstmt_finalize;
76 }
77 
78 static void
79 gda_capi_pstmt_init (GdaCapiPStmt *pstmt, G_GNUC_UNUSED GdaCapiPStmtClass *klass)
80 {
81 	g_return_if_fail (GDA_IS_PSTMT (pstmt));
82 
83 	/* initialize specific parts of @pstmt */
84 	TO_IMPLEMENT;
85 }
86 
87 static void
88 gda_capi_pstmt_finalize (GObject *object)
89 {
90 	GdaCapiPStmt *pstmt = (GdaCapiPStmt *) object;
91 
92 	g_return_if_fail (GDA_IS_PSTMT (pstmt));
93 
94 	/* free memory */
95 	TO_IMPLEMENT; /* free some specific parts of @pstmt */
96 
97 	/* chain to parent class */
98 	parent_class->finalize (object);
99 }
100