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.DBusNodeInfo; 26 27 private import gio.DBusInterfaceInfo; 28 private import glib.ConstructionException; 29 private import glib.ErrorG; 30 private import glib.GException; 31 private import glib.Str; 32 private import glib.StringG; 33 private import gobject.ObjectG; 34 private import gtkc.gio; 35 public import gtkc.giotypes; 36 37 38 /** 39 * Information about nodes in a remote object hierarchy. 40 * 41 * Since: 2.26 42 */ 43 public class DBusNodeInfo 44 { 45 /** the main Gtk struct */ 46 protected GDBusNodeInfo* gDBusNodeInfo; 47 48 /** Get the main Gtk struct */ 49 public GDBusNodeInfo* getDBusNodeInfoStruct() 50 { 51 return gDBusNodeInfo; 52 } 53 54 /** the main Gtk struct as a void* */ 55 protected void* getStruct() 56 { 57 return cast(void*)gDBusNodeInfo; 58 } 59 60 /** 61 * Sets our main struct and passes it to the parent class. 62 */ 63 public this (GDBusNodeInfo* gDBusNodeInfo) 64 { 65 this.gDBusNodeInfo = gDBusNodeInfo; 66 } 67 68 69 /** */ 70 public static GType getType() 71 { 72 return g_dbus_node_info_get_type(); 73 } 74 75 /** 76 * Parses @xml_data and returns a #GDBusNodeInfo representing the data. 77 * 78 * The introspection XML must contain exactly one top-level 79 * <node> element. 80 * 81 * Note that this routine is using a 82 * [GMarkup][glib-Simple-XML-Subset-Parser.description]-based 83 * parser that only accepts a subset of valid XML documents. 84 * 85 * Params: 86 * xmlData = Valid D-Bus introspection XML. 87 * 88 * Return: A #GDBusNodeInfo structure or %NULL if @error is set. Free 89 * with g_dbus_node_info_unref(). 90 * 91 * Since: 2.26 92 * 93 * Throws: GException on failure. 94 * Throws: ConstructionException GTK+ fails to create the object. 95 */ 96 public this(string xmlData) 97 { 98 GError* err = null; 99 100 auto p = g_dbus_node_info_new_for_xml(Str.toStringz(xmlData), &err); 101 102 if (err !is null) 103 { 104 throw new GException( new ErrorG(err) ); 105 } 106 107 if(p is null) 108 { 109 throw new ConstructionException("null returned by new_for_xml"); 110 } 111 112 this(cast(GDBusNodeInfo*) p); 113 } 114 115 /** 116 * Appends an XML representation of @info (and its children) to @string_builder. 117 * 118 * This function is typically used for generating introspection XML documents at run-time for 119 * handling the `org.freedesktop.DBus.Introspectable.Introspect` method. 120 * 121 * Params: 122 * indent = Indentation level. 123 * stringBuilder = A #GString to to append XML data to. 124 * 125 * Since: 2.26 126 */ 127 public void generateXml(uint indent, out StringG stringBuilder) 128 { 129 GString* outstringBuilder = gMalloc!GString(); 130 131 g_dbus_node_info_generate_xml(gDBusNodeInfo, indent, outstringBuilder); 132 133 stringBuilder = new StringG(outstringBuilder); 134 } 135 136 /** 137 * Looks up information about an interface. 138 * 139 * The cost of this function is O(n) in number of interfaces. 140 * 141 * Params: 142 * name = A D-Bus interface name. 143 * 144 * Return: A #GDBusInterfaceInfo or %NULL if not found. Do not free, it is owned by @info. 145 * 146 * Since: 2.26 147 */ 148 public DBusInterfaceInfo lookupInterface(string name) 149 { 150 auto p = g_dbus_node_info_lookup_interface(gDBusNodeInfo, Str.toStringz(name)); 151 152 if(p is null) 153 { 154 return null; 155 } 156 157 return ObjectG.getDObject!(DBusInterfaceInfo)(cast(GDBusInterfaceInfo*) p); 158 } 159 160 /** 161 * If @info is statically allocated does nothing. Otherwise increases 162 * the reference count. 163 * 164 * Return: The same @info. 165 * 166 * Since: 2.26 167 */ 168 public DBusNodeInfo doref() 169 { 170 auto p = g_dbus_node_info_ref(gDBusNodeInfo); 171 172 if(p is null) 173 { 174 return null; 175 } 176 177 return ObjectG.getDObject!(DBusNodeInfo)(cast(GDBusNodeInfo*) p); 178 } 179 180 /** 181 * If @info is statically allocated, does nothing. Otherwise decreases 182 * the reference count of @info. When its reference count drops to 0, 183 * the memory used is freed. 184 * 185 * Since: 2.26 186 */ 187 public void unref() 188 { 189 g_dbus_node_info_unref(gDBusNodeInfo); 190 } 191 }