Uri

A #GstUri object can be used to parse and split a URI string into its constituent parts. Two #GstUri objects can be joined to make a new #GstUri using the algorithm described in RFC3986.

class Uri : Boxed {}

Constructors

this
this(string scheme, string userinfo, string host, uint port, string path, string query, string fragment)

Creates a new #GstUri object with the given URI parts. The path and query strings will be broken down into their elements. All strings should not be escaped except where indicated.

Members

Functions

appendPath
bool appendPath(string relativePath)

Append a path onto the end of the path in the URI. The path is not normalized, call #gst.uri.Uri.normalize to normalize the path.

appendPathSegment
bool appendPathSegment(string pathSegment)

Append a single path segment onto the end of the URI path.

equal
bool equal(gst.uri.Uri second)

Compares two #GstUri objects to see if they represent the same normalized URI.

fromStringWithBase
gst.uri.Uri fromStringWithBase(string uri)

Like gst.uri.Uri.fromString but also joins with a base URI.

getFragment
string getFragment()

Get the fragment name from the URI or null if it doesn't exist. If uri is null then returns null.

getHost
string getHost()

Get the host name from the URI or null if it doesn't exist. If uri is null then returns null.

getMediaFragmentTable
string[string] getMediaFragmentTable()

Get the media fragment table from the URI, as defined by "Media Fragments URI 1.0". Hash table returned by this API is a list of "key-value" pairs, and the each pair is generated by splitting "URI fragment" per "&" sub-delims, then "key" and "value" are split by "=" sub-delims. The "key" returned by this API may be undefined keyword by standard. A value may be null to indicate that the key should appear in the fragment string in the URI, but does not have a value. Free the returned #GHashTable with #glib.hash_table.HashTable.unref when it is no longer required. Modifying this hash table does not affect the fragment in the URI.

getPath
string getPath()

Extract the path string from the URI object.

getPathSegments
string[] getPathSegments()

Get a list of path segments from the URI.

getPathString
string getPathString()

Extract the path string from the URI object as a percent encoded URI path.

getPort
uint getPort()

Get the port number from the URI or GST_URI_NO_PORT if it doesn't exist. If uri is null then returns GST_URI_NO_PORT.

getQueryKeys
string[] getQueryKeys()

Get a list of the query keys from the URI.

getQueryString
string getQueryString()

Get a percent encoded URI query string from the uri.

getQueryStringOrdered
string getQueryStringOrdered(string[] keys)

Get a percent encoded URI query string from the uri, with query parameters in the order provided by the keys list. Only parameter keys in the list will be added to the resulting URI string. This method can be used by retrieving the keys with gst.uri.Uri.getQueryKeys and then sorting the list, for example.

getQueryTable
string[string] getQueryTable()

Get the query table from the URI. Keys and values in the table are freed with g_free when they are deleted. A value may be null to indicate that the key should appear in the query string in the URI, but does not have a value. Free the returned #GHashTable with #glib.hash_table.HashTable.unref when it is no longer required. Modifying this hash table will modify the query in the URI.

getQueryValue
string getQueryValue(string queryKey)

Get the value associated with the query_key key. Will return null if the key has no value or if the key does not exist in the URI query table. Because null is returned for both missing keys and keys with no value, you should use gst.uri.Uri.queryHasKey to determine if a key is present in the URI query.

getScheme
string getScheme()

Get the scheme name from the URI or null if it doesn't exist. If uri is null then returns null.

getUserinfo
string getUserinfo()

Get the userinfo (usually in the form "username:password") from the URI or null if it doesn't exist. If uri is null then returns null.

isNormalized
bool isNormalized()

Tests the uri to see if it is normalized. A null uri is considered to be normalized.

isWritable
bool isWritable()

Check if it is safe to write to this #GstUri.

join
gst.uri.Uri join(gst.uri.Uri refUri)

Join a reference URI onto a base URI using the method from RFC 3986. If either URI is null then the other URI will be returned with the ref count increased.

makeWritable
gst.uri.Uri makeWritable()

Make the #GstUri writable.

newWithBase
gst.uri.Uri newWithBase(string scheme, string userinfo, string host, uint port, string path, string query, string fragment)

