Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
- Exported types
- Methods
- appendPath
- appendPathSegment
- construct
- equal
- fromString
- fromStringWithBase
- getFragment
- getHost
- getLocation
- 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
- newtype Uri = Uri (ManagedPtr Uri)
- noUri :: Maybe Uri
- data UriAppendPathMethodInfo
- uriAppendPath :: (HasCallStack, MonadIO m) => Uri -> Text -> m Bool
- data UriAppendPathSegmentMethodInfo
- uriAppendPathSegment :: (HasCallStack, MonadIO m) => Uri -> Text -> m Bool
- uriConstruct :: (HasCallStack, MonadIO m) => Text -> Text -> m Text
- data UriEqualMethodInfo
- uriEqual :: (HasCallStack, MonadIO m) => Uri -> Uri -> m Bool
- uriFromString :: (HasCallStack, MonadIO m) => Text -> m (Maybe Uri)
- data UriFromStringWithBaseMethodInfo
- uriFromStringWithBase :: (HasCallStack, MonadIO m) => Uri -> Text -> m Uri
- data UriGetFragmentMethodInfo
- uriGetFragment :: (HasCallStack, MonadIO m) => Uri -> m Text
- data UriGetHostMethodInfo
- uriGetHost :: (HasCallStack, MonadIO m) => Uri -> m Text
- uriGetLocation :: (HasCallStack, MonadIO m) => Text -> m Text
- data UriGetPathMethodInfo
- uriGetPath :: (HasCallStack, MonadIO m) => Uri -> m Text
- data UriGetPathSegmentsMethodInfo
- uriGetPathSegments :: (HasCallStack, MonadIO m) => Uri -> m [Text]
- data UriGetPathStringMethodInfo
- uriGetPathString :: (HasCallStack, MonadIO m) => Uri -> m Text
- data UriGetPortMethodInfo
- uriGetPort :: (HasCallStack, MonadIO m) => Uri -> m Word32
- uriGetProtocol :: (HasCallStack, MonadIO m) => Text -> m Text
- data UriGetQueryKeysMethodInfo
- uriGetQueryKeys :: (HasCallStack, MonadIO m) => Uri -> m [Text]
- data UriGetQueryStringMethodInfo
- uriGetQueryString :: (HasCallStack, MonadIO m) => Uri -> m Text
- data UriGetQueryTableMethodInfo
- uriGetQueryTable :: (HasCallStack, MonadIO m) => Uri -> m (Map Text Text)
- data UriGetQueryValueMethodInfo
- uriGetQueryValue :: (HasCallStack, MonadIO m) => Uri -> Text -> m Text
- data UriGetSchemeMethodInfo
- uriGetScheme :: (HasCallStack, MonadIO m) => Uri -> m Text
- data UriGetUserinfoMethodInfo
- uriGetUserinfo :: (HasCallStack, MonadIO m) => Uri -> m Text
- uriHasProtocol :: (HasCallStack, MonadIO m) => Text -> Text -> m Bool
- data UriIsNormalizedMethodInfo
- uriIsNormalized :: (HasCallStack, MonadIO m) => Uri -> m Bool
- uriIsValid :: (HasCallStack, MonadIO m) => Text -> m Bool
- data UriIsWritableMethodInfo
- uriIsWritable :: (HasCallStack, MonadIO m) => Uri -> m Bool
- data UriJoinMethodInfo
- uriJoin :: (HasCallStack, MonadIO m) => Uri -> Maybe Uri -> m Uri
- uriJoinStrings :: (HasCallStack, MonadIO m) => Text -> Text -> m Text
- data UriMakeWritableMethodInfo
- 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
- data UriNewWithBaseMethodInfo
- uriNewWithBase :: (HasCallStack, MonadIO m) => Uri -> Maybe Text -> Maybe Text -> Maybe Text -> Word32 -> Maybe Text -> Maybe Text -> Maybe Text -> m Uri
- data UriNormalizeMethodInfo
- uriNormalize :: (HasCallStack, MonadIO m) => Uri -> m Bool
- uriProtocolIsSupported :: (HasCallStack, MonadIO m) => URIType -> Text -> m Bool
- uriProtocolIsValid :: (HasCallStack, MonadIO m) => Text -> m Bool
- data UriQueryHasKeyMethodInfo
- uriQueryHasKey :: (HasCallStack, MonadIO m) => Uri -> Text -> m Bool
- data UriRemoveQueryKeyMethodInfo
- uriRemoveQueryKey :: (HasCallStack, MonadIO m) => Uri -> Text -> m Bool
- data UriSetFragmentMethodInfo
- uriSetFragment :: (HasCallStack, MonadIO m) => Uri -> Maybe Text -> m Bool
- data UriSetHostMethodInfo
- uriSetHost :: (HasCallStack, MonadIO m) => Uri -> Text -> m Bool
- data UriSetPathMethodInfo
- uriSetPath :: (HasCallStack, MonadIO m) => Uri -> Text -> m Bool
- data UriSetPathSegmentsMethodInfo
- uriSetPathSegments :: (HasCallStack, MonadIO m) => Uri -> [Text] -> m Bool
- data UriSetPathStringMethodInfo
- uriSetPathString :: (HasCallStack, MonadIO m) => Uri -> Text -> m Bool
- data UriSetPortMethodInfo
- uriSetPort :: (HasCallStack, MonadIO m) => Uri -> Word32 -> m Bool
- data UriSetQueryStringMethodInfo
- uriSetQueryString :: (HasCallStack, MonadIO m) => Uri -> Text -> m Bool
- data UriSetQueryTableMethodInfo
- uriSetQueryTable :: (HasCallStack, MonadIO m) => Uri -> Maybe (Map Text Text) -> m Bool
- data UriSetQueryValueMethodInfo
- uriSetQueryValue :: (HasCallStack, MonadIO m) => Uri -> Text -> Maybe Text -> m Bool
- data UriSetSchemeMethodInfo
- uriSetScheme :: (HasCallStack, MonadIO m) => Uri -> Text -> m Bool
- data UriSetUserinfoMethodInfo
- uriSetUserinfo :: (HasCallStack, MonadIO m) => Uri -> Text -> m Bool
- data UriToStringMethodInfo
- uriToString :: (HasCallStack, MonadIO m) => Uri -> m Text
Exported types
Uri (ManagedPtr Uri) |
Methods
appendPath
data UriAppendPathMethodInfo Source #
((~) * signature (Text -> m Bool), MonadIO m) => MethodInfo * UriAppendPathMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> 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
data UriAppendPathSegmentMethodInfo Source #
((~) * signature (Text -> m Bool), MonadIO m) => MethodInfo * UriAppendPathSegmentMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> 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. Returns |
Constructs a URI for a given valid protocol and location.
Free-function: g_free
equal
data UriEqualMethodInfo Source #
((~) * signature (Uri -> m Bool), MonadIO m) => MethodInfo * UriEqualMethodInfo Uri signature Source # | |
:: (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
fromStringWithBase
data UriFromStringWithBaseMethodInfo Source #
((~) * signature (Text -> m Uri), MonadIO m) => MethodInfo * UriFromStringWithBaseMethodInfo Uri signature Source # | |
uriFromStringWithBase Source #
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Text |
|
-> m Uri | Returns: A new |
Like uriFromString
but also joins with a base URI.
Since: 1.6
getFragment
data UriGetFragmentMethodInfo Source #
((~) * signature (m Text), MonadIO m) => MethodInfo * UriGetFragmentMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m Text |
getHost
data UriGetHostMethodInfo Source #
((~) * signature (m Text), MonadIO m) => MethodInfo * UriGetHostMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m Text |
getLocation
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m 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
getPath
data UriGetPathMethodInfo Source #
((~) * signature (m Text), MonadIO m) => MethodInfo * UriGetPathMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m Text | Returns: The path from the URI. Once finished with the string should be 'GI.GLib.Functions.free'\'d. |
Extract the path string from the URI object.
Since: 1.6
getPathSegments
data UriGetPathSegmentsMethodInfo Source #
((~) * signature (m [Text]), MonadIO m) => MethodInfo * UriGetPathSegmentsMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m [Text] | Returns: A |
Get a list of path segments from the URI.
Since: 1.6
getPathString
data UriGetPathStringMethodInfo Source #
((~) * signature (m Text), MonadIO m) => MethodInfo * UriGetPathStringMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m Text | Returns: The path from the URI. Once finished with the string should be 'GI.GLib.Functions.free'\'d. |
Extract the path string from the URI object as a percent encoded URI path.
Since: 1.6
getPort
data UriGetPortMethodInfo Source #
((~) * signature (m Word32), MonadIO m) => MethodInfo * UriGetPortMethodInfo Uri signature Source # | |
:: (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 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
data UriGetQueryKeysMethodInfo Source #
((~) * signature (m [Text]), MonadIO m) => MethodInfo * UriGetQueryKeysMethodInfo Uri signature Source # | |
:: (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
data UriGetQueryStringMethodInfo Source #
((~) * signature (m Text), MonadIO m) => MethodInfo * UriGetQueryStringMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m 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 (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
data UriGetQueryValueMethodInfo Source #
((~) * signature (Text -> m Text), MonadIO m) => MethodInfo * UriGetQueryValueMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Text |
|
-> m 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
data UriGetSchemeMethodInfo Source #
((~) * signature (m Text), MonadIO m) => MethodInfo * UriGetSchemeMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m Text |
getUserinfo
data UriGetUserinfoMethodInfo Source #
((~) * signature (m Text), MonadIO m) => MethodInfo * UriGetUserinfoMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> m Text |
hasProtocol
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Text |
|
-> m Bool | Returns: |
Checks if the protocol of a given valid URI matches protocol
.
isNormalized
data UriIsNormalizedMethodInfo Source #
((~) * signature (m Bool), MonadIO m) => MethodInfo * UriIsNormalizedMethodInfo Uri signature Source # | |
:: (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
data UriIsWritableMethodInfo Source #
((~) * signature (m Bool), MonadIO m) => MethodInfo * UriIsWritableMethodInfo Uri signature Source # | |
join
data UriJoinMethodInfo Source #
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Maybe Uri |
|
-> m 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 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 'GI.GLib.Functions.free'\'d after use.
Since: 1.6
makeWritable
data UriMakeWritableMethodInfo Source #
((~) * signature (m Uri), MonadIO m) => MethodInfo * UriMakeWritableMethodInfo Uri signature Source # | |
:: (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
data UriNormalizeMethodInfo Source #
((~) * signature (m Bool), MonadIO m) => MethodInfo * UriNormalizeMethodInfo Uri signature Source # | |
:: (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
data UriQueryHasKeyMethodInfo Source #
((~) * signature (Text -> m Bool), MonadIO m) => MethodInfo * UriQueryHasKeyMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Text |
|
-> m Bool | Returns: |
Check if there is a query table entry for the queryKey
key.
Since: 1.6
removeQueryKey
data UriRemoveQueryKeyMethodInfo Source #
((~) * signature (Text -> m Bool), MonadIO m) => MethodInfo * UriRemoveQueryKeyMethodInfo Uri signature Source # | |
:: (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
data UriSetHostMethodInfo Source #
((~) * signature (Text -> m Bool), MonadIO m) => MethodInfo * UriSetHostMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Text |
|
-> m Bool | Returns: |
Set or unset the host for the URI.
Since: 1.6
setPath
data UriSetPathMethodInfo Source #
((~) * signature (Text -> m Bool), MonadIO m) => MethodInfo * UriSetPathMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Text |
|
-> m Bool | Returns: |
Sets or unsets the path in the URI.
Since: 1.6
setPathSegments
data UriSetPathSegmentsMethodInfo Source #
((~) * signature ([Text] -> m Bool), MonadIO m) => MethodInfo * UriSetPathSegmentsMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> [Text] |
|
-> m Bool | Returns: |
Replace the path segments list in the URI.
Since: 1.6
setPathString
data UriSetPathStringMethodInfo Source #
((~) * signature (Text -> m Bool), MonadIO m) => MethodInfo * UriSetPathStringMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Text |
|
-> m Bool | Returns: |
Sets or unsets the path in the URI.
Since: 1.6
setPort
data UriSetPortMethodInfo Source #
((~) * signature (Word32 -> m Bool), MonadIO m) => MethodInfo * UriSetPortMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Word32 |
|
-> m Bool | Returns: |
Set or unset the port number for the URI.
Since: 1.6
setQueryString
data UriSetQueryStringMethodInfo Source #
((~) * signature (Text -> m Bool), MonadIO m) => MethodInfo * UriSetQueryStringMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> 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
data UriSetSchemeMethodInfo Source #
((~) * signature (Text -> m Bool), MonadIO m) => MethodInfo * UriSetSchemeMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Text |
|
-> m Bool | Returns: |
Set or unset the scheme for the URI.
Since: 1.6
setUserinfo
data UriSetUserinfoMethodInfo Source #
((~) * signature (Text -> m Bool), MonadIO m) => MethodInfo * UriSetUserinfoMethodInfo Uri signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Uri |
|
-> Text |
|
-> m Bool | Returns: |
Set or unset the user information for the URI.
Since: 1.6
toString
data UriToStringMethodInfo Source #
((~) * signature (m Text), MonadIO m) => MethodInfo * UriToStringMethodInfo Uri signature Source # | |
:: (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