1 /* valavoidtype.c generated by valac, the Vala compiler
2  * generated from valavoidtype.vala, do not modify */
3 
4 /* valavoidtype.vala
5  *
6  * Copyright (C) 2007-2008  Jürg Billeter
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the 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  * Lesser General Public License for more details.
17 
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
21  *
22  * Author:
23  * 	Jürg Billeter <j@bitron.ch>
24  */
25 
26 #include "vala.h"
27 #include <glib.h>
28 #include <stdlib.h>
29 #include <string.h>
30 
31 static gpointer vala_void_type_parent_class = NULL;
32 
33 static gboolean vala_void_type_real_stricter (ValaDataType* base,
34                                        ValaDataType* type2);
35 static gboolean vala_void_type_real_compatible (ValaDataType* base,
36                                          ValaDataType* type2);
37 static gchar* vala_void_type_real_to_qualified_string (ValaDataType* base,
38                                                 ValaScope* scope);
39 static ValaDataType* vala_void_type_real_copy (ValaDataType* base);
40 static GType vala_void_type_get_type_once (void);
41 
42 ValaVoidType*
vala_void_type_construct(GType object_type,ValaSourceReference * source_reference)43 vala_void_type_construct (GType object_type,
44                           ValaSourceReference* source_reference)
45 {
46 	ValaVoidType* self = NULL;
47 	self = (ValaVoidType*) vala_data_type_construct (object_type);
48 	vala_code_node_set_source_reference ((ValaCodeNode*) self, source_reference);
49 	return self;
50 }
51 
52 ValaVoidType*
vala_void_type_new(ValaSourceReference * source_reference)53 vala_void_type_new (ValaSourceReference* source_reference)
54 {
55 	return vala_void_type_construct (VALA_TYPE_VOID_TYPE, source_reference);
56 }
57 
58 static gboolean
vala_void_type_real_stricter(ValaDataType * base,ValaDataType * type2)59 vala_void_type_real_stricter (ValaDataType* base,
60                               ValaDataType* type2)
61 {
62 	ValaVoidType * self;
63 	gboolean result = FALSE;
64 	self = (ValaVoidType*) base;
65 	g_return_val_if_fail (type2 != NULL, FALSE);
66 	result = VALA_IS_VOID_TYPE (type2);
67 	return result;
68 }
69 
70 static gboolean
vala_void_type_real_compatible(ValaDataType * base,ValaDataType * type2)71 vala_void_type_real_compatible (ValaDataType* base,
72                                 ValaDataType* type2)
73 {
74 	ValaVoidType * self;
75 	gboolean result = FALSE;
76 	self = (ValaVoidType*) base;
77 	g_return_val_if_fail (type2 != NULL, FALSE);
78 	result = VALA_IS_VOID_TYPE (type2);
79 	return result;
80 }
81 
82 static gchar*
vala_void_type_real_to_qualified_string(ValaDataType * base,ValaScope * scope)83 vala_void_type_real_to_qualified_string (ValaDataType* base,
84                                          ValaScope* scope)
85 {
86 	ValaVoidType * self;
87 	gchar* _tmp0_;
88 	gchar* result = NULL;
89 	self = (ValaVoidType*) base;
90 	_tmp0_ = g_strdup ("void");
91 	result = _tmp0_;
92 	return result;
93 }
94 
95 static ValaDataType*
vala_void_type_real_copy(ValaDataType * base)96 vala_void_type_real_copy (ValaDataType* base)
97 {
98 	ValaVoidType * self;
99 	ValaSourceReference* _tmp0_;
100 	ValaSourceReference* _tmp1_;
101 	ValaVoidType* _tmp2_;
102 	ValaDataType* result = NULL;
103 	self = (ValaVoidType*) base;
104 	_tmp0_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
105 	_tmp1_ = _tmp0_;
106 	_tmp2_ = vala_void_type_new (_tmp1_);
107 	result = (ValaDataType*) _tmp2_;
108 	return result;
109 }
110 
111 static void
vala_void_type_class_init(ValaVoidTypeClass * klass,gpointer klass_data)112 vala_void_type_class_init (ValaVoidTypeClass * klass,
113                            gpointer klass_data)
114 {
115 	vala_void_type_parent_class = g_type_class_peek_parent (klass);
116 	((ValaDataTypeClass *) klass)->stricter = (gboolean (*) (ValaDataType*, ValaDataType*)) vala_void_type_real_stricter;
117 	((ValaDataTypeClass *) klass)->compatible = (gboolean (*) (ValaDataType*, ValaDataType*)) vala_void_type_real_compatible;
118 	((ValaDataTypeClass *) klass)->to_qualified_string = (gchar* (*) (ValaDataType*, ValaScope*)) vala_void_type_real_to_qualified_string;
119 	((ValaDataTypeClass *) klass)->copy = (ValaDataType* (*) (ValaDataType*)) vala_void_type_real_copy;
120 }
121 
122 static void
vala_void_type_instance_init(ValaVoidType * self,gpointer klass)123 vala_void_type_instance_init (ValaVoidType * self,
124                               gpointer klass)
125 {
126 }
127 
128 /**
129  * The void type.
130  */
131 static GType
vala_void_type_get_type_once(void)132 vala_void_type_get_type_once (void)
133 {
134 	static const GTypeInfo g_define_type_info = { sizeof (ValaVoidTypeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_void_type_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaVoidType), 0, (GInstanceInitFunc) vala_void_type_instance_init, NULL };
135 	GType vala_void_type_type_id;
136 	vala_void_type_type_id = g_type_register_static (VALA_TYPE_DATA_TYPE, "ValaVoidType", &g_define_type_info, 0);
137 	return vala_void_type_type_id;
138 }
139 
140 GType
vala_void_type_get_type(void)141 vala_void_type_get_type (void)
142 {
143 	static volatile gsize vala_void_type_type_id__volatile = 0;
144 	if (g_once_init_enter (&vala_void_type_type_id__volatile)) {
145 		GType vala_void_type_type_id;
146 		vala_void_type_type_id = vala_void_type_get_type_once ();
147 		g_once_init_leave (&vala_void_type_type_id__volatile, vala_void_type_type_id);
148 	}
149 	return vala_void_type_type_id__volatile;
150 }
151 
152