source: appstream-generator/build/girepo/gio/ProxyResolverT.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.ProxyResolverT;
22
23public  import gi.gio;
24public  import gi.giotypes;
25public  import gio.AsyncResultIF;
26public  import gio.Cancellable;
27public  import gio.ProxyResolver;
28public  import gio.ProxyResolverIF;
29public  import glib.ErrorG;
30public  import glib.GException;
31public  import glib.Str;
32public  import gobject.ObjectG;
33
34
35/**
36 * #GProxyResolver provides synchronous and asynchronous network proxy
37 * resolution. #GProxyResolver is used within #GSocketClient through
38 * the method g_socket_connectable_proxy_enumerate().
39 *
40 * Since: 2.26
41 */
42public template ProxyResolverT(TStruct)
43{
44        /** Get the main Gtk struct */
45        public GProxyResolver* getProxyResolverStruct()
46        {
47                return cast(GProxyResolver*)getStruct();
48        }
49
50
51        /**
52         * Gets the default #GProxyResolver for the system.
53         *
54         * Returns: the default #GProxyResolver.
55         *
56         * Since: 2.26
57         */
58        public static ProxyResolverIF getDefault()
59        {
60                auto p = g_proxy_resolver_get_default();
61               
62                if(p is null)
63                {
64                        return null;
65                }
66               
67                return ObjectG.getDObject!(ProxyResolver, ProxyResolverIF)(cast(GProxyResolver*) p);
68        }
69
70        /**
71         * Checks if @resolver can be used on this system. (This is used
72         * internally; g_proxy_resolver_get_default() will only return a proxy
73         * resolver that returns %TRUE for this method.)
74         *
75         * Returns: %TRUE if @resolver is supported.
76         *
77         * Since: 2.26
78         */
79        public bool isSupported()
80        {
81                return g_proxy_resolver_is_supported(getProxyResolverStruct()) != 0;
82        }
83
84        /**
85         * Looks into the system proxy configuration to determine what proxy,
86         * if any, to use to connect to @uri. The returned proxy URIs are of
87         * the form `<protocol>://[user[:password]@]host:port` or
88         * `direct://`, where <protocol> could be http, rtsp, socks
89         * or other proxying protocol.
90         *
91         * If you don't know what network protocol is being used on the
92         * socket, you should use `none` as the URI protocol.
93         * In this case, the resolver might still return a generic proxy type
94         * (such as SOCKS), but would not return protocol-specific proxy types
95         * (such as http).
96         *
97         * `direct://` is used when no proxy is needed.
98         * Direct connection should not be attempted unless it is part of the
99         * returned array of proxies.
100         *
101         * Params:
102         *     uri = a URI representing the destination to connect to
103         *     cancellable = a #GCancellable, or %NULL
104         *
105         * Returns: A
106         *     NULL-terminated array of proxy URIs. Must be freed
107         *     with g_strfreev().
108         *
109         * Since: 2.26
110         *
111         * Throws: GException on failure.
112         */
113        public string[] lookup(string uri, Cancellable cancellable)
114        {
115                GError* err = null;
116               
117                auto retStr = g_proxy_resolver_lookup(getProxyResolverStruct(), Str.toStringz(uri), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
118               
119                if (err !is null)
120                {
121                        throw new GException( new ErrorG(err) );
122                }
123               
124                scope(exit) Str.freeStringArray(retStr);
125                return Str.toStringArray(retStr);
126        }
127
128        /**
129         * Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more
130         * details.
131         *
132         * Params:
133         *     uri = a URI representing the destination to connect to
134         *     cancellable = a #GCancellable, or %NULL
135         *     callback = callback to call after resolution completes
136         *     userData = data for @callback
137         *
138         * Since: 2.26
139         */
140        public void lookupAsync(string uri, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
141        {
142                g_proxy_resolver_lookup_async(getProxyResolverStruct(), Str.toStringz(uri), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
143        }
144
145        /**
146         * Call this function to obtain the array of proxy URIs when
147         * g_proxy_resolver_lookup_async() is complete. See
148         * g_proxy_resolver_lookup() for more details.
149         *
150         * Params:
151         *     result = the result passed to your #GAsyncReadyCallback
152         *
153         * Returns: A
154         *     NULL-terminated array of proxy URIs. Must be freed
155         *     with g_strfreev().
156         *
157         * Since: 2.26
158         *
159         * Throws: GException on failure.
160         */
161        public string[] lookupFinish(AsyncResultIF result)
162        {
163                GError* err = null;
164               
165                auto retStr = g_proxy_resolver_lookup_finish(getProxyResolverStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err);
166               
167                if (err !is null)
168                {
169                        throw new GException( new ErrorG(err) );
170                }
171               
172                scope(exit) Str.freeStringArray(retStr);
173                return Str.toStringArray(retStr);
174        }
175}
Note: See TracBrowser for help on using the repository browser.