source: appstream-generator/build/girepo/gio/DBusNodeInfo.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 4.5 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module gio.DBusNodeInfo;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.DBusInterfaceInfo;
26private import glib.ConstructionException;
27private import glib.ErrorG;
28private import glib.GException;
29private import glib.Str;
30private import glib.StringG;
31private import gobject.ObjectG;
32
33
34/**
35 * Information about nodes in a remote object hierarchy.
36 *
37 * Since: 2.26
38 */
39public class DBusNodeInfo
40{
41        /** the main Gtk struct */
42        protected GDBusNodeInfo* gDBusNodeInfo;
43        protected bool ownedRef;
44
45        /** Get the main Gtk struct */
46        public GDBusNodeInfo* getDBusNodeInfoStruct()
47        {
48                return gDBusNodeInfo;
49        }
50
51        /** the main Gtk struct as a void* */
52        protected void* getStruct()
53        {
54                return cast(void*)gDBusNodeInfo;
55        }
56
57        /**
58         * Sets our main struct and passes it to the parent class.
59         */
60        public this (GDBusNodeInfo* gDBusNodeInfo, bool ownedRef = false)
61        {
62                this.gDBusNodeInfo = gDBusNodeInfo;
63                this.ownedRef = ownedRef;
64        }
65
66
67        /** */
68        public static GType getType()
69        {
70                return g_dbus_node_info_get_type();
71        }
72
73        /**
74         * Parses @xml_data and returns a #GDBusNodeInfo representing the data.
75         *
76         * The introspection XML must contain exactly one top-level
77         * <node> element.
78         *
79         * Note that this routine is using a
80         * [GMarkup][glib-Simple-XML-Subset-Parser.description]-based
81         * parser that only accepts a subset of valid XML documents.
82         *
83         * Params:
84         *     xmlData = Valid D-Bus introspection XML.
85         *
86         * Returns: A #GDBusNodeInfo structure or %NULL if @error is set. Free
87         *     with g_dbus_node_info_unref().
88         *
89         * Since: 2.26
90         *
91         * Throws: GException on failure.
92         * Throws: ConstructionException GTK+ fails to create the object.
93         */
94        public this(string xmlData)
95        {
96                GError* err = null;
97               
98                auto p = g_dbus_node_info_new_for_xml(Str.toStringz(xmlData), &err);
99               
100                if (err !is null)
101                {
102                        throw new GException( new ErrorG(err) );
103                }
104               
105                if(p is null)
106                {
107                        throw new ConstructionException("null returned by new_for_xml");
108                }
109               
110                this(cast(GDBusNodeInfo*) p);
111        }
112
113        /**
114         * Appends an XML representation of @info (and its children) to @string_builder.
115         *
116         * This function is typically used for generating introspection XML documents at run-time for
117         * handling the `org.freedesktop.DBus.Introspectable.Introspect`  method.
118         *
119         * Params:
120         *     indent = Indentation level.
121         *     stringBuilder = A #GString to to append XML data to.
122         *
123         * Since: 2.26
124         */
125        public void generateXml(uint indent, out StringG stringBuilder)
126        {
127                GString* outstringBuilder = gMalloc!GString();
128               
129                g_dbus_node_info_generate_xml(gDBusNodeInfo, indent, outstringBuilder);
130               
131                stringBuilder = new StringG(outstringBuilder, true);
132        }
133
134        /**
135         * Looks up information about an interface.
136         *
137         * The cost of this function is O(n) in number of interfaces.
138         *
139         * Params:
140         *     name = A D-Bus interface name.
141         *
142         * Returns: A #GDBusInterfaceInfo or %NULL if not found. Do not free, it is owned by @info.
143         *
144         * Since: 2.26
145         */
146        public DBusInterfaceInfo lookupInterface(string name)
147        {
148                auto p = g_dbus_node_info_lookup_interface(gDBusNodeInfo, Str.toStringz(name));
149               
150                if(p is null)
151                {
152                        return null;
153                }
154               
155                return ObjectG.getDObject!(DBusInterfaceInfo)(cast(GDBusInterfaceInfo*) p);
156        }
157
158        /**
159         * If @info is statically allocated does nothing. Otherwise increases
160         * the reference count.
161         *
162         * Returns: The same @info.
163         *
164         * Since: 2.26
165         */
166        public DBusNodeInfo doref()
167        {
168                auto p = g_dbus_node_info_ref(gDBusNodeInfo);
169               
170                if(p is null)
171                {
172                        return null;
173                }
174               
175                return ObjectG.getDObject!(DBusNodeInfo)(cast(GDBusNodeInfo*) p, true);
176        }
177
178        /**
179         * If @info is statically allocated, does nothing. Otherwise decreases
180         * the reference count of @info. When its reference count drops to 0,
181         * the memory used is freed.
182         *
183         * Since: 2.26
184         */
185        public void unref()
186        {
187                g_dbus_node_info_unref(gDBusNodeInfo);
188        }
189}
Note: See TracBrowser for help on using the repository browser.