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