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 module gstreamer.Uri;
26 
27 private import glib.ConstructionException;
28 private import glib.ErrorG;
29 private import glib.GException;
30 private import glib.HashTable;
31 private import glib.ListG;
32 private import glib.Str;
33 private import gobject.ObjectG;
34 private import gstreamer.c.functions;
35 public  import gstreamer.c.types;
36 public  import gstreamerc.gstreamertypes;
37 
38 
39 /**
40  * A #GstUri object can be used to parse and split a URI string into its
41  * constituant parts. Two #GstUri objects can be joined to make a new #GstUri
42  * using the algorithm described in RFC3986.
43  */
44 public class Uri
45 {
46 	/** the main Gtk struct */
47 	protected GstUri* gstUri;
48 	protected bool ownedRef;
49 
50 	/** Get the main Gtk struct */
51 	public GstUri* getUriStruct(bool transferOwnership = false)
52 	{
53 		if (transferOwnership)
54 			ownedRef = false;
55 		return gstUri;
56 	}
57 
58 	/** the main Gtk struct as a void* */
59 	protected void* getStruct()
60 	{
61 		return cast(void*)gstUri;
62 	}
63 
64 	/**
65 	 * Sets our main struct and passes it to the parent class.
66 	 */
67 	public this (GstUri* gstUri, bool ownedRef = false)
68 	{
69 		this.gstUri = gstUri;
70 		this.ownedRef = ownedRef;
71 	}
72 
73 
74 	/** */
75 	public static GType getType()
76 	{
77 		return gst_uri_get_type();
78 	}
79 
80 	/**
81 	 * Creates a new #GstUri object with the given URI parts. The path and query
82 	 * strings will be broken down into their elements. All strings should not be
83 	 * escaped except where indicated.
84 	 *
85 	 * Params:
86 	 *     scheme = The scheme for the new URI.
87 	 *     userinfo = The user-info for the new URI.
88 	 *     host = The host name for the new URI.
89 	 *     port = The port number for the new URI or %GST_URI_NO_PORT.
90 	 *     path = The path for the new URI with '/' separating path
91 	 *         elements.
92 	 *     query = The query string for the new URI with '&' separating
93 	 *         query elements. Elements containing '&' characters
94 	 *         should encode them as "%26".
95 	 *     fragment = The fragment name for the new URI.
96 	 *
97 	 * Returns: A new #GstUri object.
98 	 *
99 	 * Since: 1.6
100 	 *
101 	 * Throws: ConstructionException GTK+ fails to create the object.
102 	 */
103 	public this(string scheme, string userinfo, string host, uint port, string path, string query, string fragment)
104 	{
105 		auto p = gst_uri_new(Str.toStringz(scheme), Str.toStringz(userinfo), Str.toStringz(host), port, Str.toStringz(path), Str.toStringz(query), Str.toStringz(fragment));
106 
107 		if(p is null)
108 		{
109 			throw new ConstructionException("null returned by new");
110 		}
111 
112 		this(cast(GstUri*) p);
113 	}
114 
115 	/**
116 	 * Append a path onto the end of the path in the URI. The path is not
117 	 * normalized, call #gst_uri_normalize() to normalize the path.
118 	 *
119 	 * Params:
120 	 *     relativePath = Relative path to append to the end of the current path.
121 	 *
122 	 * Returns: %TRUE if the path was appended successfully.
123 	 *
124 	 * Since: 1.6
125 	 */
126 	public bool appendPath(string relativePath)
127 	{
128 		return gst_uri_append_path(gstUri, Str.toStringz(relativePath)) != 0;
129 	}
130 
131 	/**
132 	 * Append a single path segment onto the end of the URI path.
133 	 *
134 	 * Params:
135 	 *     pathSegment = The path segment string to append to the URI path.
136 	 *
137 	 * Returns: %TRUE if the path was appended successfully.
138 	 *
139 	 * Since: 1.6
140 	 */
141 	public bool appendPathSegment(string pathSegment)
142 	{
143 		return gst_uri_append_path_segment(gstUri, Str.toStringz(pathSegment)) != 0;
144 	}
145 
146 	/**
147 	 * Compares two #GstUri objects to see if they represent the same normalized
148 	 * URI.
149 	 *
150 	 * Params:
151 	 *     second = Second #GstUri to compare.
152 	 *
153 	 * Returns: %TRUE if the normalized versions of the two URI's would be equal.
154 	 *
155 	 * Since: 1.6
156 	 */
157 	public bool equal(Uri second)
158 	{
159 		return gst_uri_equal(gstUri, (second is null) ? null : second.getUriStruct()) != 0;
160 	}
161 
162 	/**
163 	 * Like gst_uri_from_string() but also joins with a base URI.
164 	 *
165 	 * Params:
166 	 *     uri = The URI string to parse.
167 	 *
168 	 * Returns: A new #GstUri object.
169 	 *
170 	 * Since: 1.6
171 	 */
172 	public Uri fromStringWithBase(string uri)
173 	{
174 		auto p = gst_uri_from_string_with_base(gstUri, Str.toStringz(uri));
175 
176 		if(p is null)
177 		{
178 			return null;
179 		}
180 
181 		return ObjectG.getDObject!(Uri)(cast(GstUri*) p, true);
182 	}
183 
184 	/**
185 	 * Get the fragment name from the URI or %NULL if it doesn't exist.
186 	 * If @uri is %NULL then returns %NULL.
187 	 *
188 	 * Returns: The host name from the #GstUri object or %NULL.
189 	 *
190 	 * Since: 1.6
191 	 */
192 	public string getFragment()
193 	{
194 		return Str.toString(gst_uri_get_fragment(gstUri));
195 	}
196 
197 	/**
198 	 * Get the host name from the URI or %NULL if it doesn't exist.
199 	 * If @uri is %NULL then returns %NULL.
200 	 *
201 	 * Returns: The host name from the #GstUri object or %NULL.
202 	 *
203 	 * Since: 1.6
204 	 */
205 	public string getHost()
206 	{
207 		return Str.toString(gst_uri_get_host(gstUri));
208 	}
209 
210 	/**
211 	 * Get the media fragment table from the URI, as defined by "Media Fragments URI 1.0".
212 	 * Hash table returned by this API is a list of "key-value" pairs, and the each
213 	 * pair is generated by splitting "URI fragment" per "&" sub-delims, then "key"
214 	 * and "value" are splitted by "=" sub-delims. The "key" returned by this API may
215 	 * be undefined keyword by standard.
216 	 * A value may be %NULL to indicate that the key should appear in the fragment
217 	 * string in the URI, but does not have a value. Free the returned #GHashTable
218 	 * with #g_hash_table_unref() when it is no longer required.
219 	 * Modifying this hash table does not affect the fragment in the URI.
220 	 *
221 	 * See more about Media Fragments URI 1.0 (W3C) at https://www.w3.org/TR/media-frags/
222 	 *
223 	 * Returns: The
224 	 *     fragment hash table from the URI.
225 	 *
226 	 * Since: 1.12
227 	 */
228 	public HashTable getMediaFragmentTable()
229 	{
230 		auto p = gst_uri_get_media_fragment_table(gstUri);
231 
232 		if(p is null)
233 		{
234 			return null;
235 		}
236 
237 		return new HashTable(cast(GHashTable*) p, true);
238 	}
239 
240 	/**
241 	 * Extract the path string from the URI object.
242 	 *
243 	 * Returns: (nullable): The path from the URI. Once finished
244 	 *     with the string should be g_free()'d.
245 	 *
246 	 * Since: 1.6
247 	 */
248 	public string getPath()
249 	{
250 		auto retStr = gst_uri_get_path(gstUri);
251 
252 		scope(exit) Str.freeString(retStr);
253 		return Str.toString(retStr);
254 	}
255 
256 	/**
257 	 * Get a list of path segments from the URI.
258 	 *
259 	 * Returns: A #GList of path segment
260 	 *     strings or %NULL if no path segments are available. Free the list
261 	 *     when no longer needed with g_list_free_full(list, g_free).
262 	 *
263 	 * Since: 1.6
264 	 */
265 	public ListG getPathSegments()
266 	{
267 		auto p = gst_uri_get_path_segments(gstUri);
268 
269 		if(p is null)
270 		{
271 			return null;
272 		}
273 
274 		return new ListG(cast(GList*) p, true);
275 	}
276 
277 	/**
278 	 * Extract the path string from the URI object as a percent encoded URI path.
279 	 *
280 	 * Returns: The path from the URI. Once finished
281 	 *     with the string should be g_free()'d.
282 	 *
283 	 * Since: 1.6
284 	 */
285 	public string getPathString()
286 	{
287 		auto retStr = gst_uri_get_path_string(gstUri);
288 
289 		scope(exit) Str.freeString(retStr);
290 		return Str.toString(retStr);
291 	}
292 
293 	/**
294 	 * Get the port number from the URI or %GST_URI_NO_PORT if it doesn't exist.
295 	 * If @uri is %NULL then returns %GST_URI_NO_PORT.
296 	 *
297 	 * Returns: The port number from the #GstUri object or %GST_URI_NO_PORT.
298 	 *
299 	 * Since: 1.6
300 	 */
301 	public uint getPort()
302 	{
303 		return gst_uri_get_port(gstUri);
304 	}
305 
306 	/**
307 	 * Get a list of the query keys from the URI.
308 	 *
309 	 * Returns: A list of keys from
310 	 *     the URI query. Free the list with g_list_free().
311 	 *
312 	 * Since: 1.6
313 	 */
314 	public ListG getQueryKeys()
315 	{
316 		auto p = gst_uri_get_query_keys(gstUri);
317 
318 		if(p is null)
319 		{
320 			return null;
321 		}
322 
323 		return new ListG(cast(GList*) p);
324 	}
325 
326 	/**
327 	 * Get a percent encoded URI query string from the @uri.
328 	 *
329 	 * Returns: A percent encoded query string. Use
330 	 *     g_free() when no longer needed.
331 	 *
332 	 * Since: 1.6
333 	 */
334 	public string getQueryString()
335 	{
336 		auto retStr = gst_uri_get_query_string(gstUri);
337 
338 		scope(exit) Str.freeString(retStr);
339 		return Str.toString(retStr);
340 	}
341 
342 	/**
343 	 * Get the query table from the URI. Keys and values in the table are freed
344 	 * with g_free when they are deleted. A value may be %NULL to indicate that
345 	 * the key should appear in the query string in the URI, but does not have a
346 	 * value. Free the returned #GHashTable with #g_hash_table_unref() when it is
347 	 * no longer required. Modifying this hash table will modify the query in the
348 	 * URI.
349 	 *
350 	 * Returns: The query
351 	 *     hash table from the URI.
352 	 *
353 	 * Since: 1.6
354 	 */
355 	public HashTable getQueryTable()
356 	{
357 		auto p = gst_uri_get_query_table(gstUri);
358 
359 		if(p is null)
360 		{
361 			return null;
362 		}
363 
364 		return new HashTable(cast(GHashTable*) p, true);
365 	}
366 
367 	/**
368 	 * Get the value associated with the @query_key key. Will return %NULL if the
369 	 * key has no value or if the key does not exist in the URI query table. Because
370 	 * %NULL is returned for both missing keys and keys with no value, you should
371 	 * use gst_uri_query_has_key() to determine if a key is present in the URI
372 	 * query.
373 	 *
374 	 * Params:
375 	 *     queryKey = The key to lookup.
376 	 *
377 	 * Returns: The value for the given key, or %NULL if not found.
378 	 *
379 	 * Since: 1.6
380 	 */
381 	public string getQueryValue(string queryKey)
382 	{
383 		return Str.toString(gst_uri_get_query_value(gstUri, Str.toStringz(queryKey)));
384 	}
385 
386 	/**
387 	 * Get the scheme name from the URI or %NULL if it doesn't exist.
388 	 * If @uri is %NULL then returns %NULL.
389 	 *
390 	 * Returns: The scheme from the #GstUri object or %NULL.
391 	 */
392 	public string getScheme()
393 	{
394 		return Str.toString(gst_uri_get_scheme(gstUri));
395 	}
396 
397 	/**
398 	 * Get the userinfo (usually in the form "username:password") from the URI
399 	 * or %NULL if it doesn't exist. If @uri is %NULL then returns %NULL.
400 	 *
401 	 * Returns: The userinfo from the #GstUri object or %NULL.
402 	 *
403 	 * Since: 1.6
404 	 */
405 	public string getUserinfo()
406 	{
407 		return Str.toString(gst_uri_get_userinfo(gstUri));
408 	}
409 
410 	/**
411 	 * Tests the @uri to see if it is normalized. A %NULL @uri is considered to be
412 	 * normalized.
413 	 *
414 	 * Returns: TRUE if the URI is normalized or is %NULL.
415 	 *
416 	 * Since: 1.6
417 	 */
418 	public bool isNormalized()
419 	{
420 		return gst_uri_is_normalized(gstUri) != 0;
421 	}
422 
423 	/**
424 	 * Check if it is safe to write to this #GstUri.
425 	 *
426 	 * Check if the refcount of @uri is exactly 1, meaning that no other
427 	 * reference exists to the #GstUri and that the #GstUri is therefore writable.
428 	 *
429 	 * Modification of a #GstUri should only be done after verifying that it is
430 	 * writable.
431 	 *
432 	 * Returns: %TRUE if it is safe to write to the object.
433 	 *
434 	 * Since: 1.6
435 	 */
436 	public bool isWritable()
437 	{
438 		return gst_uri_is_writable(gstUri) != 0;
439 	}
440 
441 	/**
442 	 * Join a reference URI onto a base URI using the method from RFC 3986.
443 	 * If either URI is %NULL then the other URI will be returned with the ref count
444 	 * increased.
445 	 *
446 	 * Params:
447 	 *     refUri = The reference URI to join onto the
448 	 *         base URI.
449 	 *
450 	 * Returns: A #GstUri which represents the base
451 	 *     with the reference URI joined on.
452 	 *
453 	 * Since: 1.6
454 	 */
455 	public Uri join(Uri refUri)
456 	{
457 		auto p = gst_uri_join(gstUri, (refUri is null) ? null : refUri.getUriStruct());
458 
459 		if(p is null)
460 		{
461 			return null;
462 		}
463 
464 		return ObjectG.getDObject!(Uri)(cast(GstUri*) p, true);
465 	}
466 
467 	/**
468 	 * Make the #GstUri writable.
469 	 *
470 	 * Checks if @uri is writable, and if so the original object is returned. If
471 	 * not, then a writable copy is made and returned. This gives away the
472 	 * reference to @uri and returns a reference to the new #GstUri.
473 	 * If @uri is %NULL then %NULL is returned.
474 	 *
475 	 * Returns: A writable version of @uri.
476 	 *
477 	 * Since: 1.6
478 	 */
479 	public Uri makeWritable()
480 	{
481 		auto p = gst_uri_make_writable(gstUri);
482 
483 		if(p is null)
484 		{
485 			return null;
486 		}
487 
488 		return ObjectG.getDObject!(Uri)(cast(GstUri*) p, true);
489 	}
490 
491 	/**
492 	 * Like gst_uri_new(), but joins the new URI onto a base URI.
493 	 *
494 	 * Params:
495 	 *     scheme = The scheme for the new URI.
496 	 *     userinfo = The user-info for the new URI.
497 	 *     host = The host name for the new URI.
498 	 *     port = The port number for the new URI or %GST_URI_NO_PORT.
499 	 *     path = The path for the new URI with '/' separating path
500 	 *         elements.
501 	 *     query = The query string for the new URI with '&' separating
502 	 *         query elements. Elements containing '&' characters
503 	 *         should encode them as "%26".
504 	 *     fragment = The fragment name for the new URI.
505 	 *
506 	 * Returns: The new URI joined onto @base.
507 	 *
508 	 * Since: 1.6
509 	 */
510 	public Uri newWithBase(string scheme, string userinfo, string host, uint port, string path, string query, string fragment)
511 	{
512 		auto p = gst_uri_new_with_base(gstUri, Str.toStringz(scheme), Str.toStringz(userinfo), Str.toStringz(host), port, Str.toStringz(path), Str.toStringz(query), Str.toStringz(fragment));
513 
514 		if(p is null)
515 		{
516 			return null;
517 		}
518 
519 		return ObjectG.getDObject!(Uri)(cast(GstUri*) p, true);
520 	}
521 
522 	/**
523 	 * Normalization will remove extra path segments ("." and "..") from the URI. It
524 	 * will also convert the scheme and host name to lower case and any
525 	 * percent-encoded values to uppercase.
526 	 *
527 	 * The #GstUri object must be writable. Check with gst_uri_is_writable() or use
528 	 * gst_uri_make_writable() first.
529 	 *
530 	 * Returns: TRUE if the URI was modified.
531 	 *
532 	 * Since: 1.6
533 	 */
534 	public bool normalize()
535 	{
536 		return gst_uri_normalize(gstUri) != 0;
537 	}
538 
539 	/**
540 	 * Check if there is a query table entry for the @query_key key.
541 	 *
542 	 * Params:
543 	 *     queryKey = The key to lookup.
544 	 *
545 	 * Returns: %TRUE if @query_key exists in the URI query table.
546 	 *
547 	 * Since: 1.6
548 	 */
549 	public bool queryHasKey(string queryKey)
550 	{
551 		return gst_uri_query_has_key(gstUri, Str.toStringz(queryKey)) != 0;
552 	}
553 
554 	/**
555 	 * Remove an entry from the query table by key.
556 	 *
557 	 * Params:
558 	 *     queryKey = The key to remove.
559 	 *
560 	 * Returns: %TRUE if the key existed in the table and was removed.
561 	 *
562 	 * Since: 1.6
563 	 */
564 	public bool removeQueryKey(string queryKey)
565 	{
566 		return gst_uri_remove_query_key(gstUri, Str.toStringz(queryKey)) != 0;
567 	}
568 
569 	/**
570 	 * Sets the fragment string in the URI. Use a value of %NULL in @fragment to
571 	 * unset the fragment string.
572 	 *
573 	 * Params:
574 	 *     fragment = The fragment string to set.
575 	 *
576 	 * Returns: %TRUE if the fragment was set/unset successfully.
577 	 *
578 	 * Since: 1.6
579 	 */
580 	public bool setFragment(string fragment)
581 	{
582 		return gst_uri_set_fragment(gstUri, Str.toStringz(fragment)) != 0;
583 	}
584 
585 	/**
586 	 * Set or unset the host for the URI.
587 	 *
588 	 * Params:
589 	 *     host = The new host string to set or %NULL to unset.
590 	 *
591 	 * Returns: %TRUE if the host was set/unset successfully.
592 	 *
593 	 * Since: 1.6
594 	 */
595 	public bool setHost(string host)
596 	{
597 		return gst_uri_set_host(gstUri, Str.toStringz(host)) != 0;
598 	}
599 
600 	/**
601 	 * Sets or unsets the path in the URI.
602 	 *
603 	 * Params:
604 	 *     path = The new path to set with path segments separated by '/', or use %NULL
605 	 *         to unset the path.
606 	 *
607 	 * Returns: %TRUE if the path was set successfully.
608 	 *
609 	 * Since: 1.6
610 	 */
611 	public bool setPath(string path)
612 	{
613 		return gst_uri_set_path(gstUri, Str.toStringz(path)) != 0;
614 	}
615 
616 	/**
617 	 * Replace the path segments list in the URI.
618 	 *
619 	 * Params:
620 	 *     pathSegments = The new
621 	 *         path list to set.
622 	 *
623 	 * Returns: %TRUE if the path segments were set successfully.
624 	 *
625 	 * Since: 1.6
626 	 */
627 	public bool setPathSegments(ListG pathSegments)
628 	{
629 		return gst_uri_set_path_segments(gstUri, (pathSegments is null) ? null : pathSegments.getListGStruct()) != 0;
630 	}
631 
632 	/**
633 	 * Sets or unsets the path in the URI.
634 	 *
635 	 * Params:
636 	 *     path = The new percent encoded path to set with path segments separated by
637 	 *         '/', or use %NULL to unset the path.
638 	 *
639 	 * Returns: %TRUE if the path was set successfully.
640 	 *
641 	 * Since: 1.6
642 	 */
643 	public bool setPathString(string path)
644 	{
645 		return gst_uri_set_path_string(gstUri, Str.toStringz(path)) != 0;
646 	}
647 
648 	/**
649 	 * Set or unset the port number for the URI.
650 	 *
651 	 * Params:
652 	 *     port = The new port number to set or %GST_URI_NO_PORT to unset.
653 	 *
654 	 * Returns: %TRUE if the port number was set/unset successfully.
655 	 *
656 	 * Since: 1.6
657 	 */
658 	public bool setPort(uint port)
659 	{
660 		return gst_uri_set_port(gstUri, port) != 0;
661 	}
662 
663 	/**
664 	 * Sets or unsets the query table in the URI.
665 	 *
666 	 * Params:
667 	 *     query = The new percent encoded query string to use to populate the query
668 	 *         table, or use %NULL to unset the query table.
669 	 *
670 	 * Returns: %TRUE if the query table was set successfully.
671 	 *
672 	 * Since: 1.6
673 	 */
674 	public bool setQueryString(string query)
675 	{
676 		return gst_uri_set_query_string(gstUri, Str.toStringz(query)) != 0;
677 	}
678 
679 	/**
680 	 * Set the query table to use in the URI. The old table is unreferenced and a
681 	 * reference to the new one is used instead. A value if %NULL for @query_table
682 	 * will remove the query string from the URI.
683 	 *
684 	 * Params:
685 	 *     queryTable = The new
686 	 *         query table to use.
687 	 *
688 	 * Returns: %TRUE if the new table was sucessfully used for the query table.
689 	 *
690 	 * Since: 1.6
691 	 */
692 	public bool setQueryTable(HashTable queryTable)
693 	{
694 		return gst_uri_set_query_table(gstUri, (queryTable is null) ? null : queryTable.getHashTableStruct()) != 0;
695 	}
696 
697 	/**
698 	 * This inserts or replaces a key in the query table. A @query_value of %NULL
699 	 * indicates that the key has no associated value, but will still be present in
700 	 * the query string.
701 	 *
702 	 * Params:
703 	 *     queryKey = The key for the query entry.
704 	 *     queryValue = The value for the key.
705 	 *
706 	 * Returns: %TRUE if the query table was sucessfully updated.
707 	 *
708 	 * Since: 1.6
709 	 */
710 	public bool setQueryValue(string queryKey, string queryValue)
711 	{
712 		return gst_uri_set_query_value(gstUri, Str.toStringz(queryKey), Str.toStringz(queryValue)) != 0;
713 	}
714 
715 	/**
716 	 * Set or unset the scheme for the URI.
717 	 *
718 	 * Params:
719 	 *     scheme = The new scheme to set or %NULL to unset the scheme.
720 	 *
721 	 * Returns: %TRUE if the scheme was set/unset successfully.
722 	 *
723 	 * Since: 1.6
724 	 */
725 	public bool setScheme(string scheme)
726 	{
727 		return gst_uri_set_scheme(gstUri, Str.toStringz(scheme)) != 0;
728 	}
729 
730 	/**
731 	 * Set or unset the user information for the URI.
732 	 *
733 	 * Params:
734 	 *     userinfo = The new user-information string to set or %NULL to unset.
735 	 *
736 	 * Returns: %TRUE if the user information was set/unset successfully.
737 	 *
738 	 * Since: 1.6
739 	 */
740 	public bool setUserinfo(string userinfo)
741 	{
742 		return gst_uri_set_userinfo(gstUri, Str.toStringz(userinfo)) != 0;
743 	}
744 
745 	/**
746 	 * Convert the URI to a string.
747 	 *
748 	 * Returns the URI as held in this object as a #gchar* nul-terminated string.
749 	 * The caller should g_free() the string once they are finished with it.
750 	 * The string is put together as described in RFC 3986.
751 	 *
752 	 * Returns: The string version of the URI.
753 	 *
754 	 * Since: 1.6
755 	 */
756 	public override string toString()
757 	{
758 		auto retStr = gst_uri_to_string(gstUri);
759 
760 		scope(exit) Str.freeString(retStr);
761 		return Str.toString(retStr);
762 	}
763 
764 	/**
765 	 * Constructs a URI for a given valid protocol and location.
766 	 *
767 	 * Free-function: g_free
768 	 *
769 	 * Deprecated: Use GstURI instead.
770 	 *
771 	 * Params:
772 	 *     protocol = Protocol for URI
773 	 *     location = Location for URI
774 	 *
775 	 * Returns: a new string for this URI. Returns %NULL if the
776 	 *     given URI protocol is not valid, or the given location is %NULL.
777 	 */
778 	public static string construct(string protocol, string location)
779 	{
780 		auto retStr = gst_uri_construct(Str.toStringz(protocol), Str.toStringz(location));
781 
782 		scope(exit) Str.freeString(retStr);
783 		return Str.toString(retStr);
784 	}
785 
786 	/**
787 	 * Parses a URI string into a new #GstUri object. Will return NULL if the URI
788 	 * cannot be parsed.
789 	 *
790 	 * Params:
791 	 *     uri = The URI string to parse.
792 	 *
793 	 * Returns: A new #GstUri object, or NULL.
794 	 *
795 	 * Since: 1.6
796 	 */
797 	public static Uri fromString(string uri)
798 	{
799 		auto p = gst_uri_from_string(Str.toStringz(uri));
800 
801 		if(p is null)
802 		{
803 			return null;
804 		}
805 
806 		return ObjectG.getDObject!(Uri)(cast(GstUri*) p, true);
807 	}
808 
809 	/**
810 	 * Extracts the location out of a given valid URI, ie. the protocol and "://"
811 	 * are stripped from the URI, which means that the location returned includes
812 	 * the hostname if one is specified. The returned string must be freed using
813 	 * g_free().
814 	 *
815 	 * Free-function: g_free
816 	 *
817 	 * Params:
818 	 *     uri = A URI string
819 	 *
820 	 * Returns: the location for this URI. Returns
821 	 *     %NULL if the URI isn't valid. If the URI does not contain a location, an
822 	 *     empty string is returned.
823 	 */
824 	public static string getLocation(string uri)
825 	{
826 		auto retStr = gst_uri_get_location(Str.toStringz(uri));
827 
828 		scope(exit) Str.freeString(retStr);
829 		return Str.toString(retStr);
830 	}
831 
832 	/**
833 	 * Extracts the protocol out of a given valid URI. The returned string must be
834 	 * freed using g_free().
835 	 *
836 	 * Params:
837 	 *     uri = A URI string
838 	 *
839 	 * Returns: The protocol for this URI.
840 	 */
841 	public static string getProtocol(string uri)
842 	{
843 		auto retStr = gst_uri_get_protocol(Str.toStringz(uri));
844 
845 		scope(exit) Str.freeString(retStr);
846 		return Str.toString(retStr);
847 	}
848 
849 	/**
850 	 * Checks if the protocol of a given valid URI matches @protocol.
851 	 *
852 	 * Params:
853 	 *     uri = a URI string
854 	 *     protocol = a protocol string (e.g. "http")
855 	 *
856 	 * Returns: %TRUE if the protocol matches.
857 	 */
858 	public static bool hasProtocol(string uri, string protocol)
859 	{
860 		return gst_uri_has_protocol(Str.toStringz(uri), Str.toStringz(protocol)) != 0;
861 	}
862 
863 	/**
864 	 * Tests if the given string is a valid URI identifier. URIs start with a valid
865 	 * scheme followed by ":" and maybe a string identifying the location.
866 	 *
867 	 * Params:
868 	 *     uri = A URI string
869 	 *
870 	 * Returns: %TRUE if the string is a valid URI
871 	 */
872 	public static bool isValid(string uri)
873 	{
874 		return gst_uri_is_valid(Str.toStringz(uri)) != 0;
875 	}
876 
877 	/**
878 	 * This is a convenience function to join two URI strings and return the result.
879 	 * The returned string should be g_free()'d after use.
880 	 *
881 	 * Params:
882 	 *     baseUri = The percent-encoded base URI.
883 	 *     refUri = The percent-encoded reference URI to join to the @base_uri.
884 	 *
885 	 * Returns: A string representing the percent-encoded join of
886 	 *     the two URIs.
887 	 *
888 	 * Since: 1.6
889 	 */
890 	public static string joinStrings(string baseUri, string refUri)
891 	{
892 		auto retStr = gst_uri_join_strings(Str.toStringz(baseUri), Str.toStringz(refUri));
893 
894 		scope(exit) Str.freeString(retStr);
895 		return Str.toString(retStr);
896 	}
897 
898 	/**
899 	 * Checks if an element exists that supports the given URI protocol. Note
900 	 * that a positive return value does not imply that a subsequent call to
901 	 * gst_element_make_from_uri() is guaranteed to work.
902 	 *
903 	 * Params:
904 	 *     type = Whether to check for a source or a sink
905 	 *     protocol = Protocol that should be checked for (e.g. "http" or "smb")
906 	 *
907 	 * Returns: %TRUE
908 	 */
909 	public static bool protocolIsSupported(GstURIType type, string protocol)
910 	{
911 		return gst_uri_protocol_is_supported(type, Str.toStringz(protocol)) != 0;
912 	}
913 
914 	/**
915 	 * Tests if the given string is a valid protocol identifier. Protocols
916 	 * must consist of alphanumeric characters, '+', '-' and '.' and must
917 	 * start with a alphabetic character. See RFC 3986 Section 3.1.
918 	 *
919 	 * Params:
920 	 *     protocol = A string
921 	 *
922 	 * Returns: %TRUE if the string is a valid protocol identifier, %FALSE otherwise.
923 	 */
924 	public static bool protocolIsValid(string protocol)
925 	{
926 		return gst_uri_protocol_is_valid(Str.toStringz(protocol)) != 0;
927 	}
928 
929 	/**
930 	 * Similar to g_filename_to_uri(), but attempts to handle relative file paths
931 	 * as well. Before converting @filename into an URI, it will be prefixed by
932 	 * the current working directory if it is a relative path, and then the path
933 	 * will be canonicalised so that it doesn't contain any './' or '../' segments.
934 	 *
935 	 * On Windows #filename should be in UTF-8 encoding.
936 	 *
937 	 * Params:
938 	 *     filename = absolute or relative file name path
939 	 *
940 	 * Returns: newly-allocated URI string, or NULL on error. The caller must
941 	 *     free the URI string with g_free() when no longer needed.
942 	 *
943 	 * Throws: GException on failure.
944 	 */
945 	public static string filenameToUri(string filename)
946 	{
947 		GError* err = null;
948 
949 		auto retStr = gst_filename_to_uri(Str.toStringz(filename), &err);
950 
951 		if (err !is null)
952 		{
953 			throw new GException( new ErrorG(err) );
954 		}
955 
956 		scope(exit) Str.freeString(retStr);
957 		return Str.toString(retStr);
958 	}
959 
960 	/** */
961 	public static GQuark uriErrorQuark()
962 	{
963 		return gst_uri_error_quark();
964 	}
965 }