2 # GObject-Introspection - a framework for introspecting GObject libraries
3 # Copyright (C) 2008 Johan Dahlin
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 from .ast import Class, Enum, Interface, Member, Node, Property, Struct
24 TYPE_STRING, TYPE_INT8, TYPE_UINT8, TYPE_INT16, TYPE_UINT16,
25 TYPE_UINT32, TYPE_INT32, TYPE_LONG, TYPE_ULONG, TYPE_FLOAT,
26 TYPE_DOUBLE, TYPE_BOOLEAN, TYPE_ANY, TYPE_SIZE, TYPE_SSIZE)
29 type_names['gchararray'] = TYPE_STRING
30 type_names['gint8'] = TYPE_INT8
31 type_names['guint8'] = TYPE_UINT8
32 type_names['gint16'] = TYPE_INT16
33 type_names['guint16'] = TYPE_UINT16
34 type_names['gint'] = TYPE_INT32
35 type_names['guint'] = TYPE_UINT32
36 type_names['gint32'] = TYPE_INT32
37 type_names['guint32'] = TYPE_UINT32
38 type_names['glong'] = TYPE_LONG
39 type_names['gulong'] = TYPE_ULONG
40 type_names['gfloat'] = TYPE_FLOAT
41 type_names['gdouble'] = TYPE_DOUBLE
42 type_names['gchar*'] = TYPE_STRING
43 type_names['gboolean'] = TYPE_BOOLEAN
44 type_names['gpointer'] = TYPE_ANY
45 type_names['gsize'] = TYPE_SIZE
46 type_names['gssize'] = TYPE_SSIZE
51 def __init__(self, name, type_name, members, get_type):
52 Enum.__init__(self, name, type_name, members)
53 self.ctype = type_name
54 self.type_name = type_name
55 self.get_type = get_type
58 return '%s(%r, %r, %r)' % (
59 self.__class__.__name__,
65 class GLibFlags(GLibEnum):
69 class GLibEnumMember(Member):
71 def __init__(self, name, value, symbol, nick):
72 Member.__init__(self, name, value, symbol)
76 class GLibObject(Class):
78 def __init__(self, name, parent, type_name, get_type):
79 Class.__init__(self, name, parent)
80 self.ctype = type_name
81 self.type_name = type_name
82 self.get_type = get_type
86 class GLibBoxed(Struct):
88 def __init__(self, name, type_name, get_type):
89 Struct.__init__(self, name, get_type)
91 self.constructors = []
93 self.type_name = type_name
94 self.symbol = type_name
95 self.get_type = get_type
98 class GLibInterface(Interface):
100 def __init__(self, name, parent, type_name, get_type):
101 Interface.__init__(self, name, parent)
102 self.ctype = type_name
103 self.type_name = type_name
104 self.get_type = get_type
108 class GLibProperty(Property):
112 class GLibSignal(Node):
114 def __init__(self, name, retval):
115 Node.__init__(self, name)