1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-gidl.c data structure describing an interface, to be generated from IDL
5 * Copyright (C) 2003 Red Hat, Inc.
7 * Licensed under the Academic Free License version 1.2
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program 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
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "dbus-gidl.h"
54 ArgDirection direction;
58 free_method_list (GSList **methods_p)
64 method_info_unref (tmp->data);
67 g_slist_free (*methods_p);
72 free_signal_list (GSList **signals_p)
78 signal_info_unref (tmp->data);
81 g_slist_free (*signals_p);
86 interface_info_new (const char *name)
90 info = g_new0 (InterfaceInfo, 1);
92 info->name = g_strdup (name);
98 interface_info_ref (InterfaceInfo *info)
104 interface_info_unref (InterfaceInfo *info)
107 if (info->refcount == 0)
109 free_method_list (&info->methods);
110 free_signal_list (&info->signals);
117 interface_info_get_methods (InterfaceInfo *info)
119 return info->methods;
123 interface_info_get_signals (InterfaceInfo *info)
125 return info->signals;
129 interface_info_add_method (InterfaceInfo *info,
132 method_info_ref (method);
133 info->methods = g_slist_append (info->methods, method);
137 interface_info_add_signal (InterfaceInfo *info,
140 signal_info_ref (signal);
141 info->signals = g_slist_append (info->signals, signal);
145 free_arg_list (GSList **args_p)
151 arg_info_unref (tmp->data);
154 g_slist_free (*args_p);
159 method_info_new (const char *name)
163 info = g_new0 (MethodInfo, 1);
165 info->name = g_strdup (name);
171 method_info_ref (MethodInfo *info)
177 method_info_unref (MethodInfo *info)
180 if (info->refcount == 0)
182 free_arg_list (&info->args);
189 method_info_get_name (MethodInfo *info)
195 method_info_get_args (MethodInfo *info)
201 method_info_add_arg (MethodInfo *info,
205 info->args = g_slist_append (info->args, arg);
209 signal_info_new (const char *name)
213 info = g_new0 (SignalInfo, 1);
215 info->name = g_strdup (name);
221 signal_info_ref (SignalInfo *info)
227 signal_info_unref (SignalInfo *info)
230 if (info->refcount == 0)
232 free_arg_list (&info->args);
239 signal_info_get_name (SignalInfo *info)
245 signal_info_get_args (SignalInfo *info)
251 signal_info_add_arg (SignalInfo *info,
255 info->args = g_slist_append (info->args, arg);
259 arg_info_new (const char *name,
260 ArgDirection direction,
265 info = g_new0 (ArgInfo, 1);
267 info->name = g_strdup (name);
268 info->direction = direction;
275 arg_info_ref (ArgInfo *info)
281 arg_info_unref (ArgInfo *info)
284 if (info->refcount == 0)
291 arg_info_get_name (ArgInfo *info)
297 arg_info_get_type (ArgInfo *info)
303 arg_info_get_direction (ArgInfo *info)
305 return info->direction;
308 #ifdef DBUS_BUILD_TESTS
312 * Unit test for GLib IDL internals
313 * @returns #TRUE on success.
316 _dbus_gidl_test (void)
322 #endif /* DBUS_BUILD_TESTS */