1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD 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 Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gio.DBusInterfaceInfo;
26 
27 private import gio.DBusMethodInfo;
28 private import gio.DBusPropertyInfo;
29 private import gio.DBusSignalInfo;
30 private import glib.Str;
31 private import glib.StringG;
32 private import gobject.ObjectG;
33 private import gtkc.gio;
34 public  import gtkc.giotypes;
35 
36 
37 /**
38  * Information about a D-Bus interface.
39  *
40  * Since: 2.26
41  */
42 public class DBusInterfaceInfo
43 {
44 	/** the main Gtk struct */
45 	protected GDBusInterfaceInfo* gDBusInterfaceInfo;
46 
47 	/** Get the main Gtk struct */
48 	public GDBusInterfaceInfo* getDBusInterfaceInfoStruct()
49 	{
50 		return gDBusInterfaceInfo;
51 	}
52 
53 	/** the main Gtk struct as a void* */
54 	protected void* getStruct()
55 	{
56 		return cast(void*)gDBusInterfaceInfo;
57 	}
58 
59 	/**
60 	 * Sets our main struct and passes it to the parent class.
61 	 */
62 	public this (GDBusInterfaceInfo* gDBusInterfaceInfo)
63 	{
64 		this.gDBusInterfaceInfo = gDBusInterfaceInfo;
65 	}
66 
67 
68 	/** */
69 	public static GType getType()
70 	{
71 		return g_dbus_interface_info_get_type();
72 	}
73 
74 	/**
75 	 * Builds a lookup-cache to speed up
76 	 * g_dbus_interface_info_lookup_method(),
77 	 * g_dbus_interface_info_lookup_signal() and
78 	 * g_dbus_interface_info_lookup_property().
79 	 *
80 	 * If this has already been called with @info, the existing cache is
81 	 * used and its use count is increased.
82 	 *
83 	 * Note that @info cannot be modified until
84 	 * g_dbus_interface_info_cache_release() is called.
85 	 *
86 	 * Since: 2.30
87 	 */
88 	public void cacheBuild()
89 	{
90 		g_dbus_interface_info_cache_build(gDBusInterfaceInfo);
91 	}
92 
93 	/**
94 	 * Decrements the usage count for the cache for @info built by
95 	 * g_dbus_interface_info_cache_build() (if any) and frees the
96 	 * resources used by the cache if the usage count drops to zero.
97 	 *
98 	 * Since: 2.30
99 	 */
100 	public void cacheRelease()
101 	{
102 		g_dbus_interface_info_cache_release(gDBusInterfaceInfo);
103 	}
104 
105 	/**
106 	 * Appends an XML representation of @info (and its children) to @string_builder.
107 	 *
108 	 * This function is typically used for generating introspection XML
109 	 * documents at run-time for handling the
110 	 * `org.freedesktop.DBus.Introspectable.Introspect`
111 	 * method.
112 	 *
113 	 * Params:
114 	 *     indent = Indentation level.
115 	 *     stringBuilder = A #GString to to append XML data to.
116 	 *
117 	 * Since: 2.26
118 	 */
119 	public void generateXml(uint indent, out StringG stringBuilder)
120 	{
121 		GString* outstringBuilder = gMalloc!GString();
122 		
123 		g_dbus_interface_info_generate_xml(gDBusInterfaceInfo, indent, outstringBuilder);
124 		
125 		stringBuilder = new StringG(outstringBuilder);
126 	}
127 
128 	/**
129 	 * Looks up information about a method.
130 	 *
131 	 * The cost of this function is O(n) in number of methods unless
132 	 * g_dbus_interface_info_cache_build() has been used on @info.
133 	 *
134 	 * Params:
135 	 *     name = A D-Bus method name (typically in CamelCase)
136 	 *
137 	 * Return: A #GDBusMethodInfo or %NULL if not found. Do not free, it is owned by @info.
138 	 *
139 	 * Since: 2.26
140 	 */
141 	public DBusMethodInfo lookupMethod(string name)
142 	{
143 		auto p = g_dbus_interface_info_lookup_method(gDBusInterfaceInfo, Str.toStringz(name));
144 		
145 		if(p is null)
146 		{
147 			return null;
148 		}
149 		
150 		return ObjectG.getDObject!(DBusMethodInfo)(cast(GDBusMethodInfo*) p);
151 	}
152 
153 	/**
154 	 * Looks up information about a property.
155 	 *
156 	 * The cost of this function is O(n) in number of properties unless
157 	 * g_dbus_interface_info_cache_build() has been used on @info.
158 	 *
159 	 * Params:
160 	 *     name = A D-Bus property name (typically in CamelCase).
161 	 *
162 	 * Return: A #GDBusPropertyInfo or %NULL if not found. Do not free, it is owned by @info.
163 	 *
164 	 * Since: 2.26
165 	 */
166 	public DBusPropertyInfo lookupProperty(string name)
167 	{
168 		auto p = g_dbus_interface_info_lookup_property(gDBusInterfaceInfo, Str.toStringz(name));
169 		
170 		if(p is null)
171 		{
172 			return null;
173 		}
174 		
175 		return ObjectG.getDObject!(DBusPropertyInfo)(cast(GDBusPropertyInfo*) p);
176 	}
177 
178 	/**
179 	 * Looks up information about a signal.
180 	 *
181 	 * The cost of this function is O(n) in number of signals unless
182 	 * g_dbus_interface_info_cache_build() has been used on @info.
183 	 *
184 	 * Params:
185 	 *     name = A D-Bus signal name (typically in CamelCase)
186 	 *
187 	 * Return: A #GDBusSignalInfo or %NULL if not found. Do not free, it is owned by @info.
188 	 *
189 	 * Since: 2.26
190 	 */
191 	public DBusSignalInfo lookupSignal(string name)
192 	{
193 		auto p = g_dbus_interface_info_lookup_signal(gDBusInterfaceInfo, Str.toStringz(name));
194 		
195 		if(p is null)
196 		{
197 			return null;
198 		}
199 		
200 		return ObjectG.getDObject!(DBusSignalInfo)(cast(GDBusSignalInfo*) p);
201 	}
202 
203 	/**
204 	 * If @info is statically allocated does nothing. Otherwise increases
205 	 * the reference count.
206 	 *
207 	 * Return: The same @info.
208 	 *
209 	 * Since: 2.26
210 	 */
211 	public DBusInterfaceInfo doref()
212 	{
213 		auto p = g_dbus_interface_info_ref(gDBusInterfaceInfo);
214 		
215 		if(p is null)
216 		{
217 			return null;
218 		}
219 		
220 		return ObjectG.getDObject!(DBusInterfaceInfo)(cast(GDBusInterfaceInfo*) p);
221 	}
222 
223 	/**
224 	 * If @info is statically allocated, does nothing. Otherwise decreases
225 	 * the reference count of @info. When its reference count drops to 0,
226 	 * the memory used is freed.
227 	 *
228 	 * Since: 2.26
229 	 */
230 	public void unref()
231 	{
232 		g_dbus_interface_info_unref(gDBusInterfaceInfo);
233 	}
234 }