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