Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
- Exported types
- Methods
- appendPath
- appendPathSegment
- construct
- equal
- fromString
- fromStringEscaped
- fromStringWithBase
- getFragment
- getHost
- getLocation
- getMediaFragmentTable
- getPath
- getPathSegments
- getPathString
- getPort
- getProtocol
- getQueryKeys
- getQueryString
- getQueryTable
- getQueryValue
- getScheme
- getUserinfo
- hasProtocol
- isNormalized
- isValid
- isWritable
- join
- joinStrings
- makeWritable
- new
- newWithBase
- normalize
- protocolIsSupported
- protocolIsValid
- queryHasKey
- removeQueryKey
- setFragment
- setHost
- setPath
- setPathSegments
- setPathString
- setPort
- setQueryString
- setQueryTable
- setQueryValue
- setScheme
- setUserinfo
- toString
Synopsis
- newtype Uri = Uri (ManagedPtr Uri)
- uriAppendPath :: (HasCallStack, MonadIO m) => Uri -> Maybe Text -> m Bool
- uriAppendPathSegment :: (HasCallStack, MonadIO m) => Uri -> Maybe Text -> m Bool
- uriConstruct :: (HasCallStack, MonadIO m) => Text -> Text -> m Text
- uriEqual :: (HasCallStack, MonadIO m) => Uri -> Uri -> m Bool
- uriFromString :: (HasCallStack, MonadIO m) => Text -> m (Maybe Uri)
- uriFromStringEscaped :: (HasCallStack, MonadIO m) => Text -> m (Maybe Uri)
- uriFromStringWithBase :: (HasCallStack, MonadIO m) => Uri -> Text -> m (Maybe Uri)
- uriGetFragment :: (HasCallStack, MonadIO m) => Uri -> m (Maybe Text)
- uriGetHost :: (HasCallStack, MonadIO m) => Uri -> m (Maybe Text)
- uriGetLocation :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- uriGetMediaFragmentTable :: (HasCallStack, MonadIO m) => Uri -> m (Maybe (Map Text Text))
- uriGetPath :: (HasCallStack, MonadIO m) => Uri -> m (Maybe Text)
- uriGetPathSegments :: (HasCallStack, MonadIO m) => Uri -> m [Text]
- uriGetPathString :: (HasCallStack, MonadIO m) => Uri -> m (Maybe Text)
- uriGetPort :: (HasCallStack, MonadIO m) => Uri -> m Word32
- uriGetProtocol :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- uriGetQueryKeys :: (HasCallStack, MonadIO m) => Uri -> m [Text]
- uriGetQueryString :: (HasCallStack, MonadIO m) => Uri -> m (Maybe Text)
- uriGetQueryTable :: (HasCallStack, MonadIO m) => Uri -> m (Maybe (Map Text Text))
- uriGetQueryValue :: (HasCallStack, MonadIO m) => Uri -> Text -> m (Maybe Text)
- uriGetScheme :: (HasCallStack, MonadIO m) => Uri -> m (Maybe Text)
- uriGetUserinfo :: (HasCallStack, MonadIO m) => Uri -> m (Maybe Text)
- uriHasProtocol :: (HasCallStack, MonadIO m) => Text -> Text -> m Bool
- uriIsNormalized :: (HasCallStack, MonadIO m) => Uri -> m Bool
- uriIsValid :: (HasCallStack, MonadIO m) => Text -> m Bool
- uriIsWritable :: (HasCallStack, MonadIO m) => Uri -> m Bool
- uriJoin :: (HasCallStack, MonadIO m) => Uri -> Maybe Uri -> m (Maybe Uri)
- uriJoinStrings :: (HasCallStack, MonadIO m) => Text -> Text -> m (Maybe Text)
- uriMakeWritable :: (HasCallStack, MonadIO m) => Uri -> m Uri
- uriNew :: (HasCallStack, MonadIO m) => Maybe Text -> Maybe Text -> Maybe Text -> Word32 -> Maybe Text -> Maybe Text -> Maybe Text -> m Uri
- uriNewWithBase :: (HasCallStack, MonadIO m) => Uri -> Maybe Text -> Maybe Text -> Maybe Text -> Word32 -> Maybe Text -> Maybe Text -> Maybe Text -> m Uri
- uriNormalize :: (HasCallStack, MonadIO m) => Uri -> m Bool
- uriProtocolIsSupported :: (HasCallStack, MonadIO m) => URIType -> Text -> m Bool
- uriProtocolIsValid :: (HasCallStack, MonadIO m) => Text -> m Bool
- uriQueryHasKey :: (HasCallStack, MonadIO m) => Uri -> Text -> m Bool
- uriRemoveQueryKey :: (HasCallStack, MonadIO m) => Uri -> Text -> m Bool
- uriSetFragment :: (HasCallStack, MonadIO m) => Uri -> Maybe Text -> m Bool
- uriSetHost :: (HasCallStack, MonadIO m) => Uri -> Text -> m Bool
- uriSetPath :: (HasCallStack, MonadIO m) => Uri -> Maybe Text -> m Bool
- uriSetPathSegments :: (HasCallStack, MonadIO m) => Uri -> [Text] -> m Bool
- uriSetPathString :: (HasCallStack, MonadIO m) => Uri -> Text -> m Bool
- uriSetPort :: (HasCallStack, MonadIO m) => Uri -> Word32 -> m Bool
- uriSetQueryString :: (HasCallStack, MonadIO m) => Uri -> Maybe Text -> m Bool
- uriSetQueryTable :: (HasCallStack, MonadIO m) => Uri -> Maybe (Map Text Text) -> m Bool
- uriSetQueryValue :: (HasCallStack, MonadIO m) => Uri -> Text -> Maybe Text -> m Bool
- uriSetScheme :: (HasCallStack, MonadIO m) => Uri -> Text -> m Bool
- uriSetUserinfo :: (HasCallStack, MonadIO m) => Uri -> Text -> m Bool
- uriToString :: (HasCallStack, MonadIO m) => Uri -> m Text
Exported types
Memory-managed wrapper type.
Instances
Eq Uri Source # | |
GBoxed Uri Source # | |
Defined in GI.Gst.Structs.Uri | |
ManagedPtrNewtype Uri Source # | |
Defined in GI.Gst.Structs.Uri toManagedPtr :: Uri -> ManagedPtr Uri | |
TypedObject Uri Source # | |
Defined in GI.Gst.Structs.Uri | |
HasParentTypes Uri Source # | |
Defined in GI.Gst.Structs.Uri | |
IsGValue (Maybe Uri) Source # | Convert |
Defined in GI.Gst.Structs.Uri gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Uri -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Uri) | |
type ParentTypes Uri Source # | |
Defined in GI.Gst.Structs.Uri |
Methods
Click to display all available methods, including inherited ones
Methods
appendPath, appendPathSegment, equal, fromStringWithBase, isNormalized, isWritable, join, makeWritable, newWithBase, normalize, queryHasKey, removeQueryKey, toString.
Getters
getFragment, getHost, getMediaFragmentTable, getPath, getPathSegments, getPathString, getPort, getQueryKeys, getQueryString, getQueryTable, getQueryValue, getScheme, getUserinfo.
Setters
setFragment, setHost, setPath, setPathSegments, setPathString, setPort, setQueryString, setQueryTable, setQueryValue, setScheme, setUserinfo.
appendPath
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Maybe Text |
|
-> m Bool | Returns: |
Append a path onto the end of the path in the URI. The path is not
normalized, call gst_uri_normalize
() to normalize the path.
Since: 1.6
appendPathSegment
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Maybe Text |
|
-> m Bool | Returns: |
Append a single path segment onto the end of the URI path.
Since: 1.6
construct
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Text |
|
-> m Text | Returns: a new string for this URI. |
Deprecated: Use GstURI instead.
Constructs a URI for a given valid protocol and location.
Free-function: g_free
equal
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Uri |
|
-> m Bool | Returns: |
Compares two Uri
objects to see if they represent the same normalized
URI.
Since: 1.6
fromString
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Uri) | Returns: A new |
Parses a URI string into a new Uri
object. Will return NULL if the URI
cannot be parsed.
Since: 1.6
fromStringEscaped
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Uri) | Returns: A new |
Parses a URI string into a new Uri
object. Will return NULL if the URI
cannot be parsed. This is identical to uriFromString
except that
the userinfo and fragment components of the URI will not be unescaped while
parsing.
Use this when you need to extract a username and password from the userinfo
such as https://user:passwordexample
.com since either may contain
a URI-escaped ':' character. uriFromString
will unescape the entire
userinfo component, which will make it impossible to know which ':'
delineates the username and password.
The same applies to the fragment component of the URI, such as
https://example.com/pathfragment
which may contain a URI-escaped '#'.
Since: 1.18
fromStringWithBase
uriFromStringWithBase Source #
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Text |
|
-> m (Maybe Uri) | Returns: A new |
Like uriFromString
but also joins with a base URI.
Since: 1.6
getFragment
getHost
getLocation
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: the location for this URI. Returns
|
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
free
.
Free-function: g_free
getMediaFragmentTable
uriGetMediaFragmentTable Source #
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m (Maybe (Map Text Text)) | Returns: The fragment hash table from the URI. |
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 Nothing
to indicate that the key should appear in the fragment
string in the URI, but does not have a value. Free the returned HashTable
with g_hash_table_unref
() when it is no longer required.
Modifying this hash table does not affect the fragment in the URI.
See more about Media Fragments URI 1.0 (W3C) at https://www.w3.org/TR/media-frags/
Since: 1.12
getPath
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m (Maybe Text) | Returns: The path from the URI. Once finished
with the string should be |
Extract the path string from the URI object.
Since: 1.6
getPathSegments
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m [Text] | Returns: A |
Get a list of path segments from the URI.
Since: 1.6
getPathString
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m (Maybe Text) | Returns: The path from the URI. Once finished
with the string should be |
Extract the path string from the URI object as a percent encoded URI path.
Since: 1.6
getPort
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m Word32 | Returns: The port number from the |
Get the port number from the URI or URI_NO_PORT
if it doesn't exist.
If uri
is Nothing
then returns URI_NO_PORT
.
Since: 1.6
getProtocol
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: The protocol for this URI. |
Extracts the protocol out of a given valid URI. The returned string must be
freed using free
.
getQueryKeys
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m [Text] | Returns: A list of keys from
the URI query. Free the list with |
Get a list of the query keys from the URI.
Since: 1.6
getQueryString
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m (Maybe Text) | Returns: A percent encoded query string. Use
|
Get a percent encoded URI query string from the uri
.
Since: 1.6
getQueryTable
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m (Maybe (Map Text Text)) | Returns: The query hash table from the URI. |
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 Nothing
to indicate that
the key should appear in the query string in the URI, but does not have a
value. Free the returned HashTable
with g_hash_table_unref
() when it is
no longer required. Modifying this hash table will modify the query in the
URI.
Since: 1.6
getQueryValue
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Text |
|
-> m (Maybe Text) | Returns: The value for the given key, or |
Get the value associated with the queryKey
key. Will return Nothing
if the
key has no value or if the key does not exist in the URI query table. Because
Nothing
is returned for both missing keys and keys with no value, you should
use uriQueryHasKey
to determine if a key is present in the URI
query.
Since: 1.6
getScheme
getUserinfo
hasProtocol
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Text |
|
-> m Bool | Returns: |
Checks if the protocol of a given valid URI matches protocol
.
isNormalized
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m Bool | Returns: TRUE if the URI is normalized or is |
Tests the uri
to see if it is normalized. A Nothing
uri
is considered to be
normalized.
Since: 1.6
isValid
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Bool | Returns: |
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.
isWritable
join
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Maybe Uri |
|
-> m (Maybe Uri) | Returns: A |
Join a reference URI onto a base URI using the method from RFC 3986.
If either URI is Nothing
then the other URI will be returned with the ref count
increased.
Since: 1.6
joinStrings
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Text |
|
-> m (Maybe Text) | Returns: A string representing the percent-encoded join of the two URIs. |
This is a convenience function to join two URI strings and return the result.
The returned string should be free
'd after use.
Since: 1.6
makeWritable
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m Uri | Returns: A writable version of |
new
:: (HasCallStack, MonadIO m) | |
=> Maybe Text |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> Word32 |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> m Uri | Returns: A new |
Creates a new Uri
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.
Since: 1.6
newWithBase
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> Word32 |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> m Uri | Returns: The new URI joined onto |
Like uriNew
, but joins the new URI onto a base URI.
Since: 1.6
normalize
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m Bool | Returns: TRUE if the URI was modified. |
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.
The Uri
object must be writable. Check with uriIsWritable
or use
uriMakeWritable
first.
Since: 1.6
protocolIsSupported
uriProtocolIsSupported Source #
:: (HasCallStack, MonadIO m) | |
=> URIType |
|
-> Text |
|
-> m Bool | Returns: |
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
elementMakeFromUri
is guaranteed to work.
protocolIsValid
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Bool | Returns: |
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.
queryHasKey
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Text |
|
-> m Bool | Returns: |
Check if there is a query table entry for the queryKey
key.
Since: 1.6
removeQueryKey
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Text |
|
-> m Bool | Returns: |
Remove an entry from the query table by key.
Since: 1.6
setFragment
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Maybe Text |
|
-> m Bool | Returns: |
Sets the fragment string in the URI. Use a value of Nothing
in fragment
to
unset the fragment string.
Since: 1.6
setHost
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Text |
|
-> m Bool | Returns: |
Set or unset the host for the URI.
Since: 1.6
setPath
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Maybe Text |
|
-> m Bool | Returns: |
Sets or unsets the path in the URI.
Since: 1.6
setPathSegments
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> [Text] |
|
-> m Bool | Returns: |
Replace the path segments list in the URI.
Since: 1.6
setPathString
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Text |
|
-> m Bool | Returns: |
Sets or unsets the path in the URI.
Since: 1.6
setPort
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Word32 |
|
-> m Bool | Returns: |
Set or unset the port number for the URI.
Since: 1.6
setQueryString
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Maybe Text |
|
-> m Bool | Returns: |
Sets or unsets the query table in the URI.
Since: 1.6
setQueryTable
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Maybe (Map Text Text) |
|
-> m Bool | Returns: |
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 Nothing
for queryTable
will remove the query string from the URI.
Since: 1.6
setQueryValue
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Text |
|
-> Maybe Text |
|
-> m Bool | Returns: |
This inserts or replaces a key in the query table. A queryValue
of Nothing
indicates that the key has no associated value, but will still be present in
the query string.
Since: 1.6
setScheme
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Text |
|
-> m Bool | Returns: |
Set or unset the scheme for the URI.
Since: 1.6
setUserinfo
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Text |
|
-> m Bool | Returns: |
Set or unset the user information for the URI.
Since: 1.6
toString
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m Text | Returns: The string version of the URI. |
Convert the URI to a string.
Returns the URI as held in this object as a gchar
* nul-terminated string.
The caller should free
the string once they are finished with it.
The string is put together as described in RFC 3986.
Since: 1.6