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 
70 	public static GType getType()
71 	{
72 		return g_dbus_interface_info_get_type();
73 	}
74 
75 	/**
76 	 * Builds a lookup-cache to speed up
77 	 * g_dbus_interface_info_lookup_method(),
78 	 * g_dbus_interface_info_lookup_signal() and
79 	 * g_dbus_interface_info_lookup_property().
80 	 *
81 	 * If this has already been called with @info, the existing cache is
82 	 * used and its use count is increased.
83 	 *
84 	 * Note that @info cannot be modified until
85 	 * g_dbus_interface_info_cache_release() is called.
86 	 *
87 	 * Since: 2.30
88 	 */
89 	public void cacheBuild()
90 	{
91 		g_dbus_interface_info_cache_build(gDBusInterfaceInfo);
92 	}
93 
94 	/**
95 	 * Decrements the usage count for the cache for @info built by
96 	 * g_dbus_interface_info_cache_build() (if any) and frees the
97 	 * resources used by the cache if the usage count drops to zero.
98 	 *
99 	 * Since: 2.30
100 	 */
101 	public void cacheRelease()
102 	{
103 		g_dbus_interface_info_cache_release(gDBusInterfaceInfo);
104 	}
105 
106 	/**
107 	 * Appends an XML representation of @info (and its children) to @string_builder.
108 	 *
109 	 * This function is typically used for generating introspection XML
110 	 * documents at run-time for handling the
111 	 * `org.freedesktop.DBus.Introspectable.Introspect`
112 	 * method.
113 	 *
114 	 * Params:
115 	 *     indent = Indentation level.
116 	 *     stringBuilder = A #GString to to append XML data to.
117 	 *
118 	 * Since: 2.26
119 	 */
120 	public void generateXml(uint indent, out StringG stringBuilder)
121 	{
122 		GString* outstringBuilder = new GString;
123 		
124 		g_dbus_interface_info_generate_xml(gDBusInterfaceInfo, indent, outstringBuilder);
125 		
126 		stringBuilder = new StringG(outstringBuilder);
127 	}
128 
129 	/**
130 	 * Looks up information about a method.
131 	 *
132 	 * The cost of this function is O(n) in number of methods unless
133 	 * g_dbus_interface_info_cache_build() has been used on @info.
134 	 *
135 	 * Params:
136 	 *     name = A D-Bus method name (typically in CamelCase)
137 	 *
138 	 * Return: A #GDBusMethodInfo or %NULL if not found. Do not free, it is owned by @info.
139 	 *
140 	 * Since: 2.26
141 	 */
142 	public DBusMethodInfo lookupMethod(string name)
143 	{
144 		auto p = g_dbus_interface_info_lookup_method(gDBusInterfaceInfo, Str.toStringz(name));
145 		
146 		if(p is null)
147 		{
148 			return null;
149 		}
150 		
151 		return ObjectG.getDObject!(DBusMethodInfo)(cast(GDBusMethodInfo*) p);
152 	}
153 
154 	/**
155 	 * Looks up information about a property.
156 	 *
157 	 * The cost of this function is O(n) in number of properties unless
158 	 * g_dbus_interface_info_cache_build() has been used on @info.
159 	 *
160 	 * Params:
161 	 *     name = A D-Bus property name (typically in CamelCase).
162 	 *
163 	 * Return: A #GDBusPropertyInfo or %NULL if not found. Do not free, it is owned by @info.
164 	 *
165 	 * Since: 2.26
166 	 */
167 	public DBusPropertyInfo lookupProperty(string name)
168 	{
169 		auto p = g_dbus_interface_info_lookup_property(gDBusInterfaceInfo, Str.toStringz(name));
170 		
171 		if(p is null)
172 		{
173 			return null;
174 		}
175 		
176 		return ObjectG.getDObject!(DBusPropertyInfo)(cast(GDBusPropertyInfo*) p);
177 	}
178 
179 	/**
180 	 * Looks up information about a signal.
181 	 *
182 	 * The cost of this function is O(n) in number of signals unless
183 	 * g_dbus_interface_info_cache_build() has been used on @info.
184 	 *
185 	 * Params:
186 	 *     name = A D-Bus signal name (typically in CamelCase)
187 	 *
188 	 * Return: A #GDBusSignalInfo or %NULL if not found. Do not free, it is owned by @info.
189 	 *
190 	 * Since: 2.26
191 	 */
192 	public DBusSignalInfo lookupSignal(string name)
193 	{
194 		auto p = g_dbus_interface_info_lookup_signal(gDBusInterfaceInfo, Str.toStringz(name));
195 		
196 		if(p is null)
197 		{
198 			return null;
199 		}
200 		
201 		return ObjectG.getDObject!(DBusSignalInfo)(cast(GDBusSignalInfo*) p);
202 	}
203 
204 	/**
205 	 * If @info is statically allocated does nothing. Otherwise increases
206 	 * the reference count.
207 	 *
208 	 * Return: The same @info.
209 	 *
210 	 * Since: 2.26
211 	 */
212 	public DBusInterfaceInfo doref()
213 	{
214 		auto p = g_dbus_interface_info_ref(gDBusInterfaceInfo);
215 		
216 		if(p is null)
217 		{
218 			return null;
219 		}
220 		
221 		return ObjectG.getDObject!(DBusInterfaceInfo)(cast(GDBusInterfaceInfo*) p);
222 	}
223 
224 	/**
225 	 * If @info is statically allocated, does nothing. Otherwise decreases
226 	 * the reference count of @info. When its reference count drops to 0,
227 	 * the memory used is freed.
228 	 *
229 	 * Since: 2.26
230 	 */
231 	public void unref()
232 	{
233 		g_dbus_interface_info_unref(gDBusInterfaceInfo);
234 	}
235 }