Like gst.uri.Uri.new_, but joins the new URI onto a base URI.

normalize
bool normalize()

Normalization will remove extra path segments ("." and "..") from the URI. It will also convert the scheme and host name to lower case and any percent-encoded values to uppercase.

queryHasKey
bool queryHasKey(string queryKey)

Check if there is a query table entry for the query_key key.

removeQueryKey
bool removeQueryKey(string queryKey)

Remove an entry from the query table by key.

setFragment
bool setFragment(string fragment)

Sets the fragment string in the URI. Use a value of null in fragment to unset the fragment string.

setHost
bool setHost(string host)

Set or unset the host for the URI.

setPath
bool setPath(string path)

Sets or unsets the path in the URI.

setPathString
bool setPathString(string path)

Sets or unsets the path in the URI.

setPort
bool setPort(uint port)

Set or unset the port number for the URI.

setQueryString
bool setQueryString(string query)

Sets or unsets the query table in the URI.

setQueryTable
bool setQueryTable(string[string] queryTable)

Set the query table to use in the URI. The old table is unreferenced and a reference to the new one is used instead. A value if null for query_table will remove the query string from the URI.

setQueryValue
bool setQueryValue(string queryKey, string queryValue)

This inserts or replaces a key in the query table. A query_value of null indicates that the key has no associated value, but will still be present in the query string.

setScheme
bool setScheme(string scheme)

Set or unset the scheme for the URI.

setUserinfo
bool setUserinfo(string userinfo)

Set or unset the user information for the URI.

toStringWithKeys
string toStringWithKeys(string[] keys)

Convert the URI to a string, with the query arguments in a specific order. Only the keys in the keys list will be added to the resulting string.

toString_
string toString_()

Convert the URI to a string.

Static functions

construct
string construct(string protocol, string location)

Constructs a URI for a given valid protocol and location.

fromString
gst.uri.Uri fromString(string uri)

Parses a URI string into a new #GstUri object. Will return NULL if the URI cannot be parsed.

fromStringEscaped
gst.uri.Uri fromStringEscaped(string uri)

Parses a URI string into a new #GstUri object. Will return NULL if the URI cannot be parsed. This is identical to gst.uri.Uri.fromString except that the userinfo and fragment components of the URI will not be unescaped while parsing.

getLocation
string getLocation(string uri)

Extracts the location out of a given valid URI, ie. the protocol and "://" are stripped from the URI, which means that the location returned includes the hostname if one is specified. The returned string must be freed using glib.global.gfree.

getProtocol
string getProtocol(string uri)

Extracts the protocol out of a given valid URI. The returned string must be freed using glib.global.gfree.

hasProtocol
bool hasProtocol(string uri, string protocol)

Checks if the protocol of a given valid URI matches protocol.

isValid
bool isValid(string uri)

Tests if the given string is a valid URI identifier. URIs start with a valid scheme followed by ":" and maybe a string identifying the location.

joinStrings
string joinStrings(string baseUri, string refUri)

This is a convenience function to join two URI strings and return the result. The returned string should be glib.global.gfree'd after use.

protocolIsSupported
bool protocolIsSupported(gst.types.URIType type, string protocol)

Checks if an element exists that supports the given URI protocol. Note that a positive return value does not imply that a subsequent call to gst.element.Element.makeFromUri is guaranteed to work.

protocolIsValid
bool protocolIsValid(string protocol)

Tests if the given string is a valid protocol identifier. Protocols must consist of alphanumeric characters, '+', '-' and '.' and must start with a alphabetic character. See RFC 3986 Section 3.1.

Inherited Members

From Boxed

cInstancePtr
void* cInstancePtr;

Pointer to the C boxed value

getType
GType getType()

Get the GType of this boxed type.

gType
GType gType [@property getter]

Boxed GType property.

self
Boxed self()

Convenience method to return this cast to a type. For use in D with statements.

copy_
void* copy_()

Make a copy of the wrapped C boxed data.

boxedCopy
void* boxedCopy(void* cBoxed)

Copy a C boxed value using g_boxed_copy.

boxedFree
void boxedFree(void* cBoxed)

Free a C boxed value using g_boxed_free.