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  * Conversion parameters:
26  * inFile  = 
27  * outPack = gio
28  * outFile = DBusNodeInfo
29  * strct   = GDBusNodeInfo
30  * realStrct=
31  * ctorStrct=
32  * clss    = DBusNodeInfo
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_dbus_node_info_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- glib.ErrorG
48  * 	- glib.GException
49  * 	- glib.StringG
50  * 	- gio.DBusInterfaceInfo
51  * structWrap:
52  * 	- GDBusInterfaceInfo* -> DBusInterfaceInfo
53  * 	- GDBusNodeInfo* -> DBusNodeInfo
54  * 	- GString* -> StringG
55  * module aliases:
56  * local aliases:
57  * overrides:
58  */
59 
60 module gio.DBusNodeInfo;
61 
62 public  import gtkc.giotypes;
63 
64 private import gtkc.gio;
65 private import glib.ConstructionException;
66 private import gobject.ObjectG;
67 
68 private import glib.Str;
69 private import glib.ErrorG;
70 private import glib.GException;
71 private import glib.StringG;
72 private import gio.DBusInterfaceInfo;
73 
74 
75 
76 /**
77  * Various data structures and convenience routines to parse and
78  * generate D-Bus introspection XML. Introspection information is
79  * used when registering objects with g_dbus_connection_register_object().
80  *
81  * The format of D-Bus introspection XML is specified in the
82  * D-Bus specification.
83  */
84 public class DBusNodeInfo
85 {
86 	
87 	/** the main Gtk struct */
88 	protected GDBusNodeInfo* gDBusNodeInfo;
89 	
90 	
91 	/** Get the main Gtk struct */
92 	public GDBusNodeInfo* getDBusNodeInfoStruct()
93 	{
94 		return gDBusNodeInfo;
95 	}
96 	
97 	
98 	/** the main Gtk struct as a void* */
99 	protected void* getStruct()
100 	{
101 		return cast(void*)gDBusNodeInfo;
102 	}
103 	
104 	/**
105 	 * Sets our main struct and passes it to the parent class
106 	 */
107 	public this (GDBusNodeInfo* gDBusNodeInfo)
108 	{
109 		this.gDBusNodeInfo = gDBusNodeInfo;
110 	}
111 	
112 	/**
113 	 */
114 	
115 	/**
116 	 * Parses xml_data and returns a GDBusNodeInfo representing the data.
117 	 * The introspection XML must contain exactly one top-level
118 	 * <node> element.
119 	 * Note that this routine is using a
120 	 * GMarkup-based
121 	 * parser that only accepts a subset of valid XML documents.
122 	 * Since 2.26
123 	 * Params:
124 	 * xmlData = Valid D-Bus introspection XML.
125 	 * Throws: GException on failure.
126 	 * Throws: ConstructionException GTK+ fails to create the object.
127 	 */
128 	public this (string xmlData)
129 	{
130 		// GDBusNodeInfo * g_dbus_node_info_new_for_xml (const gchar *xml_data,  GError **error);
131 		GError* err = null;
132 		
133 		auto p = g_dbus_node_info_new_for_xml(Str.toStringz(xmlData), &err);
134 		
135 		if (err !is null)
136 		{
137 			throw new GException( new ErrorG(err) );
138 		}
139 		
140 		if(p is null)
141 		{
142 			throw new ConstructionException("null returned by g_dbus_node_info_new_for_xml(Str.toStringz(xmlData), &err)");
143 		}
144 		this(cast(GDBusNodeInfo*) p);
145 	}
146 	
147 	/**
148 	 * Looks up information about an interface.
149 	 * The cost of this function is O(n) in number of interfaces.
150 	 * Since 2.26
151 	 * Params:
152 	 * name = A D-Bus interface name.
153 	 * Returns: A GDBusInterfaceInfo or NULL if not found. Do not free, it is owned by info. [transfer none]
154 	 */
155 	public DBusInterfaceInfo lookupInterface(string name)
156 	{
157 		// GDBusInterfaceInfo * g_dbus_node_info_lookup_interface (GDBusNodeInfo *info,  const gchar *name);
158 		auto p = g_dbus_node_info_lookup_interface(gDBusNodeInfo, Str.toStringz(name));
159 		
160 		if(p is null)
161 		{
162 			return null;
163 		}
164 		
165 		return ObjectG.getDObject!(DBusInterfaceInfo)(cast(GDBusInterfaceInfo*) p);
166 	}
167 	
168 	/**
169 	 * Appends an XML representation of info (and its children) to string_builder.
170 	 * This function is typically used for generating introspection XML documents at run-time for
171 	 * handling the org.freedesktop.DBus.Introspectable.Introspect method.
172 	 * Since 2.26
173 	 * Params:
174 	 * indent = Indentation level.
175 	 * stringBuilder = A GString to to append XML data to. [out]
176 	 */
177 	public void generateXml(uint indent, StringG stringBuilder)
178 	{
179 		// void g_dbus_node_info_generate_xml (GDBusNodeInfo *info,  guint indent,  GString *string_builder);
180 		g_dbus_node_info_generate_xml(gDBusNodeInfo, indent, (stringBuilder is null) ? null : stringBuilder.getStringGStruct());
181 	}
182 	
183 	/**
184 	 * If info is statically allocated does nothing. Otherwise increases
185 	 * the reference count.
186 	 * Since 2.26
187 	 * Returns: The same info.
188 	 */
189 	public DBusNodeInfo doref()
190 	{
191 		// GDBusNodeInfo * g_dbus_node_info_ref (GDBusNodeInfo *info);
192 		auto p = g_dbus_node_info_ref(gDBusNodeInfo);
193 		
194 		if(p is null)
195 		{
196 			return null;
197 		}
198 		
199 		return ObjectG.getDObject!(DBusNodeInfo)(cast(GDBusNodeInfo*) p);
200 	}
201 	
202 	/**
203 	 * If info is statically allocated, does nothing. Otherwise decreases
204 	 * the reference count of info. When its reference count drops to 0,
205 	 * the memory used is freed.
206 	 * Since 2.26
207 	 */
208 	public void unref()
209 	{
210 		// void g_dbus_node_info_unref (GDBusNodeInfo *info);
211 		g_dbus_node_info_unref(gDBusNodeInfo);
212 	}
213 }