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

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

Initial release

File size: 5.0 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.SocketAddressEnumerator;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.AsyncResultIF;
26private import gio.Cancellable;
27private import gio.SocketAddress;
28private import glib.ErrorG;
29private import glib.GException;
30private import gobject.ObjectG;
31
32
33/**
34 * Enumerator type for objects that contain or generate
35 * #GSocketAddress<!-- -->es.
36 */
37public class SocketAddressEnumerator : ObjectG
38{
39        /** the main Gtk struct */
40        protected GSocketAddressEnumerator* gSocketAddressEnumerator;
41
42        /** Get the main Gtk struct */
43        public GSocketAddressEnumerator* getSocketAddressEnumeratorStruct()
44        {
45                return gSocketAddressEnumerator;
46        }
47
48        /** the main Gtk struct as a void* */
49        protected override void* getStruct()
50        {
51                return cast(void*)gSocketAddressEnumerator;
52        }
53
54        protected override void setStruct(GObject* obj)
55        {
56                gSocketAddressEnumerator = cast(GSocketAddressEnumerator*)obj;
57                super.setStruct(obj);
58        }
59
60        /**
61         * Sets our main struct and passes it to the parent class.
62         */
63        public this (GSocketAddressEnumerator* gSocketAddressEnumerator, bool ownedRef = false)
64        {
65                this.gSocketAddressEnumerator = gSocketAddressEnumerator;
66                super(cast(GObject*)gSocketAddressEnumerator, ownedRef);
67        }
68
69
70        /** */
71        public static GType getType()
72        {
73                return g_socket_address_enumerator_get_type();
74        }
75
76        /**
77         * Retrieves the next #GSocketAddress from @enumerator. Note that this
78         * may block for some amount of time. (Eg, a #GNetworkAddress may need
79         * to do a DNS lookup before it can return an address.) Use
80         * g_socket_address_enumerator_next_async() if you need to avoid
81         * blocking.
82         *
83         * If @enumerator is expected to yield addresses, but for some reason
84         * is unable to (eg, because of a DNS error), then the first call to
85         * g_socket_address_enumerator_next() will return an appropriate error
86         * in *@error. However, if the first call to
87         * g_socket_address_enumerator_next() succeeds, then any further
88         * internal errors (other than @cancellable being triggered) will be
89         * ignored.
90         *
91         * Params:
92         *     cancellable = optional #GCancellable object, %NULL to ignore.
93         *
94         * Returns: a #GSocketAddress (owned by the caller), or %NULL on
95         *     error (in which case *@error will be set) or if there are no
96         *     more addresses.
97         *
98         * Throws: GException on failure.
99         */
100        public SocketAddress next(Cancellable cancellable)
101        {
102                GError* err = null;
103               
104                auto p = g_socket_address_enumerator_next(gSocketAddressEnumerator, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
105               
106                if (err !is null)
107                {
108                        throw new GException( new ErrorG(err) );
109                }
110               
111                if(p is null)
112                {
113                        return null;
114                }
115               
116                return ObjectG.getDObject!(SocketAddress)(cast(GSocketAddress*) p, true);
117        }
118
119        /**
120         * Asynchronously retrieves the next #GSocketAddress from @enumerator
121         * and then calls @callback, which must call
122         * g_socket_address_enumerator_next_finish() to get the result.
123         *
124         * Params:
125         *     cancellable = optional #GCancellable object, %NULL to ignore.
126         *     callback = a #GAsyncReadyCallback to call when the request
127         *         is satisfied
128         *     userData = the data to pass to callback function
129         */
130        public void nextAsync(Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
131        {
132                g_socket_address_enumerator_next_async(gSocketAddressEnumerator, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
133        }
134
135        /**
136         * Retrieves the result of a completed call to
137         * g_socket_address_enumerator_next_async(). See
138         * g_socket_address_enumerator_next() for more information about
139         * error handling.
140         *
141         * Params:
142         *     result = a #GAsyncResult
143         *
144         * Returns: a #GSocketAddress (owned by the caller), or %NULL on
145         *     error (in which case *@error will be set) or if there are no
146         *     more addresses.
147         *
148         * Throws: GException on failure.
149         */
150        public SocketAddress nextFinish(AsyncResultIF result)
151        {
152                GError* err = null;
153               
154                auto p = g_socket_address_enumerator_next_finish(gSocketAddressEnumerator, (result is null) ? null : result.getAsyncResultStruct(), &err);
155               
156                if (err !is null)
157                {
158                        throw new GException( new ErrorG(err) );
159                }
160               
161                if(p is null)
162                {
163                        return null;
164                }
165               
166                return ObjectG.getDObject!(SocketAddress)(cast(GSocketAddress*) p, true);
167        }
168}
Note: See TracBrowser for help on using the repository browser.