-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.c
173 lines (135 loc) · 5.15 KB
/
test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/* test.c generated by valac 0.34.2, the Vala compiler
* generated from test.vala, do not modify */
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#define TEST_TYPE_FOO (test_foo_get_type ())
#define TEST_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_FOO, TestFoo))
#define TEST_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_TYPE_FOO, TestFooClass))
#define TEST_IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_TYPE_FOO))
#define TEST_IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEST_TYPE_FOO))
#define TEST_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_FOO, TestFooClass))
typedef struct _TestFoo TestFoo;
typedef struct _TestFooClass TestFooClass;
typedef struct _TestFooPrivate TestFooPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
struct _TestFoo {
GObject parent_instance;
TestFooPrivate * priv;
};
struct _TestFooClass {
GObjectClass parent_class;
};
struct _TestFooPrivate {
gint some;
gchar* _prop;
};
static gpointer test_foo_parent_class = NULL;
GType test_foo_get_type (void) G_GNUC_CONST;
#define TEST_FOO_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TEST_TYPE_FOO, TestFooPrivate))
enum {
TEST_FOO_DUMMY_PROPERTY,
TEST_FOO_PROP
};
TestFoo* test_foo_new (void);
TestFoo* test_foo_construct (GType object_type);
const gchar* test_foo_get_prop (TestFoo* self);
void test_foo_set_prop (TestFoo* self, const gchar* value);
static void test_foo_finalize (GObject* obj);
static void _vala_test_foo_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_test_foo_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
void test_main (void);
TestFoo* test_foo_construct (GType object_type) {
TestFoo * self = NULL;
self = (TestFoo*) g_object_new (object_type, NULL);
return self;
}
TestFoo* test_foo_new (void) {
return test_foo_construct (TEST_TYPE_FOO);
}
const gchar* test_foo_get_prop (TestFoo* self) {
const gchar* result;
const gchar* _tmp0_ = NULL;
g_return_val_if_fail (self != NULL, NULL);
_tmp0_ = self->priv->_prop;
result = _tmp0_;
return result;
}
void test_foo_set_prop (TestFoo* self, const gchar* value) {
const gchar* _tmp0_ = NULL;
gchar* _tmp1_ = NULL;
g_return_if_fail (self != NULL);
_tmp0_ = value;
_tmp1_ = g_strdup (_tmp0_);
_g_free0 (self->priv->_prop);
self->priv->_prop = _tmp1_;
g_object_notify ((GObject *) self, "prop");
}
static void test_foo_class_init (TestFooClass * klass) {
test_foo_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (TestFooPrivate));
G_OBJECT_CLASS (klass)->get_property = _vala_test_foo_get_property;
G_OBJECT_CLASS (klass)->set_property = _vala_test_foo_set_property;
G_OBJECT_CLASS (klass)->finalize = test_foo_finalize;
g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_FOO_PROP, g_param_spec_string ("prop", "prop", "prop", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}
static void test_foo_instance_init (TestFoo * self) {
self->priv = TEST_FOO_GET_PRIVATE (self);
self->priv->some = 5;
}
static void test_foo_finalize (GObject* obj) {
TestFoo * self;
self = G_TYPE_CHECK_INSTANCE_CAST (obj, TEST_TYPE_FOO, TestFoo);
_g_free0 (self->priv->_prop);
G_OBJECT_CLASS (test_foo_parent_class)->finalize (obj);
}
GType test_foo_get_type (void) {
static volatile gsize test_foo_type_id__volatile = 0;
if (g_once_init_enter (&test_foo_type_id__volatile)) {
static const GTypeInfo g_define_type_info = { sizeof (TestFooClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) test_foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TestFoo), 0, (GInstanceInitFunc) test_foo_instance_init, NULL };
GType test_foo_type_id;
test_foo_type_id = g_type_register_static (G_TYPE_OBJECT, "TestFoo", &g_define_type_info, 0);
g_once_init_leave (&test_foo_type_id__volatile, test_foo_type_id);
}
return test_foo_type_id__volatile;
}
static void _vala_test_foo_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
TestFoo * self;
self = G_TYPE_CHECK_INSTANCE_CAST (object, TEST_TYPE_FOO, TestFoo);
switch (property_id) {
case TEST_FOO_PROP:
g_value_set_string (value, test_foo_get_prop (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void _vala_test_foo_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
TestFoo * self;
self = G_TYPE_CHECK_INSTANCE_CAST (object, TEST_TYPE_FOO, TestFoo);
switch (property_id) {
case TEST_FOO_PROP:
test_foo_set_prop (self, g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
void test_main (void) {
TestFoo* bar = NULL;
TestFoo* _tmp0_ = NULL;
_tmp0_ = test_foo_new ();
bar = _tmp0_;
_g_object_unref0 (bar);
}
int main (int argc, char ** argv) {
#if !GLIB_CHECK_VERSION (2,35,0)
g_type_init ();
#endif
test_main ();
return 0;
}