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