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  = GNetworkService.html
27  * outPack = gio
28  * outFile = NetworkService
29  * strct   = GNetworkService
30  * realStrct=
31  * ctorStrct=GSocketConnectable
32  * clss    = NetworkService
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * 	- SocketConnectableIF
40  * prefixes:
41  * 	- g_network_service_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gio.SocketConnectableT
49  * 	- gio.SocketConnectableIF
50  * structWrap:
51  * module aliases:
52  * local aliases:
53  * overrides:
54  */
55 
56 module gio.NetworkService;
57 
58 public  import gtkc.giotypes;
59 
60 private import gtkc.gio;
61 private import glib.ConstructionException;
62 private import gobject.ObjectG;
63 
64 private import glib.Str;
65 private import gio.SocketConnectableT;
66 private import gio.SocketConnectableIF;
67 
68 
69 private import gobject.ObjectG;
70 
71 /**
72  * Like GNetworkAddress does with hostnames, GNetworkService
73  * provides an easy way to resolve a SRV record, and then attempt to
74  * connect to one of the hosts that implements that service, handling
75  * service priority/weighting, multiple IP addresses, and multiple
76  * address families.
77  *
78  * See GSrvTarget for more information about SRV records, and see
79  * GSocketConnectable for and example of using the connectable
80  * interface.
81  */
82 public class NetworkService : ObjectG, SocketConnectableIF
83 {
84 	
85 	/** the main Gtk struct */
86 	protected GNetworkService* gNetworkService;
87 	
88 	
89 	/** Get the main Gtk struct */
90 	public GNetworkService* getNetworkServiceStruct()
91 	{
92 		return gNetworkService;
93 	}
94 	
95 	
96 	/** the main Gtk struct as a void* */
97 	protected override void* getStruct()
98 	{
99 		return cast(void*)gNetworkService;
100 	}
101 	
102 	/**
103 	 * Sets our main struct and passes it to the parent class
104 	 */
105 	public this (GNetworkService* gNetworkService)
106 	{
107 		super(cast(GObject*)gNetworkService);
108 		this.gNetworkService = gNetworkService;
109 	}
110 	
111 	protected override void setStruct(GObject* obj)
112 	{
113 		super.setStruct(obj);
114 		gNetworkService = cast(GNetworkService*)obj;
115 	}
116 	
117 	// add the SocketConnectable capabilities
118 	mixin SocketConnectableT!(GNetworkService);
119 	
120 	/**
121 	 */
122 	
123 	/**
124 	 * Creates a new GNetworkService representing the given service,
125 	 * protocol, and domain. This will initially be unresolved; use the
126 	 * GSocketConnectable interface to resolve it.
127 	 * Since 2.22
128 	 * Params:
129 	 * service = the service type to look up (eg, "ldap")
130 	 * protocol = the networking protocol to use for service (eg, "tcp")
131 	 * domain = the DNS domain to look up the service in
132 	 * Throws: ConstructionException GTK+ fails to create the object.
133 	 */
134 	public this (string service, string protocol, string domain)
135 	{
136 		// GSocketConnectable * g_network_service_new (const gchar *service,  const gchar *protocol,  const gchar *domain);
137 		auto p = g_network_service_new(Str.toStringz(service), Str.toStringz(protocol), Str.toStringz(domain));
138 		if(p is null)
139 		{
140 			throw new ConstructionException("null returned by g_network_service_new(Str.toStringz(service), Str.toStringz(protocol), Str.toStringz(domain))");
141 		}
142 		this(cast(GNetworkService*) p);
143 	}
144 	
145 	/**
146 	 * Gets srv's service name (eg, "ldap").
147 	 * Since 2.22
148 	 * Returns: srv's service name
149 	 */
150 	public string getService()
151 	{
152 		// const gchar * g_network_service_get_service (GNetworkService *srv);
153 		return Str.toString(g_network_service_get_service(gNetworkService));
154 	}
155 	
156 	/**
157 	 * Gets srv's protocol name (eg, "tcp").
158 	 * Since 2.22
159 	 * Returns: srv's protocol name
160 	 */
161 	public string getProtocol()
162 	{
163 		// const gchar * g_network_service_get_protocol (GNetworkService *srv);
164 		return Str.toString(g_network_service_get_protocol(gNetworkService));
165 	}
166 	
167 	/**
168 	 * Gets the domain that srv serves. This might be either UTF-8 or
169 	 * ASCII-encoded, depending on what srv was created with.
170 	 * Since 2.22
171 	 * Returns: srv's domain name
172 	 */
173 	public string getDomain()
174 	{
175 		// const gchar * g_network_service_get_domain (GNetworkService *srv);
176 		return Str.toString(g_network_service_get_domain(gNetworkService));
177 	}
178 	
179 	/**
180 	 * Get's the URI scheme used to resolve proxies. By default, the service name
181 	 * is used as scheme.
182 	 * Since 2.26
183 	 * Returns: srv's scheme name
184 	 */
185 	public string getScheme()
186 	{
187 		// const gchar * g_network_service_get_scheme (GNetworkService *srv);
188 		return Str.toString(g_network_service_get_scheme(gNetworkService));
189 	}
190 	
191 	/**
192 	 * Set's the URI scheme used to resolve proxies. By default, the service name
193 	 * is used as scheme.
194 	 * Since 2.26
195 	 * Params:
196 	 * scheme = a URI scheme
197 	 */
198 	public void setScheme(string scheme)
199 	{
200 		// void g_network_service_set_scheme (GNetworkService *srv,  const gchar *scheme);
201 		g_network_service_set_scheme(gNetworkService, Str.toStringz(scheme));
202 	}
203 }