{-# LANGUAGE TypeApplications #-} -- | Copyright : Will Thompson and Iñaki García Etxebarria -- License : LGPL-2.1 -- Maintainer : Iñaki García Etxebarria -- -- The t'GI.GLib.Structs.Uri.Uri' type and related functions can be used to parse URIs into -- their components, and build valid URIs from individual components. -- -- Note that t'GI.GLib.Structs.Uri.Uri' scope is to help manipulate URIs in various applications, -- following <https://tools.ietf.org/html/rfc3986 RFC 3986>. In particular, -- it doesn\'t intend to cover web browser needs, and doesn\'t implement the -- <https://url.spec.whatwg.org/ WHATWG URL> standard. No APIs are provided to -- help prevent -- <https://en.wikipedia.org/wiki/IDN_homograph_attack homograph attacks>, so -- t'GI.GLib.Structs.Uri.Uri' is not suitable for formatting URIs for display to the user for making -- security-sensitive decisions. -- -- ## Relative and absolute URIs # {@/relative/@-absolute-uris} -- -- As defined in <https://tools.ietf.org/html/rfc3986#section-4 RFC 3986>, the -- hierarchical nature of URIs means that they can either be ‘relative -- references’ (sometimes referred to as ‘relative URIs’) or ‘URIs’ (for -- clarity, ‘URIs’ are referred to in this documentation as -- ‘absolute URIs’ — although -- <https://tools.ietf.org/html/rfc3986#section-4.3 in constrast to RFC 3986>, -- fragment identifiers are always allowed). -- -- Relative references have one or more components of the URI missing. In -- particular, they have no scheme. Any other component, such as hostname, -- query, etc. may be missing, apart from a path, which has to be specified (but -- may be empty). The path may be relative, starting with @.\/@ rather than @\/@. -- -- For example, a valid relative reference is @.\/path?query@, -- @\/?query#fragment@ or @\/\/example.com@. -- -- Absolute URIs have a scheme specified. Any other components of the URI which -- are missing are specified as explicitly unset in the URI, rather than being -- resolved relative to a base URI using 'GI.GLib.Structs.Uri.uriParseRelative'. -- -- For example, a valid absolute URI is @file:\/\/\/home\/bob@ or -- @https:\/\/search.com?query=string@. -- -- A t'GI.GLib.Structs.Uri.Uri' instance is always an absolute URI. A string may be an absolute URI -- or a relative reference; see the documentation for individual functions as to -- what forms they accept. -- -- == Parsing URIs -- -- The most minimalist APIs for parsing URIs are 'GI.GLib.Functions.uriSplit' and -- 'GI.GLib.Functions.uriSplitWithUser'. These split a URI into its component -- parts, and return the parts; the difference between the two is that -- 'GI.GLib.Functions.uriSplit' treats the ‘userinfo’ component of the URI as a -- single element, while 'GI.GLib.Functions.uriSplitWithUser' can (depending on the -- t'GI.GLib.Flags.UriFlags' you pass) treat it as containing a username, password, -- and authentication parameters. Alternatively, 'GI.GLib.Functions.uriSplitNetwork' -- can be used when you are only interested in the components that are -- needed to initiate a network connection to the service (scheme, -- host, and port). -- -- 'GI.GLib.Functions.uriParse' is similar to 'GI.GLib.Functions.uriSplit', but instead of returning -- individual strings, it returns a t'GI.GLib.Structs.Uri.Uri' structure (and it requires -- that the URI be an absolute URI). -- -- 'GI.GLib.Functions.uriResolveRelative' and 'GI.GLib.Structs.Uri.uriParseRelative' allow you to -- resolve a relative URI relative to a base URI. -- 'GI.GLib.Functions.uriResolveRelative' takes two strings and returns a string, -- and 'GI.GLib.Structs.Uri.uriParseRelative' takes a t'GI.GLib.Structs.Uri.Uri' and a string and returns a -- t'GI.GLib.Structs.Uri.Uri'. -- -- All of the parsing functions take a t'GI.GLib.Flags.UriFlags' argument describing -- exactly how to parse the URI; see the documentation for that type -- for more details on the specific flags that you can pass. If you -- need to choose different flags based on the type of URI, you can -- use 'GI.GLib.Functions.uriPeekScheme' on the URI string to check the scheme -- first, and use that to decide what flags to parse it with. -- -- For example, you might want to use 'GI.GLib.Flags.UriParamsFlagsWwwForm' when parsing the -- params for a web URI, so compare the result of 'GI.GLib.Functions.uriPeekScheme' against -- @http@ and @https@. -- -- == Building URIs -- -- 'GI.GLib.Functions.uriJoin' and 'GI.GLib.Functions.uriJoinWithUser' can be used to construct -- valid URI strings from a set of component strings. They are the -- inverse of 'GI.GLib.Functions.uriSplit' and 'GI.GLib.Functions.uriSplitWithUser'. -- -- Similarly, 'GI.GLib.Functions.uriBuild' and 'GI.GLib.Functions.uriBuildWithUser' can be used to -- construct a t'GI.GLib.Structs.Uri.Uri' from a set of component strings. -- -- As with the parsing functions, the building functions take a -- t'GI.GLib.Flags.UriFlags' argument. In particular, it is important to keep in mind -- whether the URI components you are using are already @%@-encoded. If so, -- you must pass the 'GI.GLib.Flags.UriFlagsEncoded' flag. -- -- == @file:\/\/@ URIs -- -- Note that Windows and Unix both define special rules for parsing -- @file:\/\/@ URIs (involving non-UTF-8 character sets on Unix, and the -- interpretation of path separators on Windows). t'GI.GLib.Structs.Uri.Uri' does not -- implement these rules. Use 'GI.GLib.Functions.filenameFromUri' and -- 'GI.GLib.Functions.filenameToUri' if you want to properly convert between -- @file:\/\/@ URIs and local filenames. -- -- == URI Equality -- -- Note that there is no @g_uri_equal ()@ function, because comparing -- URIs usefully requires scheme-specific knowledge that t'GI.GLib.Structs.Uri.Uri' does -- not have. t'GI.GLib.Structs.Uri.Uri' can help with normalization if you use the various -- encoded t'GI.GLib.Flags.UriFlags' as well as 'GI.GLib.Flags.UriFlagsSchemeNormalize' however -- it is not comprehensive. -- For example, @data:,foo@ and @data:;base64,Zm9v@ resolve to the same -- thing according to the @data:@ URI specification which GLib does not -- handle. -- -- /Since: 2.66/ #if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__)) #define ENABLE_OVERLOADING #endif module GI.GLib.Structs.Uri ( -- * Exported types Uri(..) , -- * Methods -- | -- -- === __Click to display all available methods, including inherited ones__ -- ==== Methods -- [parseRelative]("GI.GLib.Structs.Uri#g:method:parseRelative"), [toString]("GI.GLib.Structs.Uri#g:method:toString"), [toStringPartial]("GI.GLib.Structs.Uri#g:method:toStringPartial"). -- -- ==== Getters -- [getAuthParams]("GI.GLib.Structs.Uri#g:method:getAuthParams"), [getFlags]("GI.GLib.Structs.Uri#g:method:getFlags"), [getFragment]("GI.GLib.Structs.Uri#g:method:getFragment"), [getHost]("GI.GLib.Structs.Uri#g:method:getHost"), [getPassword]("GI.GLib.Structs.Uri#g:method:getPassword"), [getPath]("GI.GLib.Structs.Uri#g:method:getPath"), [getPort]("GI.GLib.Structs.Uri#g:method:getPort"), [getQuery]("GI.GLib.Structs.Uri#g:method:getQuery"), [getScheme]("GI.GLib.Structs.Uri#g:method:getScheme"), [getUser]("GI.GLib.Structs.Uri#g:method:getUser"), [getUserinfo]("GI.GLib.Structs.Uri#g:method:getUserinfo"). -- -- ==== Setters -- /None/. #if defined(ENABLE_OVERLOADING) ResolveUriMethod , #endif -- ** build #method:build# uriBuild , -- ** buildWithUser #method:buildWithUser# uriBuildWithUser , -- ** errorQuark #method:errorQuark# uriErrorQuark , -- ** escapeBytes #method:escapeBytes# uriEscapeBytes , -- ** escapeString #method:escapeString# uriEscapeString , -- ** getAuthParams #method:getAuthParams# #if defined(ENABLE_OVERLOADING) UriGetAuthParamsMethodInfo , #endif uriGetAuthParams , -- ** getFlags #method:getFlags# #if defined(ENABLE_OVERLOADING) UriGetFlagsMethodInfo , #endif uriGetFlags , -- ** getFragment #method:getFragment# #if defined(ENABLE_OVERLOADING) UriGetFragmentMethodInfo , #endif uriGetFragment , -- ** getHost #method:getHost# #if defined(ENABLE_OVERLOADING) UriGetHostMethodInfo , #endif uriGetHost , -- ** getPassword #method:getPassword# #if defined(ENABLE_OVERLOADING) UriGetPasswordMethodInfo , #endif uriGetPassword , -- ** getPath #method:getPath# #if defined(ENABLE_OVERLOADING) UriGetPathMethodInfo , #endif uriGetPath , -- ** getPort #method:getPort# #if defined(ENABLE_OVERLOADING) UriGetPortMethodInfo , #endif uriGetPort , -- ** getQuery #method:getQuery# #if defined(ENABLE_OVERLOADING) UriGetQueryMethodInfo , #endif uriGetQuery , -- ** getScheme #method:getScheme# #if defined(ENABLE_OVERLOADING) UriGetSchemeMethodInfo , #endif uriGetScheme , -- ** getUser #method:getUser# #if defined(ENABLE_OVERLOADING) UriGetUserMethodInfo , #endif uriGetUser , -- ** getUserinfo #method:getUserinfo# #if defined(ENABLE_OVERLOADING) UriGetUserinfoMethodInfo , #endif uriGetUserinfo , -- ** isValid #method:isValid# uriIsValid , -- ** join #method:join# uriJoin , -- ** joinWithUser #method:joinWithUser# uriJoinWithUser , -- ** listExtractUris #method:listExtractUris# uriListExtractUris , -- ** parse #method:parse# uriParse , -- ** parseParams #method:parseParams# uriParseParams , -- ** parseRelative #method:parseRelative# #if defined(ENABLE_OVERLOADING) UriParseRelativeMethodInfo , #endif uriParseRelative , -- ** parseScheme #method:parseScheme# uriParseScheme , -- ** peekScheme #method:peekScheme# uriPeekScheme , -- ** resolveRelative #method:resolveRelative# uriResolveRelative , -- ** split #method:split# uriSplit , -- ** splitNetwork #method:splitNetwork# uriSplitNetwork , -- ** splitWithUser #method:splitWithUser# uriSplitWithUser , -- ** toString #method:toString# #if defined(ENABLE_OVERLOADING) UriToStringMethodInfo , #endif uriToString , -- ** toStringPartial #method:toStringPartial# #if defined(ENABLE_OVERLOADING) UriToStringPartialMethodInfo , #endif uriToStringPartial , -- ** unescapeBytes #method:unescapeBytes# uriUnescapeBytes , -- ** unescapeSegment #method:unescapeSegment# uriUnescapeSegment , -- ** unescapeString #method:unescapeString# uriUnescapeString , ) where import Data.GI.Base.ShortPrelude import qualified Data.GI.Base.ShortPrelude as SP import qualified Data.GI.Base.Overloading as O import qualified Prelude as P import qualified Data.GI.Base.Attributes as GI.Attributes import qualified Data.GI.Base.BasicTypes as B.Types import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr import qualified Data.GI.Base.GArray as B.GArray import qualified Data.GI.Base.GClosure as B.GClosure import qualified Data.GI.Base.GError as B.GError import qualified Data.GI.Base.GHashTable as B.GHT import qualified Data.GI.Base.GVariant as B.GVariant import qualified Data.GI.Base.GValue as B.GValue import qualified Data.GI.Base.GParamSpec as B.GParamSpec import qualified Data.GI.Base.CallStack as B.CallStack import qualified Data.GI.Base.Properties as B.Properties import qualified Data.GI.Base.Signals as B.Signals import qualified Control.Monad.IO.Class as MIO import qualified Data.Coerce as Coerce import qualified Data.Text as T import qualified Data.Kind as DK import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import qualified Foreign.Ptr as FP import qualified GHC.OverloadedLabels as OL import qualified GHC.Records as R import {-# SOURCE #-} qualified GI.GLib.Flags as GLib.Flags import {-# SOURCE #-} qualified GI.GLib.Structs.Bytes as GLib.Bytes -- | Memory-managed wrapper type. newtype Uri = Uri (SP.ManagedPtr Uri) deriving (Uri -> Uri -> Bool forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: Uri -> Uri -> Bool $c/= :: Uri -> Uri -> Bool == :: Uri -> Uri -> Bool $c== :: Uri -> Uri -> Bool Eq) instance SP.ManagedPtrNewtype Uri where toManagedPtr :: Uri -> ManagedPtr Uri toManagedPtr (Uri ManagedPtr Uri p) = ManagedPtr Uri p foreign import ccall "g_uri_get_type" c_g_uri_get_type :: IO GType type instance O.ParentTypes Uri = '[] instance O.HasParentTypes Uri instance B.Types.TypedObject Uri where glibType :: IO GType glibType = IO GType c_g_uri_get_type instance B.Types.GBoxed Uri -- | Convert 'Uri' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'. instance B.GValue.IsGValue (Maybe Uri) where gvalueGType_ :: IO GType gvalueGType_ = IO GType c_g_uri_get_type gvalueSet_ :: Ptr GValue -> Maybe Uri -> IO () gvalueSet_ Ptr GValue gv Maybe Uri P.Nothing = forall a. Ptr GValue -> Ptr a -> IO () B.GValue.set_boxed Ptr GValue gv (forall a. Ptr a FP.nullPtr :: FP.Ptr Uri) gvalueSet_ Ptr GValue gv (P.Just Uri obj) = forall a c. (HasCallStack, ManagedPtrNewtype a) => a -> (Ptr a -> IO c) -> IO c B.ManagedPtr.withManagedPtr Uri obj (forall a. Ptr GValue -> Ptr a -> IO () B.GValue.set_boxed Ptr GValue gv) gvalueGet_ :: Ptr GValue -> IO (Maybe Uri) gvalueGet_ Ptr GValue gv = do Ptr Uri ptr <- forall b. Ptr GValue -> IO (Ptr b) B.GValue.get_boxed Ptr GValue gv :: IO (Ptr Uri) if Ptr Uri ptr forall a. Eq a => a -> a -> Bool /= forall a. Ptr a FP.nullPtr then forall a. a -> Maybe a P.Just forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall a. (HasCallStack, GBoxed a) => (ManagedPtr a -> a) -> Ptr a -> IO a B.ManagedPtr.newBoxed ManagedPtr Uri -> Uri Uri Ptr Uri ptr else forall (m :: * -> *) a. Monad m => a -> m a return forall a. Maybe a P.Nothing #if defined(ENABLE_OVERLOADING) instance O.HasAttributeList Uri type instance O.AttributeList Uri = UriAttributeList type UriAttributeList = ('[ ] :: [(Symbol, DK.Type)]) #endif -- method Uri::get_auth_params -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "uri" -- , argType = TInterface Name { namespace = "GLib" , name = "Uri" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUri" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_get_auth_params" g_uri_get_auth_params :: Ptr Uri -> -- uri : TInterface (Name {namespace = "GLib", name = "Uri"}) IO CString -- | Gets /@uri@/\'s authentication parameters, which may contain -- @%@-encoding, depending on the flags with which /@uri@/ was created. -- (If /@uri@/ was not created with 'GI.GLib.Flags.UriFlagsHasAuthParams' then this will -- be 'P.Nothing'.) -- -- Depending on the URI scheme, 'GI.GLib.Functions.uriParseParams' may be useful for -- further parsing this information. -- -- /Since: 2.66/ uriGetAuthParams :: (B.CallStack.HasCallStack, MonadIO m) => Uri -- ^ /@uri@/: a t'GI.GLib.Structs.Uri.Uri' -> m (Maybe T.Text) -- ^ __Returns:__ /@uri@/\'s authentication parameters. uriGetAuthParams :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> m (Maybe Text) uriGetAuthParams Uri uri = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do Ptr Uri uri' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Uri uri CString result <- Ptr Uri -> IO CString g_uri_get_auth_params Ptr Uri uri' Maybe Text maybeResult <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString result forall a b. (a -> b) -> a -> b $ \CString result' -> do Text result'' <- HasCallStack => CString -> IO Text cstringToText CString result' forall (m :: * -> *) a. Monad m => a -> m a return Text result'' forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Uri uri forall (m :: * -> *) a. Monad m => a -> m a return Maybe Text maybeResult #if defined(ENABLE_OVERLOADING) data UriGetAuthParamsMethodInfo instance (signature ~ (m (Maybe T.Text)), MonadIO m) => O.OverloadedMethod UriGetAuthParamsMethodInfo Uri signature where overloadedMethod = uriGetAuthParams instance O.OverloadedMethodInfo UriGetAuthParamsMethodInfo Uri where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.Uri.uriGetAuthParams", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.27/docs/GI-GLib-Structs-Uri.html#v:uriGetAuthParams" }) #endif -- method Uri::get_flags -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "uri" -- , argType = TInterface Name { namespace = "GLib" , name = "Uri" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUri" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "GLib" , name = "UriFlags" }) -- throws : False -- Skip return : False foreign import ccall "g_uri_get_flags" g_uri_get_flags :: Ptr Uri -> -- uri : TInterface (Name {namespace = "GLib", name = "Uri"}) IO CUInt -- | Gets /@uri@/\'s flags set upon construction. -- -- /Since: 2.66/ uriGetFlags :: (B.CallStack.HasCallStack, MonadIO m) => Uri -- ^ /@uri@/: a t'GI.GLib.Structs.Uri.Uri' -> m [GLib.Flags.UriFlags] -- ^ __Returns:__ /@uri@/\'s flags. uriGetFlags :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> m [UriFlags] uriGetFlags Uri uri = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do Ptr Uri uri' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Uri uri CUInt result <- Ptr Uri -> IO CUInt g_uri_get_flags Ptr Uri uri' let result' :: [UriFlags] result' = forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b] wordToGFlags CUInt result forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Uri uri forall (m :: * -> *) a. Monad m => a -> m a return [UriFlags] result' #if defined(ENABLE_OVERLOADING) data UriGetFlagsMethodInfo instance (signature ~ (m [GLib.Flags.UriFlags]), MonadIO m) => O.OverloadedMethod UriGetFlagsMethodInfo Uri signature where overloadedMethod = uriGetFlags instance O.OverloadedMethodInfo UriGetFlagsMethodInfo Uri where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.Uri.uriGetFlags", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.27/docs/GI-GLib-Structs-Uri.html#v:uriGetFlags" }) #endif -- method Uri::get_fragment -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "uri" -- , argType = TInterface Name { namespace = "GLib" , name = "Uri" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUri" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_get_fragment" g_uri_get_fragment :: Ptr Uri -> -- uri : TInterface (Name {namespace = "GLib", name = "Uri"}) IO CString -- | Gets /@uri@/\'s fragment, which may contain @%@-encoding, depending on -- the flags with which /@uri@/ was created. -- -- /Since: 2.66/ uriGetFragment :: (B.CallStack.HasCallStack, MonadIO m) => Uri -- ^ /@uri@/: a t'GI.GLib.Structs.Uri.Uri' -> m (Maybe T.Text) -- ^ __Returns:__ /@uri@/\'s fragment. uriGetFragment :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> m (Maybe Text) uriGetFragment Uri uri = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do Ptr Uri uri' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Uri uri CString result <- Ptr Uri -> IO CString g_uri_get_fragment Ptr Uri uri' Maybe Text maybeResult <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString result forall a b. (a -> b) -> a -> b $ \CString result' -> do Text result'' <- HasCallStack => CString -> IO Text cstringToText CString result' forall (m :: * -> *) a. Monad m => a -> m a return Text result'' forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Uri uri forall (m :: * -> *) a. Monad m => a -> m a return Maybe Text maybeResult #if defined(ENABLE_OVERLOADING) data UriGetFragmentMethodInfo instance (signature ~ (m (Maybe T.Text)), MonadIO m) => O.OverloadedMethod UriGetFragmentMethodInfo Uri signature where overloadedMethod = uriGetFragment instance O.OverloadedMethodInfo UriGetFragmentMethodInfo Uri where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.Uri.uriGetFragment", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.27/docs/GI-GLib-Structs-Uri.html#v:uriGetFragment" }) #endif -- method Uri::get_host -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "uri" -- , argType = TInterface Name { namespace = "GLib" , name = "Uri" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUri" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_get_host" g_uri_get_host :: Ptr Uri -> -- uri : TInterface (Name {namespace = "GLib", name = "Uri"}) IO CString -- | Gets /@uri@/\'s host. This will never have @%@-encoded characters, -- unless it is non-UTF-8 (which can only be the case if /@uri@/ was -- created with 'GI.GLib.Flags.UriFlagsNonDns'). -- -- If /@uri@/ contained an IPv6 address literal, this value will be just -- that address, without the brackets around it that are necessary in -- the string form of the URI. Note that in this case there may also -- be a scope ID attached to the address. Eg, @fe80::1234%@@em1@ (or -- @fe80::1234%@@25em1@ if the string is still encoded). -- -- /Since: 2.66/ uriGetHost :: (B.CallStack.HasCallStack, MonadIO m) => Uri -- ^ /@uri@/: a t'GI.GLib.Structs.Uri.Uri' -> m (Maybe T.Text) -- ^ __Returns:__ /@uri@/\'s host. uriGetHost :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> m (Maybe Text) uriGetHost Uri uri = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do Ptr Uri uri' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Uri uri CString result <- Ptr Uri -> IO CString g_uri_get_host Ptr Uri uri' Maybe Text maybeResult <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString result forall a b. (a -> b) -> a -> b $ \CString result' -> do Text result'' <- HasCallStack => CString -> IO Text cstringToText CString result' forall (m :: * -> *) a. Monad m => a -> m a return Text result'' forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Uri uri forall (m :: * -> *) a. Monad m => a -> m a return Maybe Text maybeResult #if defined(ENABLE_OVERLOADING) data UriGetHostMethodInfo instance (signature ~ (m (Maybe T.Text)), MonadIO m) => O.OverloadedMethod UriGetHostMethodInfo Uri signature where overloadedMethod = uriGetHost instance O.OverloadedMethodInfo UriGetHostMethodInfo Uri where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.Uri.uriGetHost", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.27/docs/GI-GLib-Structs-Uri.html#v:uriGetHost" }) #endif -- method Uri::get_password -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "uri" -- , argType = TInterface Name { namespace = "GLib" , name = "Uri" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUri" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_get_password" g_uri_get_password :: Ptr Uri -> -- uri : TInterface (Name {namespace = "GLib", name = "Uri"}) IO CString -- | Gets /@uri@/\'s password, which may contain @%@-encoding, depending on -- the flags with which /@uri@/ was created. (If /@uri@/ was not created -- with 'GI.GLib.Flags.UriFlagsHasPassword' then this will be 'P.Nothing'.) -- -- /Since: 2.66/ uriGetPassword :: (B.CallStack.HasCallStack, MonadIO m) => Uri -- ^ /@uri@/: a t'GI.GLib.Structs.Uri.Uri' -> m (Maybe T.Text) -- ^ __Returns:__ /@uri@/\'s password. uriGetPassword :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> m (Maybe Text) uriGetPassword Uri uri = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do Ptr Uri uri' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Uri uri CString result <- Ptr Uri -> IO CString g_uri_get_password Ptr Uri uri' Maybe Text maybeResult <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString result forall a b. (a -> b) -> a -> b $ \CString result' -> do Text result'' <- HasCallStack => CString -> IO Text cstringToText CString result' forall (m :: * -> *) a. Monad m => a -> m a return Text result'' forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Uri uri forall (m :: * -> *) a. Monad m => a -> m a return Maybe Text maybeResult #if defined(ENABLE_OVERLOADING) data UriGetPasswordMethodInfo instance (signature ~ (m (Maybe T.Text)), MonadIO m) => O.OverloadedMethod UriGetPasswordMethodInfo Uri signature where overloadedMethod = uriGetPassword instance O.OverloadedMethodInfo UriGetPasswordMethodInfo Uri where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.Uri.uriGetPassword", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.27/docs/GI-GLib-Structs-Uri.html#v:uriGetPassword" }) #endif -- method Uri::get_path -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "uri" -- , argType = TInterface Name { namespace = "GLib" , name = "Uri" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUri" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_get_path" g_uri_get_path :: Ptr Uri -> -- uri : TInterface (Name {namespace = "GLib", name = "Uri"}) IO CString -- | Gets /@uri@/\'s path, which may contain @%@-encoding, depending on the -- flags with which /@uri@/ was created. -- -- /Since: 2.66/ uriGetPath :: (B.CallStack.HasCallStack, MonadIO m) => Uri -- ^ /@uri@/: a t'GI.GLib.Structs.Uri.Uri' -> m T.Text -- ^ __Returns:__ /@uri@/\'s path. uriGetPath :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> m Text uriGetPath Uri uri = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do Ptr Uri uri' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Uri uri CString result <- Ptr Uri -> IO CString g_uri_get_path Ptr Uri uri' forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "uriGetPath" CString result Text result' <- HasCallStack => CString -> IO Text cstringToText CString result forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Uri uri forall (m :: * -> *) a. Monad m => a -> m a return Text result' #if defined(ENABLE_OVERLOADING) data UriGetPathMethodInfo instance (signature ~ (m T.Text), MonadIO m) => O.OverloadedMethod UriGetPathMethodInfo Uri signature where overloadedMethod = uriGetPath instance O.OverloadedMethodInfo UriGetPathMethodInfo Uri where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.Uri.uriGetPath", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.27/docs/GI-GLib-Structs-Uri.html#v:uriGetPath" }) #endif -- method Uri::get_port -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "uri" -- , argType = TInterface Name { namespace = "GLib" , name = "Uri" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUri" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TInt) -- throws : False -- Skip return : False foreign import ccall "g_uri_get_port" g_uri_get_port :: Ptr Uri -> -- uri : TInterface (Name {namespace = "GLib", name = "Uri"}) IO Int32 -- | Gets /@uri@/\'s port. -- -- /Since: 2.66/ uriGetPort :: (B.CallStack.HasCallStack, MonadIO m) => Uri -- ^ /@uri@/: a t'GI.GLib.Structs.Uri.Uri' -> m Int32 -- ^ __Returns:__ /@uri@/\'s port, or @-1@ if no port was specified. uriGetPort :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> m Int32 uriGetPort Uri uri = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do Ptr Uri uri' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Uri uri Int32 result <- Ptr Uri -> IO Int32 g_uri_get_port Ptr Uri uri' forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Uri uri forall (m :: * -> *) a. Monad m => a -> m a return Int32 result #if defined(ENABLE_OVERLOADING) data UriGetPortMethodInfo instance (signature ~ (m Int32), MonadIO m) => O.OverloadedMethod UriGetPortMethodInfo Uri signature where overloadedMethod = uriGetPort instance O.OverloadedMethodInfo UriGetPortMethodInfo Uri where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.Uri.uriGetPort", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.27/docs/GI-GLib-Structs-Uri.html#v:uriGetPort" }) #endif -- method Uri::get_query -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "uri" -- , argType = TInterface Name { namespace = "GLib" , name = "Uri" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUri" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_get_query" g_uri_get_query :: Ptr Uri -> -- uri : TInterface (Name {namespace = "GLib", name = "Uri"}) IO CString -- | Gets /@uri@/\'s query, which may contain @%@-encoding, depending on the -- flags with which /@uri@/ was created. -- -- For queries consisting of a series of @name=value@ parameters, -- t'GI.GLib.Structs.UriParamsIter.UriParamsIter' or 'GI.GLib.Functions.uriParseParams' may be useful. -- -- /Since: 2.66/ uriGetQuery :: (B.CallStack.HasCallStack, MonadIO m) => Uri -- ^ /@uri@/: a t'GI.GLib.Structs.Uri.Uri' -> m (Maybe T.Text) -- ^ __Returns:__ /@uri@/\'s query. uriGetQuery :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> m (Maybe Text) uriGetQuery Uri uri = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do Ptr Uri uri' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Uri uri CString result <- Ptr Uri -> IO CString g_uri_get_query Ptr Uri uri' Maybe Text maybeResult <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString result forall a b. (a -> b) -> a -> b $ \CString result' -> do Text result'' <- HasCallStack => CString -> IO Text cstringToText CString result' forall (m :: * -> *) a. Monad m => a -> m a return Text result'' forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Uri uri forall (m :: * -> *) a. Monad m => a -> m a return Maybe Text maybeResult #if defined(ENABLE_OVERLOADING) data UriGetQueryMethodInfo instance (signature ~ (m (Maybe T.Text)), MonadIO m) => O.OverloadedMethod UriGetQueryMethodInfo Uri signature where overloadedMethod = uriGetQuery instance O.OverloadedMethodInfo UriGetQueryMethodInfo Uri where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.Uri.uriGetQuery", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.27/docs/GI-GLib-Structs-Uri.html#v:uriGetQuery" }) #endif -- method Uri::get_scheme -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "uri" -- , argType = TInterface Name { namespace = "GLib" , name = "Uri" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUri" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_get_scheme" g_uri_get_scheme :: Ptr Uri -> -- uri : TInterface (Name {namespace = "GLib", name = "Uri"}) IO CString -- | Gets /@uri@/\'s scheme. Note that this will always be all-lowercase, -- regardless of the string or strings that /@uri@/ was created from. -- -- /Since: 2.66/ uriGetScheme :: (B.CallStack.HasCallStack, MonadIO m) => Uri -- ^ /@uri@/: a t'GI.GLib.Structs.Uri.Uri' -> m T.Text -- ^ __Returns:__ /@uri@/\'s scheme. uriGetScheme :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> m Text uriGetScheme Uri uri = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do Ptr Uri uri' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Uri uri CString result <- Ptr Uri -> IO CString g_uri_get_scheme Ptr Uri uri' forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "uriGetScheme" CString result Text result' <- HasCallStack => CString -> IO Text cstringToText CString result forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Uri uri forall (m :: * -> *) a. Monad m => a -> m a return Text result' #if defined(ENABLE_OVERLOADING) data UriGetSchemeMethodInfo instance (signature ~ (m T.Text), MonadIO m) => O.OverloadedMethod UriGetSchemeMethodInfo Uri signature where overloadedMethod = uriGetScheme instance O.OverloadedMethodInfo UriGetSchemeMethodInfo Uri where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.Uri.uriGetScheme", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.27/docs/GI-GLib-Structs-Uri.html#v:uriGetScheme" }) #endif -- method Uri::get_user -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "uri" -- , argType = TInterface Name { namespace = "GLib" , name = "Uri" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUri" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_get_user" g_uri_get_user :: Ptr Uri -> -- uri : TInterface (Name {namespace = "GLib", name = "Uri"}) IO CString -- | Gets the ‘username’ component of /@uri@/\'s userinfo, which may contain -- @%@-encoding, depending on the flags with which /@uri@/ was created. -- If /@uri@/ was not created with 'GI.GLib.Flags.UriFlagsHasPassword' or -- 'GI.GLib.Flags.UriFlagsHasAuthParams', this is the same as 'GI.GLib.Structs.Uri.uriGetUserinfo'. -- -- /Since: 2.66/ uriGetUser :: (B.CallStack.HasCallStack, MonadIO m) => Uri -- ^ /@uri@/: a t'GI.GLib.Structs.Uri.Uri' -> m (Maybe T.Text) -- ^ __Returns:__ /@uri@/\'s user. uriGetUser :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> m (Maybe Text) uriGetUser Uri uri = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do Ptr Uri uri' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Uri uri CString result <- Ptr Uri -> IO CString g_uri_get_user Ptr Uri uri' Maybe Text maybeResult <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString result forall a b. (a -> b) -> a -> b $ \CString result' -> do Text result'' <- HasCallStack => CString -> IO Text cstringToText CString result' forall (m :: * -> *) a. Monad m => a -> m a return Text result'' forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Uri uri forall (m :: * -> *) a. Monad m => a -> m a return Maybe Text maybeResult #if defined(ENABLE_OVERLOADING) data UriGetUserMethodInfo instance (signature ~ (m (Maybe T.Text)), MonadIO m) => O.OverloadedMethod UriGetUserMethodInfo Uri signature where overloadedMethod = uriGetUser instance O.OverloadedMethodInfo UriGetUserMethodInfo Uri where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.Uri.uriGetUser", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.27/docs/GI-GLib-Structs-Uri.html#v:uriGetUser" }) #endif -- method Uri::get_userinfo -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "uri" -- , argType = TInterface Name { namespace = "GLib" , name = "Uri" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUri" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_get_userinfo" g_uri_get_userinfo :: Ptr Uri -> -- uri : TInterface (Name {namespace = "GLib", name = "Uri"}) IO CString -- | Gets /@uri@/\'s userinfo, which may contain @%@-encoding, depending on -- the flags with which /@uri@/ was created. -- -- /Since: 2.66/ uriGetUserinfo :: (B.CallStack.HasCallStack, MonadIO m) => Uri -- ^ /@uri@/: a t'GI.GLib.Structs.Uri.Uri' -> m (Maybe T.Text) -- ^ __Returns:__ /@uri@/\'s userinfo. uriGetUserinfo :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> m (Maybe Text) uriGetUserinfo Uri uri = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do Ptr Uri uri' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Uri uri CString result <- Ptr Uri -> IO CString g_uri_get_userinfo Ptr Uri uri' Maybe Text maybeResult <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString result forall a b. (a -> b) -> a -> b $ \CString result' -> do Text result'' <- HasCallStack => CString -> IO Text cstringToText CString result' forall (m :: * -> *) a. Monad m => a -> m a return Text result'' forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Uri uri forall (m :: * -> *) a. Monad m => a -> m a return Maybe Text maybeResult #if defined(ENABLE_OVERLOADING) data UriGetUserinfoMethodInfo instance (signature ~ (m (Maybe T.Text)), MonadIO m) => O.OverloadedMethod UriGetUserinfoMethodInfo Uri signature where overloadedMethod = uriGetUserinfo instance O.OverloadedMethodInfo UriGetUserinfoMethodInfo Uri where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.Uri.uriGetUserinfo", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.27/docs/GI-GLib-Structs-Uri.html#v:uriGetUserinfo" }) #endif -- method Uri::parse_relative -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "base_uri" -- , argType = TInterface Name { namespace = "GLib" , name = "Uri" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a base absolute URI" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "uri_ref" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "a string representing a relative or absolute URI" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "flags" -- , argType = -- TInterface Name { namespace = "GLib" , name = "UriFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "flags describing how to parse @uri_ref" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "GLib" , name = "Uri" }) -- throws : True -- Skip return : False foreign import ccall "g_uri_parse_relative" g_uri_parse_relative :: Ptr Uri -> -- base_uri : TInterface (Name {namespace = "GLib", name = "Uri"}) CString -> -- uri_ref : TBasicType TUTF8 CUInt -> -- flags : TInterface (Name {namespace = "GLib", name = "UriFlags"}) Ptr (Ptr GError) -> -- error IO (Ptr Uri) -- | Parses /@uriRef@/ according to /@flags@/ and, if it is a -- [relative URI][relative-absolute-uris], resolves it relative to /@baseUri@/. -- If the result is not a valid absolute URI, it will be discarded, and an error -- returned. -- -- /Since: 2.66/ uriParseRelative :: (B.CallStack.HasCallStack, MonadIO m) => Uri -- ^ /@baseUri@/: a base absolute URI -> T.Text -- ^ /@uriRef@/: a string representing a relative or absolute URI -> [GLib.Flags.UriFlags] -- ^ /@flags@/: flags describing how to parse /@uriRef@/ -> m Uri -- ^ __Returns:__ a new t'GI.GLib.Structs.Uri.Uri', or NULL on error. /(Can throw 'Data.GI.Base.GError.GError')/ uriParseRelative :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> Text -> [UriFlags] -> m Uri uriParseRelative Uri baseUri Text uriRef [UriFlags] flags = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do Ptr Uri baseUri' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Uri baseUri CString uriRef' <- Text -> IO CString textToCString Text uriRef let flags' :: CUInt flags' = forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [UriFlags] flags forall a b. IO a -> IO b -> IO a onException (do Ptr Uri result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError forall a b. (a -> b) -> a -> b $ Ptr Uri -> CString -> CUInt -> Ptr (Ptr GError) -> IO (Ptr Uri) g_uri_parse_relative Ptr Uri baseUri' CString uriRef' CUInt flags' forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "uriParseRelative" Ptr Uri result Uri result' <- (forall a. (HasCallStack, GBoxed a) => (ManagedPtr a -> a) -> Ptr a -> IO a wrapBoxed ManagedPtr Uri -> Uri Uri) Ptr Uri result forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Uri baseUri forall a. Ptr a -> IO () freeMem CString uriRef' forall (m :: * -> *) a. Monad m => a -> m a return Uri result' ) (do forall a. Ptr a -> IO () freeMem CString uriRef' ) #if defined(ENABLE_OVERLOADING) data UriParseRelativeMethodInfo instance (signature ~ (T.Text -> [GLib.Flags.UriFlags] -> m Uri), MonadIO m) => O.OverloadedMethod UriParseRelativeMethodInfo Uri signature where overloadedMethod = uriParseRelative instance O.OverloadedMethodInfo UriParseRelativeMethodInfo Uri where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.Uri.uriParseRelative", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.27/docs/GI-GLib-Structs-Uri.html#v:uriParseRelative" }) #endif -- method Uri::to_string -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "uri" -- , argType = TInterface Name { namespace = "GLib" , name = "Uri" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUri" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_to_string" g_uri_to_string :: Ptr Uri -> -- uri : TInterface (Name {namespace = "GLib", name = "Uri"}) IO CString -- | Returns a string representing /@uri@/. -- -- This is not guaranteed to return a string which is identical to the -- string that /@uri@/ was parsed from. However, if the source URI was -- syntactically correct (according to RFC 3986), and it was parsed -- with 'GI.GLib.Flags.UriFlagsEncoded', then 'GI.GLib.Structs.Uri.uriToString' is guaranteed to return -- a string which is at least semantically equivalent to the source -- URI (according to RFC 3986). -- -- If /@uri@/ might contain sensitive details, such as authentication parameters, -- or private data in its query string, and the returned string is going to be -- logged, then consider using 'GI.GLib.Structs.Uri.uriToStringPartial' to redact parts. -- -- /Since: 2.66/ uriToString :: (B.CallStack.HasCallStack, MonadIO m) => Uri -- ^ /@uri@/: a t'GI.GLib.Structs.Uri.Uri' -> m T.Text -- ^ __Returns:__ a string representing /@uri@/, -- which the caller must free. uriToString :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> m Text uriToString Uri uri = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do Ptr Uri uri' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Uri uri CString result <- Ptr Uri -> IO CString g_uri_to_string Ptr Uri uri' forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "uriToString" CString result Text result' <- HasCallStack => CString -> IO Text cstringToText CString result forall a. Ptr a -> IO () freeMem CString result forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Uri uri forall (m :: * -> *) a. Monad m => a -> m a return Text result' #if defined(ENABLE_OVERLOADING) data UriToStringMethodInfo instance (signature ~ (m T.Text), MonadIO m) => O.OverloadedMethod UriToStringMethodInfo Uri signature where overloadedMethod = uriToString instance O.OverloadedMethodInfo UriToStringMethodInfo Uri where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.Uri.uriToString", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.27/docs/GI-GLib-Structs-Uri.html#v:uriToString" }) #endif -- method Uri::to_string_partial -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "uri" -- , argType = TInterface Name { namespace = "GLib" , name = "Uri" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUri" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "flags" -- , argType = -- TInterface Name { namespace = "GLib" , name = "UriHideFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "flags describing what parts of @uri to hide" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_to_string_partial" g_uri_to_string_partial :: Ptr Uri -> -- uri : TInterface (Name {namespace = "GLib", name = "Uri"}) CUInt -> -- flags : TInterface (Name {namespace = "GLib", name = "UriHideFlags"}) IO CString -- | Returns a string representing /@uri@/, subject to the options in -- /@flags@/. See 'GI.GLib.Structs.Uri.uriToString' and t'GI.GLib.Flags.UriHideFlags' for more details. -- -- /Since: 2.66/ uriToStringPartial :: (B.CallStack.HasCallStack, MonadIO m) => Uri -- ^ /@uri@/: a t'GI.GLib.Structs.Uri.Uri' -> [GLib.Flags.UriHideFlags] -- ^ /@flags@/: flags describing what parts of /@uri@/ to hide -> m T.Text -- ^ __Returns:__ a string representing -- /@uri@/, which the caller must free. uriToStringPartial :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> [UriHideFlags] -> m Text uriToStringPartial Uri uri [UriHideFlags] flags = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do Ptr Uri uri' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Uri uri let flags' :: CUInt flags' = forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [UriHideFlags] flags CString result <- Ptr Uri -> CUInt -> IO CString g_uri_to_string_partial Ptr Uri uri' CUInt flags' forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "uriToStringPartial" CString result Text result' <- HasCallStack => CString -> IO Text cstringToText CString result forall a. Ptr a -> IO () freeMem CString result forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Uri uri forall (m :: * -> *) a. Monad m => a -> m a return Text result' #if defined(ENABLE_OVERLOADING) data UriToStringPartialMethodInfo instance (signature ~ ([GLib.Flags.UriHideFlags] -> m T.Text), MonadIO m) => O.OverloadedMethod UriToStringPartialMethodInfo Uri signature where overloadedMethod = uriToStringPartial instance O.OverloadedMethodInfo UriToStringPartialMethodInfo Uri where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.Uri.uriToStringPartial", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.27/docs/GI-GLib-Structs-Uri.html#v:uriToStringPartial" }) #endif -- method Uri::build -- method type : MemberFunction -- Args: [ Arg -- { argCName = "flags" -- , argType = -- TInterface Name { namespace = "GLib" , name = "UriFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "flags describing how to build the #GUri" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "scheme" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the URI scheme" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "userinfo" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the userinfo component, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "host" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the host component, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "port" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the port, or `-1`" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "path" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the path component" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "query" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the query component, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "fragment" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the fragment, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "GLib" , name = "Uri" }) -- throws : False -- Skip return : False foreign import ccall "g_uri_build" g_uri_build :: CUInt -> -- flags : TInterface (Name {namespace = "GLib", name = "UriFlags"}) CString -> -- scheme : TBasicType TUTF8 CString -> -- userinfo : TBasicType TUTF8 CString -> -- host : TBasicType TUTF8 Int32 -> -- port : TBasicType TInt CString -> -- path : TBasicType TUTF8 CString -> -- query : TBasicType TUTF8 CString -> -- fragment : TBasicType TUTF8 IO (Ptr Uri) -- | Creates a new t'GI.GLib.Structs.Uri.Uri' from the given components according to /@flags@/. -- -- See also 'GI.GLib.Functions.uriBuildWithUser', which allows specifying the -- components of the \"userinfo\" separately. -- -- /Since: 2.66/ uriBuild :: (B.CallStack.HasCallStack, MonadIO m) => [GLib.Flags.UriFlags] -- ^ /@flags@/: flags describing how to build the t'GI.GLib.Structs.Uri.Uri' -> T.Text -- ^ /@scheme@/: the URI scheme -> Maybe (T.Text) -- ^ /@userinfo@/: the userinfo component, or 'P.Nothing' -> Maybe (T.Text) -- ^ /@host@/: the host component, or 'P.Nothing' -> Int32 -- ^ /@port@/: the port, or @-1@ -> T.Text -- ^ /@path@/: the path component -> Maybe (T.Text) -- ^ /@query@/: the query component, or 'P.Nothing' -> Maybe (T.Text) -- ^ /@fragment@/: the fragment, or 'P.Nothing' -> m Uri -- ^ __Returns:__ a new t'GI.GLib.Structs.Uri.Uri' uriBuild :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [UriFlags] -> Text -> Maybe Text -> Maybe Text -> Int32 -> Text -> Maybe Text -> Maybe Text -> m Uri uriBuild [UriFlags] flags Text scheme Maybe Text userinfo Maybe Text host Int32 port Text path Maybe Text query Maybe Text fragment = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do let flags' :: CUInt flags' = forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [UriFlags] flags CString scheme' <- Text -> IO CString textToCString Text scheme CString maybeUserinfo <- case Maybe Text userinfo of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jUserinfo -> do CString jUserinfo' <- Text -> IO CString textToCString Text jUserinfo forall (m :: * -> *) a. Monad m => a -> m a return CString jUserinfo' CString maybeHost <- case Maybe Text host of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jHost -> do CString jHost' <- Text -> IO CString textToCString Text jHost forall (m :: * -> *) a. Monad m => a -> m a return CString jHost' CString path' <- Text -> IO CString textToCString Text path CString maybeQuery <- case Maybe Text query of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jQuery -> do CString jQuery' <- Text -> IO CString textToCString Text jQuery forall (m :: * -> *) a. Monad m => a -> m a return CString jQuery' CString maybeFragment <- case Maybe Text fragment of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jFragment -> do CString jFragment' <- Text -> IO CString textToCString Text jFragment forall (m :: * -> *) a. Monad m => a -> m a return CString jFragment' Ptr Uri result <- CUInt -> CString -> CString -> CString -> Int32 -> CString -> CString -> CString -> IO (Ptr Uri) g_uri_build CUInt flags' CString scheme' CString maybeUserinfo CString maybeHost Int32 port CString path' CString maybeQuery CString maybeFragment forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "uriBuild" Ptr Uri result Uri result' <- (forall a. (HasCallStack, GBoxed a) => (ManagedPtr a -> a) -> Ptr a -> IO a wrapBoxed ManagedPtr Uri -> Uri Uri) Ptr Uri result forall a. Ptr a -> IO () freeMem CString scheme' forall a. Ptr a -> IO () freeMem CString maybeUserinfo forall a. Ptr a -> IO () freeMem CString maybeHost forall a. Ptr a -> IO () freeMem CString path' forall a. Ptr a -> IO () freeMem CString maybeQuery forall a. Ptr a -> IO () freeMem CString maybeFragment forall (m :: * -> *) a. Monad m => a -> m a return Uri result' #if defined(ENABLE_OVERLOADING) #endif -- method Uri::build_with_user -- method type : MemberFunction -- Args: [ Arg -- { argCName = "flags" -- , argType = -- TInterface Name { namespace = "GLib" , name = "UriFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "flags describing how to build the #GUri" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "scheme" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the URI scheme" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "user" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the user component of the userinfo, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "password" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "the password component of the userinfo, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "auth_params" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the auth params of the userinfo, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "host" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the host component, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "port" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the port, or `-1`" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "path" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the path component" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "query" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the query component, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "fragment" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the fragment, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "GLib" , name = "Uri" }) -- throws : False -- Skip return : False foreign import ccall "g_uri_build_with_user" g_uri_build_with_user :: CUInt -> -- flags : TInterface (Name {namespace = "GLib", name = "UriFlags"}) CString -> -- scheme : TBasicType TUTF8 CString -> -- user : TBasicType TUTF8 CString -> -- password : TBasicType TUTF8 CString -> -- auth_params : TBasicType TUTF8 CString -> -- host : TBasicType TUTF8 Int32 -> -- port : TBasicType TInt CString -> -- path : TBasicType TUTF8 CString -> -- query : TBasicType TUTF8 CString -> -- fragment : TBasicType TUTF8 IO (Ptr Uri) -- | Creates a new t'GI.GLib.Structs.Uri.Uri' from the given components according to /@flags@/ -- ('GI.GLib.Flags.UriFlagsHasPassword' is added unconditionally). The /@flags@/ must be -- coherent with the passed values, in particular use @%@-encoded values with -- 'GI.GLib.Flags.UriFlagsEncoded'. -- -- In contrast to 'GI.GLib.Functions.uriBuild', this allows specifying the components -- of the ‘userinfo’ field separately. Note that /@user@/ must be non-'P.Nothing' -- if either /@password@/ or /@authParams@/ is non-'P.Nothing'. -- -- /Since: 2.66/ uriBuildWithUser :: (B.CallStack.HasCallStack, MonadIO m) => [GLib.Flags.UriFlags] -- ^ /@flags@/: flags describing how to build the t'GI.GLib.Structs.Uri.Uri' -> T.Text -- ^ /@scheme@/: the URI scheme -> Maybe (T.Text) -- ^ /@user@/: the user component of the userinfo, or 'P.Nothing' -> Maybe (T.Text) -- ^ /@password@/: the password component of the userinfo, or 'P.Nothing' -> Maybe (T.Text) -- ^ /@authParams@/: the auth params of the userinfo, or 'P.Nothing' -> Maybe (T.Text) -- ^ /@host@/: the host component, or 'P.Nothing' -> Int32 -- ^ /@port@/: the port, or @-1@ -> T.Text -- ^ /@path@/: the path component -> Maybe (T.Text) -- ^ /@query@/: the query component, or 'P.Nothing' -> Maybe (T.Text) -- ^ /@fragment@/: the fragment, or 'P.Nothing' -> m Uri -- ^ __Returns:__ a new t'GI.GLib.Structs.Uri.Uri' uriBuildWithUser :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [UriFlags] -> Text -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Int32 -> Text -> Maybe Text -> Maybe Text -> m Uri uriBuildWithUser [UriFlags] flags Text scheme Maybe Text user Maybe Text password Maybe Text authParams Maybe Text host Int32 port Text path Maybe Text query Maybe Text fragment = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do let flags' :: CUInt flags' = forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [UriFlags] flags CString scheme' <- Text -> IO CString textToCString Text scheme CString maybeUser <- case Maybe Text user of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jUser -> do CString jUser' <- Text -> IO CString textToCString Text jUser forall (m :: * -> *) a. Monad m => a -> m a return CString jUser' CString maybePassword <- case Maybe Text password of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jPassword -> do CString jPassword' <- Text -> IO CString textToCString Text jPassword forall (m :: * -> *) a. Monad m => a -> m a return CString jPassword' CString maybeAuthParams <- case Maybe Text authParams of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jAuthParams -> do CString jAuthParams' <- Text -> IO CString textToCString Text jAuthParams forall (m :: * -> *) a. Monad m => a -> m a return CString jAuthParams' CString maybeHost <- case Maybe Text host of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jHost -> do CString jHost' <- Text -> IO CString textToCString Text jHost forall (m :: * -> *) a. Monad m => a -> m a return CString jHost' CString path' <- Text -> IO CString textToCString Text path CString maybeQuery <- case Maybe Text query of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jQuery -> do CString jQuery' <- Text -> IO CString textToCString Text jQuery forall (m :: * -> *) a. Monad m => a -> m a return CString jQuery' CString maybeFragment <- case Maybe Text fragment of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jFragment -> do CString jFragment' <- Text -> IO CString textToCString Text jFragment forall (m :: * -> *) a. Monad m => a -> m a return CString jFragment' Ptr Uri result <- CUInt -> CString -> CString -> CString -> CString -> CString -> Int32 -> CString -> CString -> CString -> IO (Ptr Uri) g_uri_build_with_user CUInt flags' CString scheme' CString maybeUser CString maybePassword CString maybeAuthParams CString maybeHost Int32 port CString path' CString maybeQuery CString maybeFragment forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "uriBuildWithUser" Ptr Uri result Uri result' <- (forall a. (HasCallStack, GBoxed a) => (ManagedPtr a -> a) -> Ptr a -> IO a wrapBoxed ManagedPtr Uri -> Uri Uri) Ptr Uri result forall a. Ptr a -> IO () freeMem CString scheme' forall a. Ptr a -> IO () freeMem CString maybeUser forall a. Ptr a -> IO () freeMem CString maybePassword forall a. Ptr a -> IO () freeMem CString maybeAuthParams forall a. Ptr a -> IO () freeMem CString maybeHost forall a. Ptr a -> IO () freeMem CString path' forall a. Ptr a -> IO () freeMem CString maybeQuery forall a. Ptr a -> IO () freeMem CString maybeFragment forall (m :: * -> *) a. Monad m => a -> m a return Uri result' #if defined(ENABLE_OVERLOADING) #endif -- method Uri::error_quark -- method type : MemberFunction -- Args: [] -- Lengths: [] -- returnType: Just (TBasicType TUInt32) -- throws : False -- Skip return : False foreign import ccall "g_uri_error_quark" g_uri_error_quark :: IO Word32 -- | /No description available in the introspection data./ uriErrorQuark :: (B.CallStack.HasCallStack, MonadIO m) => m Word32 uriErrorQuark :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Word32 uriErrorQuark = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do Word32 result <- IO Word32 g_uri_error_quark forall (m :: * -> *) a. Monad m => a -> m a return Word32 result #if defined(ENABLE_OVERLOADING) #endif -- method Uri::escape_bytes -- method type : MemberFunction -- Args: [ Arg -- { argCName = "unescaped" -- , argType = TCArray False (-1) 1 (TBasicType TUInt8) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the unescaped input data." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "length" -- , argType = TBasicType TUInt64 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the length of @unescaped" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "reserved_chars_allowed" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "a string of reserved\n characters that are allowed to be used, or %NULL." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [ Arg -- { argCName = "length" -- , argType = TBasicType TUInt64 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the length of @unescaped" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_escape_bytes" g_uri_escape_bytes :: Ptr Word8 -> -- unescaped : TCArray False (-1) 1 (TBasicType TUInt8) Word64 -> -- length : TBasicType TUInt64 CString -> -- reserved_chars_allowed : TBasicType TUTF8 IO CString -- | Escapes arbitrary data for use in a URI. -- -- Normally all characters that are not ‘unreserved’ (i.e. ASCII -- alphanumerical characters plus dash, dot, underscore and tilde) are -- escaped. But if you specify characters in /@reservedCharsAllowed@/ -- they are not escaped. This is useful for the ‘reserved’ characters -- in the URI specification, since those are allowed unescaped in some -- portions of a URI. -- -- Though technically incorrect, this will also allow escaping nul -- bytes as @%@@00@. -- -- /Since: 2.66/ uriEscapeBytes :: (B.CallStack.HasCallStack, MonadIO m) => ByteString -- ^ /@unescaped@/: the unescaped input data. -> Maybe (T.Text) -- ^ /@reservedCharsAllowed@/: a string of reserved -- characters that are allowed to be used, or 'P.Nothing'. -> m T.Text -- ^ __Returns:__ an escaped version of /@unescaped@/. -- The returned string should be freed when no longer needed. uriEscapeBytes :: forall (m :: * -> *). (HasCallStack, MonadIO m) => ByteString -> Maybe Text -> m Text uriEscapeBytes ByteString unescaped Maybe Text reservedCharsAllowed = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do let length_ :: Word64 length_ = forall a b. (Integral a, Num b) => a -> b fromIntegral forall a b. (a -> b) -> a -> b $ ByteString -> Int B.length ByteString unescaped Ptr Word8 unescaped' <- ByteString -> IO (Ptr Word8) packByteString ByteString unescaped CString maybeReservedCharsAllowed <- case Maybe Text reservedCharsAllowed of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jReservedCharsAllowed -> do CString jReservedCharsAllowed' <- Text -> IO CString textToCString Text jReservedCharsAllowed forall (m :: * -> *) a. Monad m => a -> m a return CString jReservedCharsAllowed' CString result <- Ptr Word8 -> Word64 -> CString -> IO CString g_uri_escape_bytes Ptr Word8 unescaped' Word64 length_ CString maybeReservedCharsAllowed forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "uriEscapeBytes" CString result Text result' <- HasCallStack => CString -> IO Text cstringToText CString result forall a. Ptr a -> IO () freeMem CString result forall a. Ptr a -> IO () freeMem Ptr Word8 unescaped' forall a. Ptr a -> IO () freeMem CString maybeReservedCharsAllowed forall (m :: * -> *) a. Monad m => a -> m a return Text result' #if defined(ENABLE_OVERLOADING) #endif -- method Uri::escape_string -- method type : MemberFunction -- Args: [ Arg -- { argCName = "unescaped" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the unescaped input string." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "reserved_chars_allowed" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "a string of reserved\n characters that are allowed to be used, or %NULL." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "allow_utf8" -- , argType = TBasicType TBoolean -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "%TRUE if the result can include UTF-8 characters." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_escape_string" g_uri_escape_string :: CString -> -- unescaped : TBasicType TUTF8 CString -> -- reserved_chars_allowed : TBasicType TUTF8 CInt -> -- allow_utf8 : TBasicType TBoolean IO CString -- | Escapes a string for use in a URI. -- -- Normally all characters that are not \"unreserved\" (i.e. ASCII -- alphanumerical characters plus dash, dot, underscore and tilde) are -- escaped. But if you specify characters in /@reservedCharsAllowed@/ -- they are not escaped. This is useful for the \"reserved\" characters -- in the URI specification, since those are allowed unescaped in some -- portions of a URI. -- -- /Since: 2.16/ uriEscapeString :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@unescaped@/: the unescaped input string. -> Maybe (T.Text) -- ^ /@reservedCharsAllowed@/: a string of reserved -- characters that are allowed to be used, or 'P.Nothing'. -> Bool -- ^ /@allowUtf8@/: 'P.True' if the result can include UTF-8 characters. -> m T.Text -- ^ __Returns:__ an escaped version of /@unescaped@/. The -- returned string should be freed when no longer needed. uriEscapeString :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Maybe Text -> Bool -> m Text uriEscapeString Text unescaped Maybe Text reservedCharsAllowed Bool allowUtf8 = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do CString unescaped' <- Text -> IO CString textToCString Text unescaped CString maybeReservedCharsAllowed <- case Maybe Text reservedCharsAllowed of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jReservedCharsAllowed -> do CString jReservedCharsAllowed' <- Text -> IO CString textToCString Text jReservedCharsAllowed forall (m :: * -> *) a. Monad m => a -> m a return CString jReservedCharsAllowed' let allowUtf8' :: CInt allowUtf8' = (forall a b. (Integral a, Num b) => a -> b P.fromIntegral forall b c a. (b -> c) -> (a -> b) -> a -> c . forall a. Enum a => a -> Int P.fromEnum) Bool allowUtf8 CString result <- CString -> CString -> CInt -> IO CString g_uri_escape_string CString unescaped' CString maybeReservedCharsAllowed CInt allowUtf8' forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "uriEscapeString" CString result Text result' <- HasCallStack => CString -> IO Text cstringToText CString result forall a. Ptr a -> IO () freeMem CString result forall a. Ptr a -> IO () freeMem CString unescaped' forall a. Ptr a -> IO () freeMem CString maybeReservedCharsAllowed forall (m :: * -> *) a. Monad m => a -> m a return Text result' #if defined(ENABLE_OVERLOADING) #endif -- method Uri::is_valid -- method type : MemberFunction -- Args: [ Arg -- { argCName = "uri_string" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a string containing an absolute URI" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "flags" -- , argType = -- TInterface Name { namespace = "GLib" , name = "UriFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "flags for parsing @uri_string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "g_uri_is_valid" g_uri_is_valid :: CString -> -- uri_string : TBasicType TUTF8 CUInt -> -- flags : TInterface (Name {namespace = "GLib", name = "UriFlags"}) Ptr (Ptr GError) -> -- error IO CInt -- | Parses /@uriString@/ according to /@flags@/, to determine whether it is a valid -- [absolute URI][relative-absolute-uris], i.e. it does not need to be resolved -- relative to another URI using 'GI.GLib.Structs.Uri.uriParseRelative'. -- -- If it’s not a valid URI, an error is returned explaining how it’s invalid. -- -- See 'GI.GLib.Functions.uriSplit', and the definition of t'GI.GLib.Flags.UriFlags', for more -- information on the effect of /@flags@/. -- -- /Since: 2.66/ uriIsValid :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@uriString@/: a string containing an absolute URI -> [GLib.Flags.UriFlags] -- ^ /@flags@/: flags for parsing /@uriString@/ -> m () -- ^ /(Can throw 'Data.GI.Base.GError.GError')/ uriIsValid :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> [UriFlags] -> m () uriIsValid Text uriString [UriFlags] flags = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do CString uriString' <- Text -> IO CString textToCString Text uriString let flags' :: CUInt flags' = forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [UriFlags] flags forall a b. IO a -> IO b -> IO a onException (do CInt _ <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError forall a b. (a -> b) -> a -> b $ CString -> CUInt -> Ptr (Ptr GError) -> IO CInt g_uri_is_valid CString uriString' CUInt flags' forall a. Ptr a -> IO () freeMem CString uriString' forall (m :: * -> *) a. Monad m => a -> m a return () ) (do forall a. Ptr a -> IO () freeMem CString uriString' ) #if defined(ENABLE_OVERLOADING) #endif -- method Uri::join -- method type : MemberFunction -- Args: [ Arg -- { argCName = "flags" -- , argType = -- TInterface Name { namespace = "GLib" , name = "UriFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "flags describing how to build the URI string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "scheme" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the URI scheme, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "userinfo" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the userinfo component, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "host" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the host component, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "port" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the port, or `-1`" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "path" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the path component" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "query" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the query component, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "fragment" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the fragment, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_join" g_uri_join :: CUInt -> -- flags : TInterface (Name {namespace = "GLib", name = "UriFlags"}) CString -> -- scheme : TBasicType TUTF8 CString -> -- userinfo : TBasicType TUTF8 CString -> -- host : TBasicType TUTF8 Int32 -> -- port : TBasicType TInt CString -> -- path : TBasicType TUTF8 CString -> -- query : TBasicType TUTF8 CString -> -- fragment : TBasicType TUTF8 IO CString -- | Joins the given components together according to /@flags@/ to create -- an absolute URI string. /@path@/ may not be 'P.Nothing' (though it may be the empty -- string). -- -- When /@host@/ is present, /@path@/ must either be empty or begin with a slash (@\/@) -- character. When /@host@/ is not present, /@path@/ cannot begin with two slash -- characters (@\/\/@). See -- <https://tools.ietf.org/html/rfc3986#section-3 RFC 3986, section 3>. -- -- See also 'GI.GLib.Functions.uriJoinWithUser', which allows specifying the -- components of the ‘userinfo’ separately. -- -- 'GI.GLib.Flags.UriFlagsHasPassword' and 'GI.GLib.Flags.UriFlagsHasAuthParams' are ignored if set -- in /@flags@/. -- -- /Since: 2.66/ uriJoin :: (B.CallStack.HasCallStack, MonadIO m) => [GLib.Flags.UriFlags] -- ^ /@flags@/: flags describing how to build the URI string -> Maybe (T.Text) -- ^ /@scheme@/: the URI scheme, or 'P.Nothing' -> Maybe (T.Text) -- ^ /@userinfo@/: the userinfo component, or 'P.Nothing' -> Maybe (T.Text) -- ^ /@host@/: the host component, or 'P.Nothing' -> Int32 -- ^ /@port@/: the port, or @-1@ -> T.Text -- ^ /@path@/: the path component -> Maybe (T.Text) -- ^ /@query@/: the query component, or 'P.Nothing' -> Maybe (T.Text) -- ^ /@fragment@/: the fragment, or 'P.Nothing' -> m T.Text -- ^ __Returns:__ an absolute URI string uriJoin :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [UriFlags] -> Maybe Text -> Maybe Text -> Maybe Text -> Int32 -> Text -> Maybe Text -> Maybe Text -> m Text uriJoin [UriFlags] flags Maybe Text scheme Maybe Text userinfo Maybe Text host Int32 port Text path Maybe Text query Maybe Text fragment = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do let flags' :: CUInt flags' = forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [UriFlags] flags CString maybeScheme <- case Maybe Text scheme of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jScheme -> do CString jScheme' <- Text -> IO CString textToCString Text jScheme forall (m :: * -> *) a. Monad m => a -> m a return CString jScheme' CString maybeUserinfo <- case Maybe Text userinfo of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jUserinfo -> do CString jUserinfo' <- Text -> IO CString textToCString Text jUserinfo forall (m :: * -> *) a. Monad m => a -> m a return CString jUserinfo' CString maybeHost <- case Maybe Text host of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jHost -> do CString jHost' <- Text -> IO CString textToCString Text jHost forall (m :: * -> *) a. Monad m => a -> m a return CString jHost' CString path' <- Text -> IO CString textToCString Text path CString maybeQuery <- case Maybe Text query of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jQuery -> do CString jQuery' <- Text -> IO CString textToCString Text jQuery forall (m :: * -> *) a. Monad m => a -> m a return CString jQuery' CString maybeFragment <- case Maybe Text fragment of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jFragment -> do CString jFragment' <- Text -> IO CString textToCString Text jFragment forall (m :: * -> *) a. Monad m => a -> m a return CString jFragment' CString result <- CUInt -> CString -> CString -> CString -> Int32 -> CString -> CString -> CString -> IO CString g_uri_join CUInt flags' CString maybeScheme CString maybeUserinfo CString maybeHost Int32 port CString path' CString maybeQuery CString maybeFragment forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "uriJoin" CString result Text result' <- HasCallStack => CString -> IO Text cstringToText CString result forall a. Ptr a -> IO () freeMem CString result forall a. Ptr a -> IO () freeMem CString maybeScheme forall a. Ptr a -> IO () freeMem CString maybeUserinfo forall a. Ptr a -> IO () freeMem CString maybeHost forall a. Ptr a -> IO () freeMem CString path' forall a. Ptr a -> IO () freeMem CString maybeQuery forall a. Ptr a -> IO () freeMem CString maybeFragment forall (m :: * -> *) a. Monad m => a -> m a return Text result' #if defined(ENABLE_OVERLOADING) #endif -- method Uri::join_with_user -- method type : MemberFunction -- Args: [ Arg -- { argCName = "flags" -- , argType = -- TInterface Name { namespace = "GLib" , name = "UriFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "flags describing how to build the URI string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "scheme" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the URI scheme, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "user" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the user component of the userinfo, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "password" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "the password component of the userinfo, or\n %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "auth_params" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the auth params of the userinfo, or\n %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "host" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the host component, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "port" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the port, or `-1`" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "path" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the path component" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "query" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the query component, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "fragment" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the fragment, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_join_with_user" g_uri_join_with_user :: CUInt -> -- flags : TInterface (Name {namespace = "GLib", name = "UriFlags"}) CString -> -- scheme : TBasicType TUTF8 CString -> -- user : TBasicType TUTF8 CString -> -- password : TBasicType TUTF8 CString -> -- auth_params : TBasicType TUTF8 CString -> -- host : TBasicType TUTF8 Int32 -> -- port : TBasicType TInt CString -> -- path : TBasicType TUTF8 CString -> -- query : TBasicType TUTF8 CString -> -- fragment : TBasicType TUTF8 IO CString -- | Joins the given components together according to /@flags@/ to create -- an absolute URI string. /@path@/ may not be 'P.Nothing' (though it may be the empty -- string). -- -- In contrast to 'GI.GLib.Functions.uriJoin', this allows specifying the components -- of the ‘userinfo’ separately. It otherwise behaves the same. -- -- 'GI.GLib.Flags.UriFlagsHasPassword' and 'GI.GLib.Flags.UriFlagsHasAuthParams' are ignored if set -- in /@flags@/. -- -- /Since: 2.66/ uriJoinWithUser :: (B.CallStack.HasCallStack, MonadIO m) => [GLib.Flags.UriFlags] -- ^ /@flags@/: flags describing how to build the URI string -> Maybe (T.Text) -- ^ /@scheme@/: the URI scheme, or 'P.Nothing' -> Maybe (T.Text) -- ^ /@user@/: the user component of the userinfo, or 'P.Nothing' -> Maybe (T.Text) -- ^ /@password@/: the password component of the userinfo, or -- 'P.Nothing' -> Maybe (T.Text) -- ^ /@authParams@/: the auth params of the userinfo, or -- 'P.Nothing' -> Maybe (T.Text) -- ^ /@host@/: the host component, or 'P.Nothing' -> Int32 -- ^ /@port@/: the port, or @-1@ -> T.Text -- ^ /@path@/: the path component -> Maybe (T.Text) -- ^ /@query@/: the query component, or 'P.Nothing' -> Maybe (T.Text) -- ^ /@fragment@/: the fragment, or 'P.Nothing' -> m T.Text -- ^ __Returns:__ an absolute URI string uriJoinWithUser :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [UriFlags] -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Int32 -> Text -> Maybe Text -> Maybe Text -> m Text uriJoinWithUser [UriFlags] flags Maybe Text scheme Maybe Text user Maybe Text password Maybe Text authParams Maybe Text host Int32 port Text path Maybe Text query Maybe Text fragment = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do let flags' :: CUInt flags' = forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [UriFlags] flags CString maybeScheme <- case Maybe Text scheme of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jScheme -> do CString jScheme' <- Text -> IO CString textToCString Text jScheme forall (m :: * -> *) a. Monad m => a -> m a return CString jScheme' CString maybeUser <- case Maybe Text user of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jUser -> do CString jUser' <- Text -> IO CString textToCString Text jUser forall (m :: * -> *) a. Monad m => a -> m a return CString jUser' CString maybePassword <- case Maybe Text password of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jPassword -> do CString jPassword' <- Text -> IO CString textToCString Text jPassword forall (m :: * -> *) a. Monad m => a -> m a return CString jPassword' CString maybeAuthParams <- case Maybe Text authParams of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jAuthParams -> do CString jAuthParams' <- Text -> IO CString textToCString Text jAuthParams forall (m :: * -> *) a. Monad m => a -> m a return CString jAuthParams' CString maybeHost <- case Maybe Text host of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jHost -> do CString jHost' <- Text -> IO CString textToCString Text jHost forall (m :: * -> *) a. Monad m => a -> m a return CString jHost' CString path' <- Text -> IO CString textToCString Text path CString maybeQuery <- case Maybe Text query of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jQuery -> do CString jQuery' <- Text -> IO CString textToCString Text jQuery forall (m :: * -> *) a. Monad m => a -> m a return CString jQuery' CString maybeFragment <- case Maybe Text fragment of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jFragment -> do CString jFragment' <- Text -> IO CString textToCString Text jFragment forall (m :: * -> *) a. Monad m => a -> m a return CString jFragment' CString result <- CUInt -> CString -> CString -> CString -> CString -> CString -> Int32 -> CString -> CString -> CString -> IO CString g_uri_join_with_user CUInt flags' CString maybeScheme CString maybeUser CString maybePassword CString maybeAuthParams CString maybeHost Int32 port CString path' CString maybeQuery CString maybeFragment forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "uriJoinWithUser" CString result Text result' <- HasCallStack => CString -> IO Text cstringToText CString result forall a. Ptr a -> IO () freeMem CString result forall a. Ptr a -> IO () freeMem CString maybeScheme forall a. Ptr a -> IO () freeMem CString maybeUser forall a. Ptr a -> IO () freeMem CString maybePassword forall a. Ptr a -> IO () freeMem CString maybeAuthParams forall a. Ptr a -> IO () freeMem CString maybeHost forall a. Ptr a -> IO () freeMem CString path' forall a. Ptr a -> IO () freeMem CString maybeQuery forall a. Ptr a -> IO () freeMem CString maybeFragment forall (m :: * -> *) a. Monad m => a -> m a return Text result' #if defined(ENABLE_OVERLOADING) #endif -- method Uri::list_extract_uris -- method type : MemberFunction -- Args: [ Arg -- { argCName = "uri_list" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "an URI list" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8)) -- throws : False -- Skip return : False foreign import ccall "g_uri_list_extract_uris" g_uri_list_extract_uris :: CString -> -- uri_list : TBasicType TUTF8 IO (Ptr CString) -- | Splits an URI list conforming to the text\/uri-list -- mime type defined in RFC 2483 into individual URIs, -- discarding any comments. The URIs are not validated. -- -- /Since: 2.6/ uriListExtractUris :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@uriList@/: an URI list -> m [T.Text] -- ^ __Returns:__ a newly allocated 'P.Nothing'-terminated list -- of strings holding the individual URIs. The array should be freed -- with 'GI.GLib.Functions.strfreev'. uriListExtractUris :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m [Text] uriListExtractUris Text uriList = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do CString uriList' <- Text -> IO CString textToCString Text uriList Ptr CString result <- CString -> IO (Ptr CString) g_uri_list_extract_uris CString uriList' forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "uriListExtractUris" Ptr CString result [Text] result' <- HasCallStack => Ptr CString -> IO [Text] unpackZeroTerminatedUTF8CArray Ptr CString result forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO () mapZeroTerminatedCArray forall a. Ptr a -> IO () freeMem Ptr CString result forall a. Ptr a -> IO () freeMem Ptr CString result forall a. Ptr a -> IO () freeMem CString uriList' forall (m :: * -> *) a. Monad m => a -> m a return [Text] result' #if defined(ENABLE_OVERLOADING) #endif -- method Uri::parse -- method type : MemberFunction -- Args: [ Arg -- { argCName = "uri_string" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a string representing an absolute URI" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "flags" -- , argType = -- TInterface Name { namespace = "GLib" , name = "UriFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "flags describing how to parse @uri_string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "GLib" , name = "Uri" }) -- throws : True -- Skip return : False foreign import ccall "g_uri_parse" g_uri_parse :: CString -> -- uri_string : TBasicType TUTF8 CUInt -> -- flags : TInterface (Name {namespace = "GLib", name = "UriFlags"}) Ptr (Ptr GError) -> -- error IO (Ptr Uri) -- | Parses /@uriString@/ according to /@flags@/. If the result is not a -- valid [absolute URI][relative-absolute-uris], it will be discarded, and an -- error returned. -- -- /Since: 2.66/ uriParse :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@uriString@/: a string representing an absolute URI -> [GLib.Flags.UriFlags] -- ^ /@flags@/: flags describing how to parse /@uriString@/ -> m Uri -- ^ __Returns:__ a new t'GI.GLib.Structs.Uri.Uri', or NULL on error. /(Can throw 'Data.GI.Base.GError.GError')/ uriParse :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> [UriFlags] -> m Uri uriParse Text uriString [UriFlags] flags = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do CString uriString' <- Text -> IO CString textToCString Text uriString let flags' :: CUInt flags' = forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [UriFlags] flags forall a b. IO a -> IO b -> IO a onException (do Ptr Uri result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError forall a b. (a -> b) -> a -> b $ CString -> CUInt -> Ptr (Ptr GError) -> IO (Ptr Uri) g_uri_parse CString uriString' CUInt flags' forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "uriParse" Ptr Uri result Uri result' <- (forall a. (HasCallStack, GBoxed a) => (ManagedPtr a -> a) -> Ptr a -> IO a wrapBoxed ManagedPtr Uri -> Uri Uri) Ptr Uri result forall a. Ptr a -> IO () freeMem CString uriString' forall (m :: * -> *) a. Monad m => a -> m a return Uri result' ) (do forall a. Ptr a -> IO () freeMem CString uriString' ) #if defined(ENABLE_OVERLOADING) #endif -- method Uri::parse_params -- method type : MemberFunction -- Args: [ Arg -- { argCName = "params" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "a `%`-encoded string containing `attribute=value`\n parameters" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "length" -- , argType = TBasicType TInt64 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "the length of @params, or `-1` if it is nul-terminated" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "separators" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "the separator byte character set between parameters. (usually\n `&`, but sometimes `;` or both `&;`). Note that this function works on\n bytes not characters, so it can't be used to delimit UTF-8 strings for\n anything but ASCII characters. You may pass an empty set, in which case\n no splitting will occur." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "flags" -- , argType = -- TInterface Name { namespace = "GLib" , name = "UriParamsFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "flags to modify the way the parameters are handled." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TGHash (TBasicType TUTF8) (TBasicType TUTF8)) -- throws : True -- Skip return : False foreign import ccall "g_uri_parse_params" g_uri_parse_params :: CString -> -- params : TBasicType TUTF8 Int64 -> -- length : TBasicType TInt64 CString -> -- separators : TBasicType TUTF8 CUInt -> -- flags : TInterface (Name {namespace = "GLib", name = "UriParamsFlags"}) Ptr (Ptr GError) -> -- error IO (Ptr (GHashTable CString CString)) -- | Many URI schemes include one or more attribute\/value pairs as part of the URI -- value. This method can be used to parse them into a hash table. When an -- attribute has multiple occurrences, the last value is the final returned -- value. If you need to handle repeated attributes differently, use -- t'GI.GLib.Structs.UriParamsIter.UriParamsIter'. -- -- The /@params@/ string is assumed to still be @%@-encoded, but the returned -- values will be fully decoded. (Thus it is possible that the returned values -- may contain @=@ or /@separators@/, if the value was encoded in the input.) -- Invalid @%@-encoding is treated as with the 'GI.GLib.Flags.UriFlagsParseRelaxed' -- rules for 'GI.GLib.Functions.uriParse'. (However, if /@params@/ is the path or query string -- from a t'GI.GLib.Structs.Uri.Uri' that was parsed without 'GI.GLib.Flags.UriFlagsParseRelaxed' and -- 'GI.GLib.Flags.UriFlagsEncoded', then you already know that it does not contain any -- invalid encoding.) -- -- 'GI.GLib.Flags.UriParamsFlagsWwwForm' is handled as documented for 'GI.GLib.Structs.UriParamsIter.uriParamsIterInit'. -- -- If 'GI.GLib.Flags.UriParamsFlagsCaseInsensitive' is passed to /@flags@/, attributes will be -- compared case-insensitively, so a params string @attr=123&Attr=456@ will only -- return a single attribute–value pair, @Attr=456@. Case will be preserved in -- the returned attributes. -- -- If /@params@/ cannot be parsed (for example, it contains two /@separators@/ -- characters in a row), then /@error@/ is set and 'P.Nothing' is returned. -- -- /Since: 2.66/ uriParseParams :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@params@/: a @%@-encoded string containing @attribute=value@ -- parameters -> Int64 -- ^ /@length@/: the length of /@params@/, or @-1@ if it is nul-terminated -> T.Text -- ^ /@separators@/: the separator byte character set between parameters. (usually -- @&@, but sometimes @;@ or both @&;@). Note that this function works on -- bytes not characters, so it can\'t be used to delimit UTF-8 strings for -- anything but ASCII characters. You may pass an empty set, in which case -- no splitting will occur. -> [GLib.Flags.UriParamsFlags] -- ^ /@flags@/: flags to modify the way the parameters are handled. -> m (Map.Map T.Text T.Text) -- ^ __Returns:__ -- A hash table of attribute\/value pairs, with both names and values -- fully-decoded; or 'P.Nothing' on error. /(Can throw 'Data.GI.Base.GError.GError')/ uriParseParams :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Int64 -> Text -> [UriParamsFlags] -> m (Map Text Text) uriParseParams Text params Int64 length_ Text separators [UriParamsFlags] flags = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do CString params' <- Text -> IO CString textToCString Text params CString separators' <- Text -> IO CString textToCString Text separators let flags' :: CUInt flags' = forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [UriParamsFlags] flags forall a b. IO a -> IO b -> IO a onException (do Ptr (GHashTable CString CString) result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError forall a b. (a -> b) -> a -> b $ CString -> Int64 -> CString -> CUInt -> Ptr (Ptr GError) -> IO (Ptr (GHashTable CString CString)) g_uri_parse_params CString params' Int64 length_ CString separators' CUInt flags' forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "uriParseParams" Ptr (GHashTable CString CString) result [(PtrWrapped CString, PtrWrapped CString)] result' <- forall a b. Ptr (GHashTable a b) -> IO [(PtrWrapped a, PtrWrapped b)] unpackGHashTable Ptr (GHashTable CString CString) result let result'' :: [(CString, PtrWrapped CString)] result'' = forall a c b. (a -> c) -> [(a, b)] -> [(c, b)] mapFirst PtrWrapped CString -> CString B.GHT.cstringUnpackPtr [(PtrWrapped CString, PtrWrapped CString)] result' [(Text, PtrWrapped CString)] result''' <- forall (f :: * -> *) a c b. Applicative f => (a -> f c) -> [(a, b)] -> f [(c, b)] mapFirstA HasCallStack => CString -> IO Text cstringToText [(CString, PtrWrapped CString)] result'' let result'''' :: [(Text, CString)] result'''' = forall b c a. (b -> c) -> [(a, b)] -> [(a, c)] mapSecond PtrWrapped CString -> CString B.GHT.cstringUnpackPtr [(Text, PtrWrapped CString)] result''' [(Text, Text)] result''''' <- forall (f :: * -> *) b c a. Applicative f => (b -> f c) -> [(a, b)] -> f [(a, c)] mapSecondA HasCallStack => CString -> IO Text cstringToText [(Text, CString)] result'''' let result'''''' :: Map Text Text result'''''' = forall k a. Ord k => [(k, a)] -> Map k a Map.fromList [(Text, Text)] result''''' forall a b. Ptr (GHashTable a b) -> IO () unrefGHashTable Ptr (GHashTable CString CString) result forall a. Ptr a -> IO () freeMem CString params' forall a. Ptr a -> IO () freeMem CString separators' forall (m :: * -> *) a. Monad m => a -> m a return Map Text Text result'''''' ) (do forall a. Ptr a -> IO () freeMem CString params' forall a. Ptr a -> IO () freeMem CString separators' ) #if defined(ENABLE_OVERLOADING) #endif -- method Uri::parse_scheme -- method type : MemberFunction -- Args: [ Arg -- { argCName = "uri" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a valid URI." , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_parse_scheme" g_uri_parse_scheme :: CString -> -- uri : TBasicType TUTF8 IO CString -- | Gets the scheme portion of a URI string. -- <https://tools.ietf.org/html/rfc3986#section-3 RFC 3986> decodes the scheme -- as: -- > -- >URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] -- -- Common schemes include @file@, @https@, @svn+ssh@, etc. -- -- /Since: 2.16/ uriParseScheme :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@uri@/: a valid URI. -> m (Maybe T.Text) -- ^ __Returns:__ The ‘scheme’ component of the URI, or -- 'P.Nothing' on error. The returned string should be freed when no longer needed. uriParseScheme :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m (Maybe Text) uriParseScheme Text uri = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do CString uri' <- Text -> IO CString textToCString Text uri CString result <- CString -> IO CString g_uri_parse_scheme CString uri' Maybe Text maybeResult <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString result forall a b. (a -> b) -> a -> b $ \CString result' -> do Text result'' <- HasCallStack => CString -> IO Text cstringToText CString result' forall a. Ptr a -> IO () freeMem CString result' forall (m :: * -> *) a. Monad m => a -> m a return Text result'' forall a. Ptr a -> IO () freeMem CString uri' forall (m :: * -> *) a. Monad m => a -> m a return Maybe Text maybeResult #if defined(ENABLE_OVERLOADING) #endif -- method Uri::peek_scheme -- method type : MemberFunction -- Args: [ Arg -- { argCName = "uri" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a valid URI." , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_peek_scheme" g_uri_peek_scheme :: CString -> -- uri : TBasicType TUTF8 IO CString -- | Gets the scheme portion of a URI string. -- <https://tools.ietf.org/html/rfc3986#section-3 RFC 3986> decodes the scheme -- as: -- > -- >URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] -- -- Common schemes include @file@, @https@, @svn+ssh@, etc. -- -- Unlike 'GI.GLib.Functions.uriParseScheme', the returned scheme is normalized to -- all-lowercase and does not need to be freed. -- -- /Since: 2.66/ uriPeekScheme :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@uri@/: a valid URI. -> m (Maybe T.Text) -- ^ __Returns:__ The ‘scheme’ component of the URI, or -- 'P.Nothing' on error. The returned string is normalized to all-lowercase, and -- interned via 'GI.GLib.Functions.internString', so it does not need to be freed. uriPeekScheme :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m (Maybe Text) uriPeekScheme Text uri = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do CString uri' <- Text -> IO CString textToCString Text uri CString result <- CString -> IO CString g_uri_peek_scheme CString uri' Maybe Text maybeResult <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString result forall a b. (a -> b) -> a -> b $ \CString result' -> do Text result'' <- HasCallStack => CString -> IO Text cstringToText CString result' forall (m :: * -> *) a. Monad m => a -> m a return Text result'' forall a. Ptr a -> IO () freeMem CString uri' forall (m :: * -> *) a. Monad m => a -> m a return Maybe Text maybeResult #if defined(ENABLE_OVERLOADING) #endif -- method Uri::resolve_relative -- method type : MemberFunction -- Args: [ Arg -- { argCName = "base_uri_string" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "a string representing a base URI" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "uri_ref" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "a string representing a relative or absolute URI" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "flags" -- , argType = -- TInterface Name { namespace = "GLib" , name = "UriFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "flags describing how to parse @uri_ref" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : True -- Skip return : False foreign import ccall "g_uri_resolve_relative" g_uri_resolve_relative :: CString -> -- base_uri_string : TBasicType TUTF8 CString -> -- uri_ref : TBasicType TUTF8 CUInt -> -- flags : TInterface (Name {namespace = "GLib", name = "UriFlags"}) Ptr (Ptr GError) -> -- error IO CString -- | Parses /@uriRef@/ according to /@flags@/ and, if it is a -- [relative URI][relative-absolute-uris], resolves it relative to -- /@baseUriString@/. If the result is not a valid absolute URI, it will be -- discarded, and an error returned. -- -- (If /@baseUriString@/ is 'P.Nothing', this just returns /@uriRef@/, or -- 'P.Nothing' if /@uriRef@/ is invalid or not absolute.) -- -- /Since: 2.66/ uriResolveRelative :: (B.CallStack.HasCallStack, MonadIO m) => Maybe (T.Text) -- ^ /@baseUriString@/: a string representing a base URI -> T.Text -- ^ /@uriRef@/: a string representing a relative or absolute URI -> [GLib.Flags.UriFlags] -- ^ /@flags@/: flags describing how to parse /@uriRef@/ -> m T.Text -- ^ __Returns:__ the resolved URI string, -- or NULL on error. /(Can throw 'Data.GI.Base.GError.GError')/ uriResolveRelative :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Maybe Text -> Text -> [UriFlags] -> m Text uriResolveRelative Maybe Text baseUriString Text uriRef [UriFlags] flags = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do CString maybeBaseUriString <- case Maybe Text baseUriString of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jBaseUriString -> do CString jBaseUriString' <- Text -> IO CString textToCString Text jBaseUriString forall (m :: * -> *) a. Monad m => a -> m a return CString jBaseUriString' CString uriRef' <- Text -> IO CString textToCString Text uriRef let flags' :: CUInt flags' = forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [UriFlags] flags forall a b. IO a -> IO b -> IO a onException (do CString result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError forall a b. (a -> b) -> a -> b $ CString -> CString -> CUInt -> Ptr (Ptr GError) -> IO CString g_uri_resolve_relative CString maybeBaseUriString CString uriRef' CUInt flags' forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "uriResolveRelative" CString result Text result' <- HasCallStack => CString -> IO Text cstringToText CString result forall a. Ptr a -> IO () freeMem CString result forall a. Ptr a -> IO () freeMem CString maybeBaseUriString forall a. Ptr a -> IO () freeMem CString uriRef' forall (m :: * -> *) a. Monad m => a -> m a return Text result' ) (do forall a. Ptr a -> IO () freeMem CString maybeBaseUriString forall a. Ptr a -> IO () freeMem CString uriRef' ) #if defined(ENABLE_OVERLOADING) #endif -- method Uri::split -- method type : MemberFunction -- Args: [ Arg -- { argCName = "uri_ref" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "a string containing a relative or absolute URI" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "flags" -- , argType = -- TInterface Name { namespace = "GLib" , name = "UriFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "flags for parsing @uri_ref" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "scheme" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "on return, contains\n the scheme (converted to lowercase), or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "userinfo" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "on return, contains\n the userinfo, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "host" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "on return, contains the\n host, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "port" -- , argType = TBasicType TInt -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "on return, contains the\n port, or `-1`" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "path" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "on return, contains the\n path" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "query" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "on return, contains the\n query, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "fragment" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "on return, contains\n the fragment, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : True -- Skip return : True foreign import ccall "g_uri_split" g_uri_split :: CString -> -- uri_ref : TBasicType TUTF8 CUInt -> -- flags : TInterface (Name {namespace = "GLib", name = "UriFlags"}) Ptr CString -> -- scheme : TBasicType TUTF8 Ptr CString -> -- userinfo : TBasicType TUTF8 Ptr CString -> -- host : TBasicType TUTF8 Ptr Int32 -> -- port : TBasicType TInt Ptr CString -> -- path : TBasicType TUTF8 Ptr CString -> -- query : TBasicType TUTF8 Ptr CString -> -- fragment : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO CInt -- | Parses /@uriRef@/ (which can be an -- [absolute or relative URI][relative-absolute-uris]) according to /@flags@/, and -- returns the pieces. Any component that doesn\'t appear in /@uriRef@/ will be -- returned as 'P.Nothing' (but note that all URIs always have a path component, -- though it may be the empty string). -- -- If /@flags@/ contains 'GI.GLib.Flags.UriFlagsEncoded', then @%@-encoded characters in -- /@uriRef@/ will remain encoded in the output strings. (If not, -- then all such characters will be decoded.) Note that decoding will -- only work if the URI components are ASCII or UTF-8, so you will -- need to use 'GI.GLib.Flags.UriFlagsEncoded' if they are not. -- -- Note that the 'GI.GLib.Flags.UriFlagsHasPassword' and -- 'GI.GLib.Flags.UriFlagsHasAuthParams' /@flags@/ are ignored by 'GI.GLib.Functions.uriSplit', -- since it always returns only the full userinfo; use -- 'GI.GLib.Functions.uriSplitWithUser' if you want it split up. -- -- /Since: 2.66/ uriSplit :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@uriRef@/: a string containing a relative or absolute URI -> [GLib.Flags.UriFlags] -- ^ /@flags@/: flags for parsing /@uriRef@/ -> m ((Maybe T.Text, Maybe T.Text, Maybe T.Text, Int32, T.Text, Maybe T.Text, Maybe T.Text)) -- ^ /(Can throw 'Data.GI.Base.GError.GError')/ uriSplit :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> [UriFlags] -> m (Maybe Text, Maybe Text, Maybe Text, Int32, Text, Maybe Text, Maybe Text) uriSplit Text uriRef [UriFlags] flags = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do CString uriRef' <- Text -> IO CString textToCString Text uriRef let flags' :: CUInt flags' = forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [UriFlags] flags Ptr CString scheme <- forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) Ptr CString userinfo <- forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) Ptr CString host <- forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) Ptr Int32 port <- forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr Int32) Ptr CString path <- forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) Ptr CString query <- forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) Ptr CString fragment <- forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) forall a b. IO a -> IO b -> IO a onException (do CInt _ <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError forall a b. (a -> b) -> a -> b $ CString -> CUInt -> Ptr CString -> Ptr CString -> Ptr CString -> Ptr Int32 -> Ptr CString -> Ptr CString -> Ptr CString -> Ptr (Ptr GError) -> IO CInt g_uri_split CString uriRef' CUInt flags' Ptr CString scheme Ptr CString userinfo Ptr CString host Ptr Int32 port Ptr CString path Ptr CString query Ptr CString fragment CString scheme' <- forall a. Storable a => Ptr a -> IO a peek Ptr CString scheme Maybe Text maybeScheme' <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString scheme' forall a b. (a -> b) -> a -> b $ \CString scheme'' -> do Text scheme''' <- HasCallStack => CString -> IO Text cstringToText CString scheme'' forall (m :: * -> *) a. Monad m => a -> m a return Text scheme''' forall a. Ptr a -> IO () freeMem CString scheme' CString userinfo' <- forall a. Storable a => Ptr a -> IO a peek Ptr CString userinfo Maybe Text maybeUserinfo' <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString userinfo' forall a b. (a -> b) -> a -> b $ \CString userinfo'' -> do Text userinfo''' <- HasCallStack => CString -> IO Text cstringToText CString userinfo'' forall (m :: * -> *) a. Monad m => a -> m a return Text userinfo''' forall a. Ptr a -> IO () freeMem CString userinfo' CString host' <- forall a. Storable a => Ptr a -> IO a peek Ptr CString host Maybe Text maybeHost' <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString host' forall a b. (a -> b) -> a -> b $ \CString host'' -> do Text host''' <- HasCallStack => CString -> IO Text cstringToText CString host'' forall (m :: * -> *) a. Monad m => a -> m a return Text host''' forall a. Ptr a -> IO () freeMem CString host' Int32 port' <- forall a. Storable a => Ptr a -> IO a peek Ptr Int32 port CString path' <- forall a. Storable a => Ptr a -> IO a peek Ptr CString path Text path'' <- HasCallStack => CString -> IO Text cstringToText CString path' forall a. Ptr a -> IO () freeMem CString path' CString query' <- forall a. Storable a => Ptr a -> IO a peek Ptr CString query Maybe Text maybeQuery' <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString query' forall a b. (a -> b) -> a -> b $ \CString query'' -> do Text query''' <- HasCallStack => CString -> IO Text cstringToText CString query'' forall (m :: * -> *) a. Monad m => a -> m a return Text query''' forall a. Ptr a -> IO () freeMem CString query' CString fragment' <- forall a. Storable a => Ptr a -> IO a peek Ptr CString fragment Maybe Text maybeFragment' <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString fragment' forall a b. (a -> b) -> a -> b $ \CString fragment'' -> do Text fragment''' <- HasCallStack => CString -> IO Text cstringToText CString fragment'' forall (m :: * -> *) a. Monad m => a -> m a return Text fragment''' forall a. Ptr a -> IO () freeMem CString fragment' forall a. Ptr a -> IO () freeMem CString uriRef' forall a. Ptr a -> IO () freeMem Ptr CString scheme forall a. Ptr a -> IO () freeMem Ptr CString userinfo forall a. Ptr a -> IO () freeMem Ptr CString host forall a. Ptr a -> IO () freeMem Ptr Int32 port forall a. Ptr a -> IO () freeMem Ptr CString path forall a. Ptr a -> IO () freeMem Ptr CString query forall a. Ptr a -> IO () freeMem Ptr CString fragment forall (m :: * -> *) a. Monad m => a -> m a return (Maybe Text maybeScheme', Maybe Text maybeUserinfo', Maybe Text maybeHost', Int32 port', Text path'', Maybe Text maybeQuery', Maybe Text maybeFragment') ) (do forall a. Ptr a -> IO () freeMem CString uriRef' forall a. Ptr a -> IO () freeMem Ptr CString scheme forall a. Ptr a -> IO () freeMem Ptr CString userinfo forall a. Ptr a -> IO () freeMem Ptr CString host forall a. Ptr a -> IO () freeMem Ptr Int32 port forall a. Ptr a -> IO () freeMem Ptr CString path forall a. Ptr a -> IO () freeMem Ptr CString query forall a. Ptr a -> IO () freeMem Ptr CString fragment ) #if defined(ENABLE_OVERLOADING) #endif -- method Uri::split_network -- method type : MemberFunction -- Args: [ Arg -- { argCName = "uri_string" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a string containing an absolute URI" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "flags" -- , argType = -- TInterface Name { namespace = "GLib" , name = "UriFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "flags for parsing @uri_string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "scheme" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "on return, contains\n the scheme (converted to lowercase), or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "host" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "on return, contains the\n host, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "port" -- , argType = TBasicType TInt -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "on return, contains the\n port, or `-1`" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : True -- Skip return : True foreign import ccall "g_uri_split_network" g_uri_split_network :: CString -> -- uri_string : TBasicType TUTF8 CUInt -> -- flags : TInterface (Name {namespace = "GLib", name = "UriFlags"}) Ptr CString -> -- scheme : TBasicType TUTF8 Ptr CString -> -- host : TBasicType TUTF8 Ptr Int32 -> -- port : TBasicType TInt Ptr (Ptr GError) -> -- error IO CInt -- | Parses /@uriString@/ (which must be an [absolute URI][relative-absolute-uris]) -- according to /@flags@/, and returns the pieces relevant to connecting to a host. -- See the documentation for 'GI.GLib.Functions.uriSplit' for more details; this is -- mostly a wrapper around that function with simpler arguments. -- However, it will return an error if /@uriString@/ is a relative URI, -- or does not contain a hostname component. -- -- /Since: 2.66/ uriSplitNetwork :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@uriString@/: a string containing an absolute URI -> [GLib.Flags.UriFlags] -- ^ /@flags@/: flags for parsing /@uriString@/ -> m ((Maybe T.Text, Maybe T.Text, Int32)) -- ^ /(Can throw 'Data.GI.Base.GError.GError')/ uriSplitNetwork :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> [UriFlags] -> m (Maybe Text, Maybe Text, Int32) uriSplitNetwork Text uriString [UriFlags] flags = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do CString uriString' <- Text -> IO CString textToCString Text uriString let flags' :: CUInt flags' = forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [UriFlags] flags Ptr CString scheme <- forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) Ptr CString host <- forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) Ptr Int32 port <- forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr Int32) forall a b. IO a -> IO b -> IO a onException (do CInt _ <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError forall a b. (a -> b) -> a -> b $ CString -> CUInt -> Ptr CString -> Ptr CString -> Ptr Int32 -> Ptr (Ptr GError) -> IO CInt g_uri_split_network CString uriString' CUInt flags' Ptr CString scheme Ptr CString host Ptr Int32 port CString scheme' <- forall a. Storable a => Ptr a -> IO a peek Ptr CString scheme Maybe Text maybeScheme' <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString scheme' forall a b. (a -> b) -> a -> b $ \CString scheme'' -> do Text scheme''' <- HasCallStack => CString -> IO Text cstringToText CString scheme'' forall (m :: * -> *) a. Monad m => a -> m a return Text scheme''' forall a. Ptr a -> IO () freeMem CString scheme' CString host' <- forall a. Storable a => Ptr a -> IO a peek Ptr CString host Maybe Text maybeHost' <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString host' forall a b. (a -> b) -> a -> b $ \CString host'' -> do Text host''' <- HasCallStack => CString -> IO Text cstringToText CString host'' forall (m :: * -> *) a. Monad m => a -> m a return Text host''' forall a. Ptr a -> IO () freeMem CString host' Int32 port' <- forall a. Storable a => Ptr a -> IO a peek Ptr Int32 port forall a. Ptr a -> IO () freeMem CString uriString' forall a. Ptr a -> IO () freeMem Ptr CString scheme forall a. Ptr a -> IO () freeMem Ptr CString host forall a. Ptr a -> IO () freeMem Ptr Int32 port forall (m :: * -> *) a. Monad m => a -> m a return (Maybe Text maybeScheme', Maybe Text maybeHost', Int32 port') ) (do forall a. Ptr a -> IO () freeMem CString uriString' forall a. Ptr a -> IO () freeMem Ptr CString scheme forall a. Ptr a -> IO () freeMem Ptr CString host forall a. Ptr a -> IO () freeMem Ptr Int32 port ) #if defined(ENABLE_OVERLOADING) #endif -- method Uri::split_with_user -- method type : MemberFunction -- Args: [ Arg -- { argCName = "uri_ref" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "a string containing a relative or absolute URI" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "flags" -- , argType = -- TInterface Name { namespace = "GLib" , name = "UriFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "flags for parsing @uri_ref" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "scheme" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "on return, contains\n the scheme (converted to lowercase), or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "user" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "on return, contains\n the user, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "password" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "on return, contains\n the password, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "auth_params" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "on return, contains\n the auth_params, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "host" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "on return, contains the\n host, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "port" -- , argType = TBasicType TInt -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "on return, contains the\n port, or `-1`" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "path" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "on return, contains the\n path" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "query" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "on return, contains the\n query, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "fragment" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "on return, contains\n the fragment, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : True -- Skip return : True foreign import ccall "g_uri_split_with_user" g_uri_split_with_user :: CString -> -- uri_ref : TBasicType TUTF8 CUInt -> -- flags : TInterface (Name {namespace = "GLib", name = "UriFlags"}) Ptr CString -> -- scheme : TBasicType TUTF8 Ptr CString -> -- user : TBasicType TUTF8 Ptr CString -> -- password : TBasicType TUTF8 Ptr CString -> -- auth_params : TBasicType TUTF8 Ptr CString -> -- host : TBasicType TUTF8 Ptr Int32 -> -- port : TBasicType TInt Ptr CString -> -- path : TBasicType TUTF8 Ptr CString -> -- query : TBasicType TUTF8 Ptr CString -> -- fragment : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO CInt -- | Parses /@uriRef@/ (which can be an -- [absolute or relative URI][relative-absolute-uris]) according to /@flags@/, and -- returns the pieces. Any component that doesn\'t appear in /@uriRef@/ will be -- returned as 'P.Nothing' (but note that all URIs always have a path component, -- though it may be the empty string). -- -- See 'GI.GLib.Functions.uriSplit', and the definition of t'GI.GLib.Flags.UriFlags', for more -- information on the effect of /@flags@/. Note that /@password@/ will only -- be parsed out if /@flags@/ contains 'GI.GLib.Flags.UriFlagsHasPassword', and -- /@authParams@/ will only be parsed out if /@flags@/ contains -- 'GI.GLib.Flags.UriFlagsHasAuthParams'. -- -- /Since: 2.66/ uriSplitWithUser :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@uriRef@/: a string containing a relative or absolute URI -> [GLib.Flags.UriFlags] -- ^ /@flags@/: flags for parsing /@uriRef@/ -> m ((Maybe T.Text, Maybe T.Text, Maybe T.Text, Maybe T.Text, Maybe T.Text, Int32, T.Text, Maybe T.Text, Maybe T.Text)) -- ^ /(Can throw 'Data.GI.Base.GError.GError')/ uriSplitWithUser :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> [UriFlags] -> m (Maybe Text, Maybe Text, Maybe Text, Maybe Text, Maybe Text, Int32, Text, Maybe Text, Maybe Text) uriSplitWithUser Text uriRef [UriFlags] flags = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do CString uriRef' <- Text -> IO CString textToCString Text uriRef let flags' :: CUInt flags' = forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [UriFlags] flags Ptr CString scheme <- forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) Ptr CString user <- forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) Ptr CString password <- forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) Ptr CString authParams <- forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) Ptr CString host <- forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) Ptr Int32 port <- forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr Int32) Ptr CString path <- forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) Ptr CString query <- forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) Ptr CString fragment <- forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) forall a b. IO a -> IO b -> IO a onException (do CInt _ <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError forall a b. (a -> b) -> a -> b $ CString -> CUInt -> Ptr CString -> Ptr CString -> Ptr CString -> Ptr CString -> Ptr CString -> Ptr Int32 -> Ptr CString -> Ptr CString -> Ptr CString -> Ptr (Ptr GError) -> IO CInt g_uri_split_with_user CString uriRef' CUInt flags' Ptr CString scheme Ptr CString user Ptr CString password Ptr CString authParams Ptr CString host Ptr Int32 port Ptr CString path Ptr CString query Ptr CString fragment CString scheme' <- forall a. Storable a => Ptr a -> IO a peek Ptr CString scheme Maybe Text maybeScheme' <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString scheme' forall a b. (a -> b) -> a -> b $ \CString scheme'' -> do Text scheme''' <- HasCallStack => CString -> IO Text cstringToText CString scheme'' forall (m :: * -> *) a. Monad m => a -> m a return Text scheme''' forall a. Ptr a -> IO () freeMem CString scheme' CString user' <- forall a. Storable a => Ptr a -> IO a peek Ptr CString user Maybe Text maybeUser' <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString user' forall a b. (a -> b) -> a -> b $ \CString user'' -> do Text user''' <- HasCallStack => CString -> IO Text cstringToText CString user'' forall (m :: * -> *) a. Monad m => a -> m a return Text user''' forall a. Ptr a -> IO () freeMem CString user' CString password' <- forall a. Storable a => Ptr a -> IO a peek Ptr CString password Maybe Text maybePassword' <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString password' forall a b. (a -> b) -> a -> b $ \CString password'' -> do Text password''' <- HasCallStack => CString -> IO Text cstringToText CString password'' forall (m :: * -> *) a. Monad m => a -> m a return Text password''' forall a. Ptr a -> IO () freeMem CString password' CString authParams' <- forall a. Storable a => Ptr a -> IO a peek Ptr CString authParams Maybe Text maybeAuthParams' <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString authParams' forall a b. (a -> b) -> a -> b $ \CString authParams'' -> do Text authParams''' <- HasCallStack => CString -> IO Text cstringToText CString authParams'' forall (m :: * -> *) a. Monad m => a -> m a return Text authParams''' forall a. Ptr a -> IO () freeMem CString authParams' CString host' <- forall a. Storable a => Ptr a -> IO a peek Ptr CString host Maybe Text maybeHost' <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString host' forall a b. (a -> b) -> a -> b $ \CString host'' -> do Text host''' <- HasCallStack => CString -> IO Text cstringToText CString host'' forall (m :: * -> *) a. Monad m => a -> m a return Text host''' forall a. Ptr a -> IO () freeMem CString host' Int32 port' <- forall a. Storable a => Ptr a -> IO a peek Ptr Int32 port CString path' <- forall a. Storable a => Ptr a -> IO a peek Ptr CString path Text path'' <- HasCallStack => CString -> IO Text cstringToText CString path' forall a. Ptr a -> IO () freeMem CString path' CString query' <- forall a. Storable a => Ptr a -> IO a peek Ptr CString query Maybe Text maybeQuery' <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString query' forall a b. (a -> b) -> a -> b $ \CString query'' -> do Text query''' <- HasCallStack => CString -> IO Text cstringToText CString query'' forall (m :: * -> *) a. Monad m => a -> m a return Text query''' forall a. Ptr a -> IO () freeMem CString query' CString fragment' <- forall a. Storable a => Ptr a -> IO a peek Ptr CString fragment Maybe Text maybeFragment' <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString fragment' forall a b. (a -> b) -> a -> b $ \CString fragment'' -> do Text fragment''' <- HasCallStack => CString -> IO Text cstringToText CString fragment'' forall (m :: * -> *) a. Monad m => a -> m a return Text fragment''' forall a. Ptr a -> IO () freeMem CString fragment' forall a. Ptr a -> IO () freeMem CString uriRef' forall a. Ptr a -> IO () freeMem Ptr CString scheme forall a. Ptr a -> IO () freeMem Ptr CString user forall a. Ptr a -> IO () freeMem Ptr CString password forall a. Ptr a -> IO () freeMem Ptr CString authParams forall a. Ptr a -> IO () freeMem Ptr CString host forall a. Ptr a -> IO () freeMem Ptr Int32 port forall a. Ptr a -> IO () freeMem Ptr CString path forall a. Ptr a -> IO () freeMem Ptr CString query forall a. Ptr a -> IO () freeMem Ptr CString fragment forall (m :: * -> *) a. Monad m => a -> m a return (Maybe Text maybeScheme', Maybe Text maybeUser', Maybe Text maybePassword', Maybe Text maybeAuthParams', Maybe Text maybeHost', Int32 port', Text path'', Maybe Text maybeQuery', Maybe Text maybeFragment') ) (do forall a. Ptr a -> IO () freeMem CString uriRef' forall a. Ptr a -> IO () freeMem Ptr CString scheme forall a. Ptr a -> IO () freeMem Ptr CString user forall a. Ptr a -> IO () freeMem Ptr CString password forall a. Ptr a -> IO () freeMem Ptr CString authParams forall a. Ptr a -> IO () freeMem Ptr CString host forall a. Ptr a -> IO () freeMem Ptr Int32 port forall a. Ptr a -> IO () freeMem Ptr CString path forall a. Ptr a -> IO () freeMem Ptr CString query forall a. Ptr a -> IO () freeMem Ptr CString fragment ) #if defined(ENABLE_OVERLOADING) #endif -- method Uri::unescape_bytes -- method type : MemberFunction -- Args: [ Arg -- { argCName = "escaped_string" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A URI-escaped string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "length" -- , argType = TBasicType TInt64 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "the length (in bytes) of @escaped_string to escape, or `-1` if it\n is nul-terminated." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "illegal_characters" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "a string of illegal characters\n not to be allowed, or %NULL." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "GLib" , name = "Bytes" }) -- throws : True -- Skip return : False foreign import ccall "g_uri_unescape_bytes" g_uri_unescape_bytes :: CString -> -- escaped_string : TBasicType TUTF8 Int64 -> -- length : TBasicType TInt64 CString -> -- illegal_characters : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO (Ptr GLib.Bytes.Bytes) -- | Unescapes a segment of an escaped string as binary data. -- -- Note that in contrast to 'GI.GLib.Functions.uriUnescapeString', this does allow -- nul bytes to appear in the output. -- -- If any of the characters in /@illegalCharacters@/ appears as an escaped -- character in /@escapedString@/, then that is an error and 'P.Nothing' will be -- returned. This is useful if you want to avoid for instance having a slash -- being expanded in an escaped path element, which might confuse pathname -- handling. -- -- /Since: 2.66/ uriUnescapeBytes :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@escapedString@/: A URI-escaped string -> Int64 -- ^ /@length@/: the length (in bytes) of /@escapedString@/ to escape, or @-1@ if it -- is nul-terminated. -> Maybe (T.Text) -- ^ /@illegalCharacters@/: a string of illegal characters -- not to be allowed, or 'P.Nothing'. -> m GLib.Bytes.Bytes -- ^ __Returns:__ an unescaped version of /@escapedString@/ -- or 'P.Nothing' on error (if decoding failed, using 'GI.GLib.Enums.UriErrorFailed' error -- code). The returned t'GI.GLib.Structs.Bytes.Bytes' should be unreffed when no longer needed. /(Can throw 'Data.GI.Base.GError.GError')/ uriUnescapeBytes :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Int64 -> Maybe Text -> m Bytes uriUnescapeBytes Text escapedString Int64 length_ Maybe Text illegalCharacters = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do CString escapedString' <- Text -> IO CString textToCString Text escapedString CString maybeIllegalCharacters <- case Maybe Text illegalCharacters of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jIllegalCharacters -> do CString jIllegalCharacters' <- Text -> IO CString textToCString Text jIllegalCharacters forall (m :: * -> *) a. Monad m => a -> m a return CString jIllegalCharacters' forall a b. IO a -> IO b -> IO a onException (do Ptr Bytes result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError forall a b. (a -> b) -> a -> b $ CString -> Int64 -> CString -> Ptr (Ptr GError) -> IO (Ptr Bytes) g_uri_unescape_bytes CString escapedString' Int64 length_ CString maybeIllegalCharacters forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "uriUnescapeBytes" Ptr Bytes result Bytes result' <- (forall a. (HasCallStack, GBoxed a) => (ManagedPtr a -> a) -> Ptr a -> IO a wrapBoxed ManagedPtr Bytes -> Bytes GLib.Bytes.Bytes) Ptr Bytes result forall a. Ptr a -> IO () freeMem CString escapedString' forall a. Ptr a -> IO () freeMem CString maybeIllegalCharacters forall (m :: * -> *) a. Monad m => a -> m a return Bytes result' ) (do forall a. Ptr a -> IO () freeMem CString escapedString' forall a. Ptr a -> IO () freeMem CString maybeIllegalCharacters ) #if defined(ENABLE_OVERLOADING) #endif -- method Uri::unescape_segment -- method type : MemberFunction -- Args: [ Arg -- { argCName = "escaped_string" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "A string, may be %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "escaped_string_end" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "Pointer to end of @escaped_string,\n may be %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "illegal_characters" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "An optional string of illegal\n characters not to be allowed, may be %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_unescape_segment" g_uri_unescape_segment :: CString -> -- escaped_string : TBasicType TUTF8 CString -> -- escaped_string_end : TBasicType TUTF8 CString -> -- illegal_characters : TBasicType TUTF8 IO CString -- | Unescapes a segment of an escaped string. -- -- If any of the characters in /@illegalCharacters@/ or the NUL -- character appears as an escaped character in /@escapedString@/, then -- that is an error and 'P.Nothing' will be returned. This is useful if you -- want to avoid for instance having a slash being expanded in an -- escaped path element, which might confuse pathname handling. -- -- Note: @NUL@ byte is not accepted in the output, in contrast to -- 'GI.GLib.Functions.uriUnescapeBytes'. -- -- /Since: 2.16/ uriUnescapeSegment :: (B.CallStack.HasCallStack, MonadIO m) => Maybe (T.Text) -- ^ /@escapedString@/: A string, may be 'P.Nothing' -> Maybe (T.Text) -- ^ /@escapedStringEnd@/: Pointer to end of /@escapedString@/, -- may be 'P.Nothing' -> Maybe (T.Text) -- ^ /@illegalCharacters@/: An optional string of illegal -- characters not to be allowed, may be 'P.Nothing' -> m (Maybe T.Text) -- ^ __Returns:__ an unescaped version of /@escapedString@/, -- or 'P.Nothing' on error. The returned string should be freed when no longer -- needed. As a special case if 'P.Nothing' is given for /@escapedString@/, this -- function will return 'P.Nothing'. uriUnescapeSegment :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Maybe Text -> Maybe Text -> Maybe Text -> m (Maybe Text) uriUnescapeSegment Maybe Text escapedString Maybe Text escapedStringEnd Maybe Text illegalCharacters = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do CString maybeEscapedString <- case Maybe Text escapedString of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jEscapedString -> do CString jEscapedString' <- Text -> IO CString textToCString Text jEscapedString forall (m :: * -> *) a. Monad m => a -> m a return CString jEscapedString' CString maybeEscapedStringEnd <- case Maybe Text escapedStringEnd of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jEscapedStringEnd -> do CString jEscapedStringEnd' <- Text -> IO CString textToCString Text jEscapedStringEnd forall (m :: * -> *) a. Monad m => a -> m a return CString jEscapedStringEnd' CString maybeIllegalCharacters <- case Maybe Text illegalCharacters of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jIllegalCharacters -> do CString jIllegalCharacters' <- Text -> IO CString textToCString Text jIllegalCharacters forall (m :: * -> *) a. Monad m => a -> m a return CString jIllegalCharacters' CString result <- CString -> CString -> CString -> IO CString g_uri_unescape_segment CString maybeEscapedString CString maybeEscapedStringEnd CString maybeIllegalCharacters Maybe Text maybeResult <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString result forall a b. (a -> b) -> a -> b $ \CString result' -> do Text result'' <- HasCallStack => CString -> IO Text cstringToText CString result' forall a. Ptr a -> IO () freeMem CString result' forall (m :: * -> *) a. Monad m => a -> m a return Text result'' forall a. Ptr a -> IO () freeMem CString maybeEscapedString forall a. Ptr a -> IO () freeMem CString maybeEscapedStringEnd forall a. Ptr a -> IO () freeMem CString maybeIllegalCharacters forall (m :: * -> *) a. Monad m => a -> m a return Maybe Text maybeResult #if defined(ENABLE_OVERLOADING) #endif -- method Uri::unescape_string -- method type : MemberFunction -- Args: [ Arg -- { argCName = "escaped_string" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "an escaped string to be unescaped." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "illegal_characters" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "a string of illegal characters\n not to be allowed, or %NULL." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_uri_unescape_string" g_uri_unescape_string :: CString -> -- escaped_string : TBasicType TUTF8 CString -> -- illegal_characters : TBasicType TUTF8 IO CString -- | Unescapes a whole escaped string. -- -- If any of the characters in /@illegalCharacters@/ or the NUL -- character appears as an escaped character in /@escapedString@/, then -- that is an error and 'P.Nothing' will be returned. This is useful if you -- want to avoid for instance having a slash being expanded in an -- escaped path element, which might confuse pathname handling. -- -- /Since: 2.16/ uriUnescapeString :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@escapedString@/: an escaped string to be unescaped. -> Maybe (T.Text) -- ^ /@illegalCharacters@/: a string of illegal characters -- not to be allowed, or 'P.Nothing'. -> m (Maybe T.Text) -- ^ __Returns:__ an unescaped version of /@escapedString@/. -- The returned string should be freed when no longer needed. uriUnescapeString :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Maybe Text -> m (Maybe Text) uriUnescapeString Text escapedString Maybe Text illegalCharacters = forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO forall a b. (a -> b) -> a -> b $ do CString escapedString' <- Text -> IO CString textToCString Text escapedString CString maybeIllegalCharacters <- case Maybe Text illegalCharacters of Maybe Text Nothing -> forall (m :: * -> *) a. Monad m => a -> m a return forall a. Ptr a nullPtr Just Text jIllegalCharacters -> do CString jIllegalCharacters' <- Text -> IO CString textToCString Text jIllegalCharacters forall (m :: * -> *) a. Monad m => a -> m a return CString jIllegalCharacters' CString result <- CString -> CString -> IO CString g_uri_unescape_string CString escapedString' CString maybeIllegalCharacters Maybe Text maybeResult <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString result forall a b. (a -> b) -> a -> b $ \CString result' -> do Text result'' <- HasCallStack => CString -> IO Text cstringToText CString result' forall a. Ptr a -> IO () freeMem CString result' forall (m :: * -> *) a. Monad m => a -> m a return Text result'' forall a. Ptr a -> IO () freeMem CString escapedString' forall a. Ptr a -> IO () freeMem CString maybeIllegalCharacters forall (m :: * -> *) a. Monad m => a -> m a return Maybe Text maybeResult #if defined(ENABLE_OVERLOADING) #endif #if defined(ENABLE_OVERLOADING) type family ResolveUriMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where ResolveUriMethod "parseRelative" o = UriParseRelativeMethodInfo ResolveUriMethod "toString" o = UriToStringMethodInfo ResolveUriMethod "toStringPartial" o = UriToStringPartialMethodInfo ResolveUriMethod "getAuthParams" o = UriGetAuthParamsMethodInfo ResolveUriMethod "getFlags" o = UriGetFlagsMethodInfo ResolveUriMethod "getFragment" o = UriGetFragmentMethodInfo ResolveUriMethod "getHost" o = UriGetHostMethodInfo ResolveUriMethod "getPassword" o = UriGetPasswordMethodInfo ResolveUriMethod "getPath" o = UriGetPathMethodInfo ResolveUriMethod "getPort" o = UriGetPortMethodInfo ResolveUriMethod "getQuery" o = UriGetQueryMethodInfo ResolveUriMethod "getScheme" o = UriGetSchemeMethodInfo ResolveUriMethod "getUser" o = UriGetUserMethodInfo ResolveUriMethod "getUserinfo" o = UriGetUserinfoMethodInfo ResolveUriMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveUriMethod t Uri, O.OverloadedMethod info Uri p) => OL.IsLabel t (Uri -> p) where #if MIN_VERSION_base(4,10,0) fromLabel = O.overloadedMethod @info #else fromLabel _ = O.overloadedMethod @info #endif #if MIN_VERSION_base(4,13,0) instance (info ~ ResolveUriMethod t Uri, O.OverloadedMethod info Uri p, R.HasField t Uri p) => R.HasField t Uri p where getField = O.overloadedMethod @info #endif instance (info ~ ResolveUriMethod t Uri, O.OverloadedMethodInfo info Uri) => OL.IsLabel t (O.MethodProxy info Uri) where #if MIN_VERSION_base(4,10,0) fromLabel = O.MethodProxy #else fromLabel _ = O.MethodProxy #endif #endif