root/trunk/src/gio/ProxyResolverT.d

Revision 938, 6.4 kB (checked in by Mike Wey, 3 months ago)

Update Gio to 2.28.

Line 
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  * Conversion parameters:
26  * inFile  = GProxyResolver.html
27  * outPack = gio
28  * outFile = ProxyResolverT
29  * strct   = GProxyResolver
30  * realStrct=
31  * ctorStrct=
32  * clss    = ProxyResolverT
33  * interf  = ProxyResolverIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  *  - TStruct
38  * extend  =
39  * implements:
40  * prefixes:
41  *  - g_proxy_resolver_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  *  - glib.Str
48  *  - glib.ErrorG
49  *  - glib.GException
50  *  - gio.AsyncResultIF
51  *  - gio.Cancellable
52  *  - gio.ProxyResolver
53  *  - gio.ProxyResolverIF
54  * structWrap:
55  *  - GAsyncResult* -> AsyncResultIF
56  *  - GCancellable* -> Cancellable
57  *  - GProxyResolver* -> ProxyResolverIF
58  * module aliases:
59  * local aliases:
60  * overrides:
61  */
62
63 module gio.ProxyResolverT;
64
65 public  import gtkc.giotypes;
66
67 public import gtkc.gio;
68 public import glib.ConstructionException;
69
70
71 public import glib.Str;
72 public import glib.ErrorG;
73 public import glib.GException;
74 public import gio.AsyncResultIF;
75 public import gio.Cancellable;
76 public import gio.ProxyResolver;
77 public import gio.ProxyResolverIF;
78
79
80
81
82 /**
83  * Description
84  * GProxyResolver provides synchronous and asynchronous network proxy
85  * resolution. GProxyResolver is used within GClientSocket through
86  * the method g_socket_connectable_proxy_enumerate().
87  */
88 public template ProxyResolverT(TStruct)
89 {
90    
91     /** the main Gtk struct */
92     protected GProxyResolver* gProxyResolver;
93    
94    
95     public GProxyResolver* getProxyResolverTStruct()
96     {
97         return cast(GProxyResolver*)getStruct();
98     }
99    
100    
101     /**
102      */
103    
104     /**
105      * Gets the default GProxyResolver for the system.
106      * Since 2.26
107      * Returns: the default GProxyResolver. [transfer none]
108      */
109     public static ProxyResolverIF getDefault()
110     {
111         // GProxyResolver * g_proxy_resolver_get_default (void);
112         auto p = g_proxy_resolver_get_default();
113         if(p is null)
114         {
115             return null;
116         }
117         return new ProxyResolver(cast(GProxyResolver*) p);
118     }
119    
120     /**
121      * Checks if resolver can be used on this system. (This is used
122      * internally; g_proxy_resolver_get_default() will only return a proxy
123      * resolver that returns TRUE for this method.)
124      * Since 2.26
125      * Returns: TRUE if resolver is supported.
126      */
127     public int isSupported()
128     {
129         // gboolean g_proxy_resolver_is_supported (GProxyResolver *resolver);
130         return g_proxy_resolver_is_supported(getProxyResolverTStruct());
131     }
132    
133     /**
134      * Looks into the system proxy configuration to determine what proxy,
135      * if any, to use to connect to uri. The returned proxy URIs are of the
136      * form <protocol>://[user[:password]@]host:port
137      * or direct://, where <protocol> could be
138      * http, rtsp, socks or other proxying protocol.
139      * If you don't know what network protocol is being used on the
140      * socket, you should use none as the URI protocol.
141      * In this case, the resolver might still return a generic proxy type
142      * (such as SOCKS), but would not return protocol-specific proxy types
143      * (such as http).
144      * direct:// is used when no proxy is needed.
145      * Direct connection should not be attempted unless it is part of the
146      * returned array of proxies.
147      * Since 2.26
148      * Params:
149      * uri = a URI representing the destination to connect to
150      * cancellable = a GCancellable, or NULL. [allow-none]
151      * Returns: A NULL-terminated array of proxy URIs. Must be freed with g_strfreev(). [transfer full][array zero-terminated=1]
152      * Throws: GException on failure.
153      */
154     public string[] lookup(string uri, Cancellable cancellable)
155     {
156         // gchar ** g_proxy_resolver_lookup (GProxyResolver *resolver,  const gchar *uri,  GCancellable *cancellable,  GError **error);
157         GError* err = null;
158        
159         auto p = g_proxy_resolver_lookup(getProxyResolverTStruct(), Str.toStringz(uri), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
160        
161         if (err !is null)
162         {
163             throw new GException( new ErrorG(err) );
164         }
165        
166         return Str.toStringArray(p);
167     }
168    
169     /**
170      * Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more
171      * details.
172      * Since 2.26
173      * Params:
174      * uri = a URI representing the destination to connect to
175      * cancellable = a GCancellable, or NULL. [allow-none]
176      * callback = callback to call after resolution completes. [scope async]
177      * userData = data for callback. [closure]
178      */
179     public void lookupAsync(string uri, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
180     {
181         // void g_proxy_resolver_lookup_async (GProxyResolver *resolver,  const gchar *uri,  GCancellable *cancellable,  GAsyncReadyCallback callback,  gpointer user_data);
182         g_proxy_resolver_lookup_async(getProxyResolverTStruct(), Str.toStringz(uri), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
183     }
184    
185     /**
186      * Call this function to obtain the array of proxy URIs when
187      * g_proxy_resolver_lookup_async() is complete. See
188      * g_proxy_resolver_lookup() for more details.
189      * Since 2.26
190      * Params:
191      * result = the result passed to your GAsyncReadyCallback
192      * Returns: A NULL-terminated array of proxy URIs. Must be freed with g_strfreev(). [transfer full][array zero-terminated=1]
193      * Throws: GException on failure.
194      */
195     public string[] lookupFinish(AsyncResultIF result)
196     {
197         // gchar ** g_proxy_resolver_lookup_finish (GProxyResolver *resolver,  GAsyncResult *result,  GError **error);
198         GError* err = null;
199        
200         auto p = g_proxy_resolver_lookup_finish(getProxyResolverTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err);
201        
202         if (err !is null)
203         {
204             throw new GException( new ErrorG(err) );
205         }
206        
207         return Str.toStringArray(p);
208     }
209 }
Note: See TracBrowser for help on using the browser.