1 /* valatypesymbol.c generated by valac, the Vala compiler
2  * generated from valatypesymbol.vala, do not modify */
3 
4 /* valatypesymbol.vala
5  *
6  * Copyright (C) 2006-2010  Jürg Billeter
7  * Copyright (C) 2006-2008  Raffaele Sandrini
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13 
14  * This library 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 GNU
17  * Lesser General Public License for more details.
18 
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
22  *
23  * Author:
24  * 	Jürg Billeter <j@bitron.ch>
25  *	Raffaele Sandrini <raffaele@sandrini.ch>
26  */
27 
28 #include "vala.h"
29 #include <glib.h>
30 #include <stdlib.h>
31 #include <string.h>
32 
33 static gpointer vala_typesymbol_parent_class = NULL;
34 
35 static gboolean vala_typesymbol_real_is_reference_type (ValaTypeSymbol* self);
36 static gboolean vala_typesymbol_real_is_subtype_of (ValaTypeSymbol* self,
37                                              ValaTypeSymbol* t);
38 static gint vala_typesymbol_real_get_type_parameter_index (ValaTypeSymbol* self,
39                                                     const gchar* name);
40 static GType vala_typesymbol_get_type_once (void);
41 
42 ValaTypeSymbol*
vala_typesymbol_construct(GType object_type,const gchar * name,ValaSourceReference * source_reference,ValaComment * comment)43 vala_typesymbol_construct (GType object_type,
44                            const gchar* name,
45                            ValaSourceReference* source_reference,
46                            ValaComment* comment)
47 {
48 	ValaTypeSymbol* self = NULL;
49 	self = (ValaTypeSymbol*) vala_symbol_construct (object_type, name, source_reference, comment);
50 	return self;
51 }
52 
53 /**
54  * Checks whether this data type has value or reference type semantics.
55  *
56  * @return true if this data type has reference type semantics
57  */
58 static gboolean
vala_typesymbol_real_is_reference_type(ValaTypeSymbol * self)59 vala_typesymbol_real_is_reference_type (ValaTypeSymbol* self)
60 {
61 	gboolean result = FALSE;
62 	result = FALSE;
63 	return result;
64 }
65 
66 gboolean
vala_typesymbol_is_reference_type(ValaTypeSymbol * self)67 vala_typesymbol_is_reference_type (ValaTypeSymbol* self)
68 {
69 	g_return_val_if_fail (self != NULL, FALSE);
70 	return VALA_TYPESYMBOL_GET_CLASS (self)->is_reference_type (self);
71 }
72 
73 /**
74  * Checks whether this data type is equal to or a subtype of the
75  * specified data type.
76  *
77  * @param t a data type
78  * @return  true if t is a supertype of this data type, false otherwise
79  */
80 static gboolean
vala_typesymbol_real_is_subtype_of(ValaTypeSymbol * self,ValaTypeSymbol * t)81 vala_typesymbol_real_is_subtype_of (ValaTypeSymbol* self,
82                                     ValaTypeSymbol* t)
83 {
84 	gboolean result = FALSE;
85 	g_return_val_if_fail (t != NULL, FALSE);
86 	result = self == t;
87 	return result;
88 }
89 
90 gboolean
vala_typesymbol_is_subtype_of(ValaTypeSymbol * self,ValaTypeSymbol * t)91 vala_typesymbol_is_subtype_of (ValaTypeSymbol* self,
92                                ValaTypeSymbol* t)
93 {
94 	g_return_val_if_fail (self != NULL, FALSE);
95 	return VALA_TYPESYMBOL_GET_CLASS (self)->is_subtype_of (self, t);
96 }
97 
98 /**
99  * Return the index of the specified type parameter name.
100  */
101 static gint
vala_typesymbol_real_get_type_parameter_index(ValaTypeSymbol * self,const gchar * name)102 vala_typesymbol_real_get_type_parameter_index (ValaTypeSymbol* self,
103                                                const gchar* name)
104 {
105 	gint result = 0;
106 	g_return_val_if_fail (name != NULL, 0);
107 	result = -1;
108 	return result;
109 }
110 
111 gint
vala_typesymbol_get_type_parameter_index(ValaTypeSymbol * self,const gchar * name)112 vala_typesymbol_get_type_parameter_index (ValaTypeSymbol* self,
113                                           const gchar* name)
114 {
115 	g_return_val_if_fail (self != NULL, 0);
116 	return VALA_TYPESYMBOL_GET_CLASS (self)->get_type_parameter_index (self, name);
117 }
118 
119 static void
vala_typesymbol_class_init(ValaTypeSymbolClass * klass,gpointer klass_data)120 vala_typesymbol_class_init (ValaTypeSymbolClass * klass,
121                             gpointer klass_data)
122 {
123 	vala_typesymbol_parent_class = g_type_class_peek_parent (klass);
124 	((ValaTypeSymbolClass *) klass)->is_reference_type = (gboolean (*) (ValaTypeSymbol*)) vala_typesymbol_real_is_reference_type;
125 	((ValaTypeSymbolClass *) klass)->is_subtype_of = (gboolean (*) (ValaTypeSymbol*, ValaTypeSymbol*)) vala_typesymbol_real_is_subtype_of;
126 	((ValaTypeSymbolClass *) klass)->get_type_parameter_index = (gint (*) (ValaTypeSymbol*, const gchar*)) vala_typesymbol_real_get_type_parameter_index;
127 }
128 
129 static void
vala_typesymbol_instance_init(ValaTypeSymbol * self,gpointer klass)130 vala_typesymbol_instance_init (ValaTypeSymbol * self,
131                                gpointer klass)
132 {
133 }
134 
135 /**
136  * Represents a runtime data type. This data type may be defined in Vala source
137  * code or imported from an external library with a Vala API file.
138  */
139 static GType
vala_typesymbol_get_type_once(void)140 vala_typesymbol_get_type_once (void)
141 {
142 	static const GTypeInfo g_define_type_info = { sizeof (ValaTypeSymbolClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_typesymbol_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaTypeSymbol), 0, (GInstanceInitFunc) vala_typesymbol_instance_init, NULL };
143 	GType vala_typesymbol_type_id;
144 	vala_typesymbol_type_id = g_type_register_static (VALA_TYPE_SYMBOL, "ValaTypeSymbol", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
145 	return vala_typesymbol_type_id;
146 }
147 
148 GType
vala_typesymbol_get_type(void)149 vala_typesymbol_get_type (void)
150 {
151 	static volatile gsize vala_typesymbol_type_id__volatile = 0;
152 	if (g_once_init_enter (&vala_typesymbol_type_id__volatile)) {
153 		GType vala_typesymbol_type_id;
154 		vala_typesymbol_type_id = vala_typesymbol_get_type_once ();
155 		g_once_init_leave (&vala_typesymbol_type_id__volatile, vala_typesymbol_type_id);
156 	}
157 	return vala_typesymbol_type_id__volatile;
158 }
159 
160