{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.GLib.Structs.Uri
(
Uri(..) ,
#if defined(ENABLE_OVERLOADING)
ResolveUriMethod ,
#endif
uriBuild ,
uriBuildWithUser ,
uriErrorQuark ,
uriEscapeBytes ,
uriEscapeString ,
#if defined(ENABLE_OVERLOADING)
UriGetAuthParamsMethodInfo ,
#endif
uriGetAuthParams ,
#if defined(ENABLE_OVERLOADING)
UriGetFlagsMethodInfo ,
#endif
uriGetFlags ,
#if defined(ENABLE_OVERLOADING)
UriGetFragmentMethodInfo ,
#endif
uriGetFragment ,
#if defined(ENABLE_OVERLOADING)
UriGetHostMethodInfo ,
#endif
uriGetHost ,
#if defined(ENABLE_OVERLOADING)
UriGetPasswordMethodInfo ,
#endif
uriGetPassword ,
#if defined(ENABLE_OVERLOADING)
UriGetPathMethodInfo ,
#endif
uriGetPath ,
#if defined(ENABLE_OVERLOADING)
UriGetPortMethodInfo ,
#endif
uriGetPort ,
#if defined(ENABLE_OVERLOADING)
UriGetQueryMethodInfo ,
#endif
uriGetQuery ,
#if defined(ENABLE_OVERLOADING)
UriGetSchemeMethodInfo ,
#endif
uriGetScheme ,
#if defined(ENABLE_OVERLOADING)
UriGetUserMethodInfo ,
#endif
uriGetUser ,
#if defined(ENABLE_OVERLOADING)
UriGetUserinfoMethodInfo ,
#endif
uriGetUserinfo ,
uriIsValid ,
uriJoin ,
uriJoinWithUser ,
uriListExtractUris ,
uriParse ,
uriParseParams ,
#if defined(ENABLE_OVERLOADING)
UriParseRelativeMethodInfo ,
#endif
uriParseRelative ,
uriParseScheme ,
uriPeekScheme ,
uriResolveRelative ,
uriSplit ,
uriSplitNetwork ,
uriSplitWithUser ,
#if defined(ENABLE_OVERLOADING)
UriToStringMethodInfo ,
#endif
uriToString ,
#if defined(ENABLE_OVERLOADING)
UriToStringPartialMethodInfo ,
#endif
uriToStringPartial ,
uriUnescapeBytes ,
uriUnescapeSegment ,
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 qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
import {-# SOURCE #-} qualified GI.GLib.Flags as GLib.Flags
import {-# SOURCE #-} qualified GI.GLib.Structs.Bytes as GLib.Bytes
#else
import {-# SOURCE #-} qualified GI.GLib.Flags as GLib.Flags
import {-# SOURCE #-} qualified GI.GLib.Structs.Bytes as GLib.Bytes
#endif
newtype Uri = Uri (SP.ManagedPtr Uri)
deriving (Uri -> Uri -> Bool
(Uri -> Uri -> Bool) -> (Uri -> Uri -> Bool) -> Eq Uri
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Uri -> Uri -> Bool
== :: Uri -> Uri -> Bool
$c/= :: Uri -> Uri -> Bool
/= :: 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
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 = Ptr GValue -> Ptr Uri -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr Uri
forall a. Ptr a
FP.nullPtr :: FP.Ptr Uri)
gvalueSet_ Ptr GValue
gv (P.Just Uri
obj) = Uri -> (Ptr Uri -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Uri
obj (Ptr GValue -> Ptr Uri -> IO ()
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 <- Ptr GValue -> IO (Ptr Uri)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr Uri)
if Ptr Uri
ptr Ptr Uri -> Ptr Uri -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Uri
forall a. Ptr a
FP.nullPtr
then Uri -> Maybe Uri
forall a. a -> Maybe a
P.Just (Uri -> Maybe Uri) -> IO Uri -> IO (Maybe Uri)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Uri -> Uri) -> Ptr Uri -> IO Uri
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Uri -> Uri
Uri Ptr Uri
ptr
else Maybe Uri -> IO (Maybe Uri)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Uri
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
foreign import ccall "g_uri_get_auth_params" g_uri_get_auth_params ::
Ptr Uri ->
IO CString
uriGetAuthParams ::
(B.CallStack.HasCallStack, MonadIO m) =>
Uri
-> m (Maybe T.Text)
uriGetAuthParams :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Uri -> m (Maybe Text)
uriGetAuthParams Uri
uri = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr Uri
uri' <- Uri -> IO (Ptr 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 <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
Uri -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Uri
uri
Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
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.30/docs/GI-GLib-Structs-Uri.html#v:uriGetAuthParams"
})
#endif
foreign import ccall "g_uri_get_flags" g_uri_get_flags ::
Ptr Uri ->
IO CUInt
uriGetFlags ::
(B.CallStack.HasCallStack, MonadIO m) =>
Uri
-> m [GLib.Flags.UriFlags]
uriGetFlags :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Uri -> m [UriFlags]
uriGetFlags Uri
uri = IO [UriFlags] -> m [UriFlags]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [UriFlags] -> m [UriFlags]) -> IO [UriFlags] -> m [UriFlags]
forall a b. (a -> b) -> a -> b
$ do
Ptr Uri
uri' <- Uri -> IO (Ptr 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' = CUInt -> [UriFlags]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
result
Uri -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Uri
uri
[UriFlags] -> IO [UriFlags]
forall a. a -> IO a
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.30/docs/GI-GLib-Structs-Uri.html#v:uriGetFlags"
})
#endif
foreign import ccall "g_uri_get_fragment" g_uri_get_fragment ::
Ptr Uri ->
IO CString
uriGetFragment ::
(B.CallStack.HasCallStack, MonadIO m) =>
Uri
-> m (Maybe T.Text)
uriGetFragment :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Uri -> m (Maybe Text)
uriGetFragment Uri
uri = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr Uri
uri' <- Uri -> IO (Ptr 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 <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
Uri -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Uri
uri
Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
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.30/docs/GI-GLib-Structs-Uri.html#v:uriGetFragment"
})
#endif
foreign import ccall "g_uri_get_host" g_uri_get_host ::
Ptr Uri ->
IO CString
uriGetHost ::
(B.CallStack.HasCallStack, MonadIO m) =>
Uri
-> m (Maybe T.Text)
uriGetHost :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Uri -> m (Maybe Text)
uriGetHost Uri
uri = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr Uri
uri' <- Uri -> IO (Ptr 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 <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
Uri -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Uri
uri
Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
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.30/docs/GI-GLib-Structs-Uri.html#v:uriGetHost"
})
#endif
foreign import ccall "g_uri_get_password" g_uri_get_password ::
Ptr Uri ->
IO CString
uriGetPassword ::
(B.CallStack.HasCallStack, MonadIO m) =>
Uri
-> m (Maybe T.Text)
uriGetPassword :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Uri -> m (Maybe Text)
uriGetPassword Uri
uri = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr Uri
uri' <- Uri -> IO (Ptr 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 <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
Uri -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Uri
uri
Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
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.30/docs/GI-GLib-Structs-Uri.html#v:uriGetPassword"
})
#endif
foreign import ccall "g_uri_get_path" g_uri_get_path ::
Ptr Uri ->
IO CString
uriGetPath ::
(B.CallStack.HasCallStack, MonadIO m) =>
Uri
-> m T.Text
uriGetPath :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> m Text
uriGetPath Uri
uri = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr Uri
uri' <- Uri -> IO (Ptr 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'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"uriGetPath" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
Uri -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Uri
uri
Text -> IO Text
forall a. a -> IO a
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.30/docs/GI-GLib-Structs-Uri.html#v:uriGetPath"
})
#endif
foreign import ccall "g_uri_get_port" g_uri_get_port ::
Ptr Uri ->
IO Int32
uriGetPort ::
(B.CallStack.HasCallStack, MonadIO m) =>
Uri
-> m Int32
uriGetPort :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> m Int32
uriGetPort Uri
uri = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
Ptr Uri
uri' <- Uri -> IO (Ptr 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'
Uri -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Uri
uri
Int32 -> IO Int32
forall a. a -> IO a
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.30/docs/GI-GLib-Structs-Uri.html#v:uriGetPort"
})
#endif
foreign import ccall "g_uri_get_query" g_uri_get_query ::
Ptr Uri ->
IO CString
uriGetQuery ::
(B.CallStack.HasCallStack, MonadIO m) =>
Uri
-> m (Maybe T.Text)
uriGetQuery :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Uri -> m (Maybe Text)
uriGetQuery Uri
uri = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr Uri
uri' <- Uri -> IO (Ptr 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 <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
Uri -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Uri
uri
Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
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.30/docs/GI-GLib-Structs-Uri.html#v:uriGetQuery"
})
#endif
foreign import ccall "g_uri_get_scheme" g_uri_get_scheme ::
Ptr Uri ->
IO CString
uriGetScheme ::
(B.CallStack.HasCallStack, MonadIO m) =>
Uri
-> m T.Text
uriGetScheme :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> m Text
uriGetScheme Uri
uri = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr Uri
uri' <- Uri -> IO (Ptr 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'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"uriGetScheme" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
Uri -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Uri
uri
Text -> IO Text
forall a. a -> IO a
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.30/docs/GI-GLib-Structs-Uri.html#v:uriGetScheme"
})
#endif
foreign import ccall "g_uri_get_user" g_uri_get_user ::
Ptr Uri ->
IO CString
uriGetUser ::
(B.CallStack.HasCallStack, MonadIO m) =>
Uri
-> m (Maybe T.Text)
uriGetUser :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Uri -> m (Maybe Text)
uriGetUser Uri
uri = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr Uri
uri' <- Uri -> IO (Ptr 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 <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
Uri -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Uri
uri
Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
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.30/docs/GI-GLib-Structs-Uri.html#v:uriGetUser"
})
#endif
foreign import ccall "g_uri_get_userinfo" g_uri_get_userinfo ::
Ptr Uri ->
IO CString
uriGetUserinfo ::
(B.CallStack.HasCallStack, MonadIO m) =>
Uri
-> m (Maybe T.Text)
uriGetUserinfo :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Uri -> m (Maybe Text)
uriGetUserinfo Uri
uri = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr Uri
uri' <- Uri -> IO (Ptr 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 <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
Uri -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Uri
uri
Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
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.30/docs/GI-GLib-Structs-Uri.html#v:uriGetUserinfo"
})
#endif
foreign import ccall "g_uri_parse_relative" g_uri_parse_relative ::
Ptr Uri ->
CString ->
CUInt ->
Ptr (Ptr GError) ->
IO (Ptr Uri)
uriParseRelative ::
(B.CallStack.HasCallStack, MonadIO m) =>
Maybe (Uri)
-> T.Text
-> [GLib.Flags.UriFlags]
-> m Uri
uriParseRelative :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Maybe Uri -> Text -> [UriFlags] -> m Uri
uriParseRelative Maybe Uri
baseUri Text
uriRef [UriFlags]
flags = IO Uri -> m Uri
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Uri -> m Uri) -> IO Uri -> m Uri
forall a b. (a -> b) -> a -> b
$ do
Ptr Uri
maybeBaseUri <- case Maybe Uri
baseUri of
Maybe Uri
Nothing -> Ptr Uri -> IO (Ptr Uri)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Uri
forall a. Ptr a
nullPtr
Just Uri
jBaseUri -> do
Ptr Uri
jBaseUri' <- Uri -> IO (Ptr Uri)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Uri
jBaseUri
Ptr Uri -> IO (Ptr Uri)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Uri
jBaseUri'
CString
uriRef' <- Text -> IO CString
textToCString Text
uriRef
let flags' :: CUInt
flags' = [UriFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [UriFlags]
flags
IO Uri -> IO () -> IO Uri
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Uri
result <- (Ptr (Ptr GError) -> IO (Ptr Uri)) -> IO (Ptr Uri)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Uri)) -> IO (Ptr Uri))
-> (Ptr (Ptr GError) -> IO (Ptr Uri)) -> IO (Ptr Uri)
forall a b. (a -> b) -> a -> b
$ Ptr Uri -> CString -> CUInt -> Ptr (Ptr GError) -> IO (Ptr Uri)
g_uri_parse_relative Ptr Uri
maybeBaseUri CString
uriRef' CUInt
flags'
Text -> Ptr Uri -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"uriParseRelative" Ptr Uri
result
Uri
result' <- ((ManagedPtr Uri -> Uri) -> Ptr Uri -> IO Uri
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Uri -> Uri
Uri) Ptr Uri
result
Maybe Uri -> (Uri -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Uri
baseUri Uri -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uriRef'
Uri -> IO Uri
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Uri
result'
) (do
CString -> IO ()
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 i = uriParseRelative (Just i)
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.30/docs/GI-GLib-Structs-Uri.html#v:uriParseRelative"
})
#endif
foreign import ccall "g_uri_to_string" g_uri_to_string ::
Ptr Uri ->
IO CString
uriToString ::
(B.CallStack.HasCallStack, MonadIO m) =>
Uri
-> m T.Text
uriToString :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Uri -> m Text
uriToString Uri
uri = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr Uri
uri' <- Uri -> IO (Ptr 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'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"uriToString" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
Uri -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Uri
uri
Text -> IO Text
forall a. a -> IO a
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.30/docs/GI-GLib-Structs-Uri.html#v:uriToString"
})
#endif
foreign import ccall "g_uri_to_string_partial" g_uri_to_string_partial ::
Ptr Uri ->
CUInt ->
IO CString
uriToStringPartial ::
(B.CallStack.HasCallStack, MonadIO m) =>
Uri
-> [GLib.Flags.UriHideFlags]
-> m T.Text
uriToStringPartial :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Uri -> [UriHideFlags] -> m Text
uriToStringPartial Uri
uri [UriHideFlags]
flags = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr Uri
uri' <- Uri -> IO (Ptr Uri)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Uri
uri
let flags' :: CUInt
flags' = [UriHideFlags] -> CUInt
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'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"uriToStringPartial" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
Uri -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Uri
uri
Text -> IO Text
forall a. a -> IO a
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.30/docs/GI-GLib-Structs-Uri.html#v:uriToStringPartial"
})
#endif
foreign import ccall "g_uri_build" g_uri_build ::
CUInt ->
CString ->
CString ->
CString ->
Int32 ->
CString ->
CString ->
CString ->
IO (Ptr Uri)
uriBuild ::
(B.CallStack.HasCallStack, MonadIO m) =>
[GLib.Flags.UriFlags]
-> T.Text
-> Maybe (T.Text)
-> Maybe (T.Text)
-> Int32
-> T.Text
-> Maybe (T.Text)
-> Maybe (T.Text)
-> m 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 = IO Uri -> m Uri
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Uri -> m Uri) -> IO Uri -> m Uri
forall a b. (a -> b) -> a -> b
$ do
let flags' :: CUInt
flags' = [UriFlags] -> CUInt
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 -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jUserinfo -> do
CString
jUserinfo' <- Text -> IO CString
textToCString Text
jUserinfo
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jUserinfo'
CString
maybeHost <- case Maybe Text
host of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jHost -> do
CString
jHost' <- Text -> IO CString
textToCString Text
jHost
CString -> IO CString
forall a. a -> IO a
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 -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jQuery -> do
CString
jQuery' <- Text -> IO CString
textToCString Text
jQuery
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jQuery'
CString
maybeFragment <- case Maybe Text
fragment of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jFragment -> do
CString
jFragment' <- Text -> IO CString
textToCString Text
jFragment
CString -> IO CString
forall a. a -> IO a
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
Text -> Ptr Uri -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"uriBuild" Ptr Uri
result
Uri
result' <- ((ManagedPtr Uri -> Uri) -> Ptr Uri -> IO Uri
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Uri -> Uri
Uri) Ptr Uri
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
scheme'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeUserinfo
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeHost
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeQuery
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeFragment
Uri -> IO Uri
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Uri
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_build_with_user" g_uri_build_with_user ::
CUInt ->
CString ->
CString ->
CString ->
CString ->
CString ->
Int32 ->
CString ->
CString ->
CString ->
IO (Ptr Uri)
uriBuildWithUser ::
(B.CallStack.HasCallStack, MonadIO m) =>
[GLib.Flags.UriFlags]
-> T.Text
-> Maybe (T.Text)
-> Maybe (T.Text)
-> Maybe (T.Text)
-> Maybe (T.Text)
-> Int32
-> T.Text
-> Maybe (T.Text)
-> Maybe (T.Text)
-> m 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 = IO Uri -> m Uri
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Uri -> m Uri) -> IO Uri -> m Uri
forall a b. (a -> b) -> a -> b
$ do
let flags' :: CUInt
flags' = [UriFlags] -> CUInt
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 -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jUser -> do
CString
jUser' <- Text -> IO CString
textToCString Text
jUser
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jUser'
CString
maybePassword <- case Maybe Text
password of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jPassword -> do
CString
jPassword' <- Text -> IO CString
textToCString Text
jPassword
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jPassword'
CString
maybeAuthParams <- case Maybe Text
authParams of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jAuthParams -> do
CString
jAuthParams' <- Text -> IO CString
textToCString Text
jAuthParams
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jAuthParams'
CString
maybeHost <- case Maybe Text
host of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jHost -> do
CString
jHost' <- Text -> IO CString
textToCString Text
jHost
CString -> IO CString
forall a. a -> IO a
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 -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jQuery -> do
CString
jQuery' <- Text -> IO CString
textToCString Text
jQuery
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jQuery'
CString
maybeFragment <- case Maybe Text
fragment of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jFragment -> do
CString
jFragment' <- Text -> IO CString
textToCString Text
jFragment
CString -> IO CString
forall a. a -> IO a
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
Text -> Ptr Uri -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"uriBuildWithUser" Ptr Uri
result
Uri
result' <- ((ManagedPtr Uri -> Uri) -> Ptr Uri -> IO Uri
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Uri -> Uri
Uri) Ptr Uri
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
scheme'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeUser
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybePassword
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeAuthParams
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeHost
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeQuery
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeFragment
Uri -> IO Uri
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Uri
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_error_quark" g_uri_error_quark ::
IO Word32
uriErrorQuark ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Word32
uriErrorQuark :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Word32
uriErrorQuark = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Word32
result <- IO Word32
g_uri_error_quark
Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_escape_bytes" g_uri_escape_bytes ::
Ptr Word8 ->
FCT.CSize ->
CString ->
IO CString
uriEscapeBytes ::
(B.CallStack.HasCallStack, MonadIO m) =>
ByteString
-> Maybe (T.Text)
-> m T.Text
uriEscapeBytes :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> Maybe Text -> m Text
uriEscapeBytes ByteString
unescaped Maybe Text
reservedCharsAllowed = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
let length_ :: CSize
length_ = Int -> CSize
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CSize) -> Int -> CSize
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 -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jReservedCharsAllowed -> do
CString
jReservedCharsAllowed' <- Text -> IO CString
textToCString Text
jReservedCharsAllowed
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jReservedCharsAllowed'
CString
result <- Ptr Word8 -> CSize -> CString -> IO CString
g_uri_escape_bytes Ptr Word8
unescaped' CSize
length_ CString
maybeReservedCharsAllowed
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"uriEscapeBytes" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
unescaped'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeReservedCharsAllowed
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_escape_string" g_uri_escape_string ::
CString ->
CString ->
CInt ->
IO CString
uriEscapeString ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> Maybe (T.Text)
-> Bool
-> m T.Text
uriEscapeString :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Maybe Text -> Bool -> m Text
uriEscapeString Text
unescaped Maybe Text
reservedCharsAllowed Bool
allowUtf8 = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
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 -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jReservedCharsAllowed -> do
CString
jReservedCharsAllowed' <- Text -> IO CString
textToCString Text
jReservedCharsAllowed
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jReservedCharsAllowed'
let allowUtf8' :: CInt
allowUtf8' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
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'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"uriEscapeString" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
unescaped'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeReservedCharsAllowed
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_is_valid" g_uri_is_valid ::
CString ->
CUInt ->
Ptr (Ptr GError) ->
IO CInt
uriIsValid ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> [GLib.Flags.UriFlags]
-> m ()
uriIsValid :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> [UriFlags] -> m ()
uriIsValid Text
uriString [UriFlags]
flags = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
CString
uriString' <- Text -> IO CString
textToCString Text
uriString
let flags' :: CUInt
flags' = [UriFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [UriFlags]
flags
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ CString -> CUInt -> Ptr (Ptr GError) -> IO CInt
g_uri_is_valid CString
uriString' CUInt
flags'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uriString'
() -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uriString'
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_join" g_uri_join ::
CUInt ->
CString ->
CString ->
CString ->
Int32 ->
CString ->
CString ->
CString ->
IO CString
uriJoin ::
(B.CallStack.HasCallStack, MonadIO m) =>
[GLib.Flags.UriFlags]
-> Maybe (T.Text)
-> Maybe (T.Text)
-> Maybe (T.Text)
-> Int32
-> T.Text
-> Maybe (T.Text)
-> Maybe (T.Text)
-> m T.Text
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 = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
let flags' :: CUInt
flags' = [UriFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [UriFlags]
flags
CString
maybeScheme <- case Maybe Text
scheme of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jScheme -> do
CString
jScheme' <- Text -> IO CString
textToCString Text
jScheme
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jScheme'
CString
maybeUserinfo <- case Maybe Text
userinfo of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jUserinfo -> do
CString
jUserinfo' <- Text -> IO CString
textToCString Text
jUserinfo
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jUserinfo'
CString
maybeHost <- case Maybe Text
host of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jHost -> do
CString
jHost' <- Text -> IO CString
textToCString Text
jHost
CString -> IO CString
forall a. a -> IO a
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 -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jQuery -> do
CString
jQuery' <- Text -> IO CString
textToCString Text
jQuery
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jQuery'
CString
maybeFragment <- case Maybe Text
fragment of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jFragment -> do
CString
jFragment' <- Text -> IO CString
textToCString Text
jFragment
CString -> IO CString
forall a. a -> IO a
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
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"uriJoin" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeScheme
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeUserinfo
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeHost
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeQuery
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeFragment
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_join_with_user" g_uri_join_with_user ::
CUInt ->
CString ->
CString ->
CString ->
CString ->
CString ->
Int32 ->
CString ->
CString ->
CString ->
IO CString
uriJoinWithUser ::
(B.CallStack.HasCallStack, MonadIO m) =>
[GLib.Flags.UriFlags]
-> Maybe (T.Text)
-> Maybe (T.Text)
-> Maybe (T.Text)
-> Maybe (T.Text)
-> Maybe (T.Text)
-> Int32
-> T.Text
-> Maybe (T.Text)
-> Maybe (T.Text)
-> m T.Text
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 = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
let flags' :: CUInt
flags' = [UriFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [UriFlags]
flags
CString
maybeScheme <- case Maybe Text
scheme of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jScheme -> do
CString
jScheme' <- Text -> IO CString
textToCString Text
jScheme
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jScheme'
CString
maybeUser <- case Maybe Text
user of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jUser -> do
CString
jUser' <- Text -> IO CString
textToCString Text
jUser
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jUser'
CString
maybePassword <- case Maybe Text
password of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jPassword -> do
CString
jPassword' <- Text -> IO CString
textToCString Text
jPassword
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jPassword'
CString
maybeAuthParams <- case Maybe Text
authParams of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jAuthParams -> do
CString
jAuthParams' <- Text -> IO CString
textToCString Text
jAuthParams
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jAuthParams'
CString
maybeHost <- case Maybe Text
host of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jHost -> do
CString
jHost' <- Text -> IO CString
textToCString Text
jHost
CString -> IO CString
forall a. a -> IO a
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 -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jQuery -> do
CString
jQuery' <- Text -> IO CString
textToCString Text
jQuery
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jQuery'
CString
maybeFragment <- case Maybe Text
fragment of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jFragment -> do
CString
jFragment' <- Text -> IO CString
textToCString Text
jFragment
CString -> IO CString
forall a. a -> IO a
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
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"uriJoinWithUser" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeScheme
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeUser
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybePassword
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeAuthParams
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeHost
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeQuery
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeFragment
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_list_extract_uris" ::
CString ->
IO (Ptr CString)
uriListExtractUris ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m [T.Text]
Text
uriList = IO [Text] -> m [Text]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Text] -> m [Text]) -> IO [Text] -> m [Text]
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'
Text -> Ptr CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"uriListExtractUris" Ptr CString
result
[Text]
result' <- HasCallStack => Ptr CString -> IO [Text]
Ptr CString -> IO [Text]
unpackZeroTerminatedUTF8CArray Ptr CString
result
(CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uriList'
[Text] -> IO [Text]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_parse" g_uri_parse ::
CString ->
CUInt ->
Ptr (Ptr GError) ->
IO (Ptr Uri)
uriParse ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> [GLib.Flags.UriFlags]
-> m Uri
uriParse :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> [UriFlags] -> m Uri
uriParse Text
uriString [UriFlags]
flags = IO Uri -> m Uri
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Uri -> m Uri) -> IO Uri -> m Uri
forall a b. (a -> b) -> a -> b
$ do
CString
uriString' <- Text -> IO CString
textToCString Text
uriString
let flags' :: CUInt
flags' = [UriFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [UriFlags]
flags
IO Uri -> IO () -> IO Uri
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Uri
result <- (Ptr (Ptr GError) -> IO (Ptr Uri)) -> IO (Ptr Uri)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Uri)) -> IO (Ptr Uri))
-> (Ptr (Ptr GError) -> IO (Ptr Uri)) -> IO (Ptr Uri)
forall a b. (a -> b) -> a -> b
$ CString -> CUInt -> Ptr (Ptr GError) -> IO (Ptr Uri)
g_uri_parse CString
uriString' CUInt
flags'
Text -> Ptr Uri -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"uriParse" Ptr Uri
result
Uri
result' <- ((ManagedPtr Uri -> Uri) -> Ptr Uri -> IO Uri
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Uri -> Uri
Uri) Ptr Uri
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uriString'
Uri -> IO Uri
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Uri
result'
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uriString'
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_parse_params" g_uri_parse_params ::
CString ->
DI.Int64 ->
CString ->
CUInt ->
Ptr (Ptr GError) ->
IO (Ptr (GHashTable CString CString))
uriParseParams ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> DI.Int64
-> T.Text
-> [GLib.Flags.UriParamsFlags]
-> m (Map.Map T.Text T.Text)
uriParseParams :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Int64 -> Text -> [UriParamsFlags] -> m (Map Text Text)
uriParseParams Text
params Int64
length_ Text
separators [UriParamsFlags]
flags = IO (Map Text Text) -> m (Map Text Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Map Text Text) -> m (Map Text Text))
-> IO (Map Text Text) -> m (Map Text Text)
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' = [UriParamsFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [UriParamsFlags]
flags
IO (Map Text Text) -> IO () -> IO (Map Text Text)
forall a b. IO a -> IO b -> IO a
onException (do
Ptr (GHashTable CString CString)
result <- (Ptr (Ptr GError) -> IO (Ptr (GHashTable CString CString)))
-> IO (Ptr (GHashTable CString CString))
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr (GHashTable CString CString)))
-> IO (Ptr (GHashTable CString CString)))
-> (Ptr (Ptr GError) -> IO (Ptr (GHashTable CString CString)))
-> IO (Ptr (GHashTable CString CString))
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'
Text -> Ptr (GHashTable CString CString) -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"uriParseParams" Ptr (GHashTable CString CString)
result
[(PtrWrapped CString, PtrWrapped CString)]
result' <- Ptr (GHashTable CString CString)
-> IO [(PtrWrapped CString, PtrWrapped CString)]
forall a b.
Ptr (GHashTable a b) -> IO [(PtrWrapped a, PtrWrapped b)]
unpackGHashTable Ptr (GHashTable CString CString)
result
let result'' :: [(CString, PtrWrapped CString)]
result'' = (PtrWrapped CString -> CString)
-> [(PtrWrapped CString, PtrWrapped CString)]
-> [(CString, PtrWrapped CString)]
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''' <- (CString -> IO Text)
-> [(CString, PtrWrapped CString)]
-> IO [(Text, PtrWrapped CString)]
forall (f :: * -> *) a c b.
Applicative f =>
(a -> f c) -> [(a, b)] -> f [(c, b)]
mapFirstA HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText [(CString, PtrWrapped CString)]
result''
let result'''' :: [(Text, CString)]
result'''' = (PtrWrapped CString -> CString)
-> [(Text, PtrWrapped CString)] -> [(Text, CString)]
forall b c a. (b -> c) -> [(a, b)] -> [(a, c)]
mapSecond PtrWrapped CString -> CString
B.GHT.cstringUnpackPtr [(Text, PtrWrapped CString)]
result'''
[(Text, Text)]
result''''' <- (CString -> IO Text) -> [(Text, CString)] -> IO [(Text, Text)]
forall (f :: * -> *) b c a.
Applicative f =>
(b -> f c) -> [(a, b)] -> f [(a, c)]
mapSecondA HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText [(Text, CString)]
result''''
let result'''''' :: Map Text Text
result'''''' = [(Text, Text)] -> Map Text Text
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [(Text, Text)]
result'''''
Ptr (GHashTable CString CString) -> IO ()
forall a b. Ptr (GHashTable a b) -> IO ()
unrefGHashTable Ptr (GHashTable CString CString)
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
params'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
separators'
Map Text Text -> IO (Map Text Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Map Text Text
result''''''
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
params'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
separators'
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_parse_scheme" g_uri_parse_scheme ::
CString ->
IO CString
uriParseScheme ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m (Maybe T.Text)
uriParseScheme :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m (Maybe Text)
uriParseScheme Text
uri = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
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 <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result'
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uri'
Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_peek_scheme" g_uri_peek_scheme ::
CString ->
IO CString
uriPeekScheme ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m (Maybe T.Text)
uriPeekScheme :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m (Maybe Text)
uriPeekScheme Text
uri = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
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 <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uri'
Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_resolve_relative" g_uri_resolve_relative ::
CString ->
CString ->
CUInt ->
Ptr (Ptr GError) ->
IO CString
uriResolveRelative ::
(B.CallStack.HasCallStack, MonadIO m) =>
Maybe (T.Text)
-> T.Text
-> [GLib.Flags.UriFlags]
-> m T.Text
uriResolveRelative :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Maybe Text -> Text -> [UriFlags] -> m Text
uriResolveRelative Maybe Text
baseUriString Text
uriRef [UriFlags]
flags = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
CString
maybeBaseUriString <- case Maybe Text
baseUriString of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jBaseUriString -> do
CString
jBaseUriString' <- Text -> IO CString
textToCString Text
jBaseUriString
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jBaseUriString'
CString
uriRef' <- Text -> IO CString
textToCString Text
uriRef
let flags' :: CUInt
flags' = [UriFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [UriFlags]
flags
IO Text -> IO () -> IO Text
forall a b. IO a -> IO b -> IO a
onException (do
CString
result <- (Ptr (Ptr GError) -> IO CString) -> IO CString
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CString) -> IO CString)
-> (Ptr (Ptr GError) -> IO CString) -> IO CString
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'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"uriResolveRelative" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeBaseUriString
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uriRef'
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeBaseUriString
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uriRef'
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_split" g_uri_split ::
CString ->
CUInt ->
Ptr CString ->
Ptr CString ->
Ptr CString ->
Ptr Int32 ->
Ptr CString ->
Ptr CString ->
Ptr CString ->
Ptr (Ptr GError) ->
IO CInt
uriSplit ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> [GLib.Flags.UriFlags]
-> m ((Maybe T.Text, Maybe T.Text, Maybe T.Text, Int32, T.Text, Maybe T.Text, Maybe T.Text))
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 = IO
(Maybe Text, Maybe Text, Maybe Text, Int32, Text, Maybe Text,
Maybe Text)
-> m (Maybe Text, Maybe Text, Maybe Text, Int32, Text, Maybe Text,
Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO
(Maybe Text, Maybe Text, Maybe Text, Int32, Text, Maybe Text,
Maybe Text)
-> m (Maybe Text, Maybe Text, Maybe Text, Int32, Text, Maybe Text,
Maybe Text))
-> IO
(Maybe Text, Maybe Text, Maybe Text, Int32, Text, Maybe Text,
Maybe Text)
-> m (Maybe Text, Maybe Text, Maybe Text, Int32, Text, Maybe Text,
Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
CString
uriRef' <- Text -> IO CString
textToCString Text
uriRef
let flags' :: CUInt
flags' = [UriFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [UriFlags]
flags
Ptr CString
scheme <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr CString
userinfo <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr CString
host <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr Int32
port <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
Ptr CString
path <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr CString
query <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr CString
fragment <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
IO
(Maybe Text, Maybe Text, Maybe Text, Int32, Text, Maybe Text,
Maybe Text)
-> IO ()
-> IO
(Maybe Text, Maybe Text, Maybe Text, Int32, Text, Maybe Text,
Maybe Text)
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
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' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
scheme
Maybe Text
maybeScheme' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
scheme' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
scheme'' -> do
Text
scheme''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
scheme''
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
scheme'''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
scheme'
CString
userinfo' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
userinfo
Maybe Text
maybeUserinfo' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
userinfo' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
userinfo'' -> do
Text
userinfo''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
userinfo''
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
userinfo'''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
userinfo'
CString
host' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
host
Maybe Text
maybeHost' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
host' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
host'' -> do
Text
host''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
host''
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
host'''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
host'
Int32
port' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
port
CString
path' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
path
Text
path'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
path'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
CString
query' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
query
Maybe Text
maybeQuery' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
query' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
query'' -> do
Text
query''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
query''
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
query'''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
query'
CString
fragment' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
fragment
Maybe Text
maybeFragment' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
fragment' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
fragment'' -> do
Text
fragment''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
fragment''
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
fragment'''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
fragment'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uriRef'
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
scheme
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
userinfo
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
host
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
port
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
path
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
query
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
fragment
(Maybe Text, Maybe Text, Maybe Text, Int32, Text, Maybe Text,
Maybe Text)
-> IO
(Maybe Text, Maybe Text, Maybe Text, Int32, Text, Maybe Text,
Maybe Text)
forall a. a -> IO a
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
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uriRef'
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
scheme
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
userinfo
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
host
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
port
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
path
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
query
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
fragment
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_split_network" g_uri_split_network ::
CString ->
CUInt ->
Ptr CString ->
Ptr CString ->
Ptr Int32 ->
Ptr (Ptr GError) ->
IO CInt
uriSplitNetwork ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> [GLib.Flags.UriFlags]
-> m ((Maybe T.Text, Maybe T.Text, Int32))
uriSplitNetwork :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> [UriFlags] -> m (Maybe Text, Maybe Text, Int32)
uriSplitNetwork Text
uriString [UriFlags]
flags = IO (Maybe Text, Maybe Text, Int32)
-> m (Maybe Text, Maybe Text, Int32)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text, Maybe Text, Int32)
-> m (Maybe Text, Maybe Text, Int32))
-> IO (Maybe Text, Maybe Text, Int32)
-> m (Maybe Text, Maybe Text, Int32)
forall a b. (a -> b) -> a -> b
$ do
CString
uriString' <- Text -> IO CString
textToCString Text
uriString
let flags' :: CUInt
flags' = [UriFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [UriFlags]
flags
Ptr CString
scheme <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr CString
host <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr Int32
port <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
IO (Maybe Text, Maybe Text, Int32)
-> IO () -> IO (Maybe Text, Maybe Text, Int32)
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
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' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
scheme
Maybe Text
maybeScheme' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
scheme' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
scheme'' -> do
Text
scheme''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
scheme''
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
scheme'''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
scheme'
CString
host' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
host
Maybe Text
maybeHost' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
host' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
host'' -> do
Text
host''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
host''
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
host'''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
host'
Int32
port' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
port
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uriString'
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
scheme
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
host
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
port
(Maybe Text, Maybe Text, Int32)
-> IO (Maybe Text, Maybe Text, Int32)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Text
maybeScheme', Maybe Text
maybeHost', Int32
port')
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uriString'
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
scheme
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
host
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
port
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_split_with_user" g_uri_split_with_user ::
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
uriSplitWithUser ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> [GLib.Flags.UriFlags]
-> 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))
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 = IO
(Maybe Text, Maybe Text, Maybe Text, Maybe Text, Maybe Text, Int32,
Text, Maybe Text, Maybe Text)
-> m (Maybe Text, Maybe Text, Maybe Text, Maybe Text, Maybe Text,
Int32, Text, Maybe Text, Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO
(Maybe Text, Maybe Text, Maybe Text, Maybe Text, Maybe Text, Int32,
Text, Maybe Text, Maybe Text)
-> m (Maybe Text, Maybe Text, Maybe Text, Maybe Text, Maybe Text,
Int32, Text, Maybe Text, Maybe Text))
-> IO
(Maybe Text, Maybe Text, Maybe Text, Maybe Text, Maybe Text, Int32,
Text, Maybe Text, Maybe Text)
-> m (Maybe Text, Maybe Text, Maybe Text, Maybe Text, Maybe Text,
Int32, Text, Maybe Text, Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
CString
uriRef' <- Text -> IO CString
textToCString Text
uriRef
let flags' :: CUInt
flags' = [UriFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [UriFlags]
flags
Ptr CString
scheme <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr CString
user <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr CString
password <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr CString
authParams <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr CString
host <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr Int32
port <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
Ptr CString
path <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr CString
query <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr CString
fragment <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
IO
(Maybe Text, Maybe Text, Maybe Text, Maybe Text, Maybe Text, Int32,
Text, Maybe Text, Maybe Text)
-> IO ()
-> IO
(Maybe Text, Maybe Text, Maybe Text, Maybe Text, Maybe Text, Int32,
Text, Maybe Text, Maybe Text)
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
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' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
scheme
Maybe Text
maybeScheme' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
scheme' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
scheme'' -> do
Text
scheme''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
scheme''
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
scheme'''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
scheme'
CString
user' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
user
Maybe Text
maybeUser' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
user' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
user'' -> do
Text
user''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
user''
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
user'''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
user'
CString
password' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
password
Maybe Text
maybePassword' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
password' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
password'' -> do
Text
password''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
password''
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
password'''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
password'
CString
authParams' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
authParams
Maybe Text
maybeAuthParams' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
authParams' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
authParams'' -> do
Text
authParams''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
authParams''
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
authParams'''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
authParams'
CString
host' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
host
Maybe Text
maybeHost' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
host' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
host'' -> do
Text
host''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
host''
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
host'''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
host'
Int32
port' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
port
CString
path' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
path
Text
path'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
path'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
CString
query' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
query
Maybe Text
maybeQuery' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
query' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
query'' -> do
Text
query''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
query''
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
query'''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
query'
CString
fragment' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
fragment
Maybe Text
maybeFragment' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
fragment' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
fragment'' -> do
Text
fragment''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
fragment''
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
fragment'''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
fragment'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uriRef'
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
scheme
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
user
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
password
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
authParams
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
host
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
port
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
path
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
query
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
fragment
(Maybe Text, Maybe Text, Maybe Text, Maybe Text, Maybe Text, Int32,
Text, Maybe Text, Maybe Text)
-> IO
(Maybe Text, Maybe Text, Maybe Text, Maybe Text, Maybe Text, Int32,
Text, Maybe Text, Maybe Text)
forall a. a -> IO a
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
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uriRef'
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
scheme
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
user
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
password
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
authParams
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
host
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
port
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
path
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
query
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
fragment
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_unescape_bytes" g_uri_unescape_bytes ::
CString ->
DI.Int64 ->
CString ->
Ptr (Ptr GError) ->
IO (Ptr GLib.Bytes.Bytes)
uriUnescapeBytes ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> DI.Int64
-> Maybe (T.Text)
-> m GLib.Bytes.Bytes
uriUnescapeBytes :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Int64 -> Maybe Text -> m Bytes
uriUnescapeBytes Text
escapedString Int64
length_ Maybe Text
illegalCharacters = IO Bytes -> m Bytes
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bytes -> m Bytes) -> IO Bytes -> m Bytes
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 -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jIllegalCharacters -> do
CString
jIllegalCharacters' <- Text -> IO CString
textToCString Text
jIllegalCharacters
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jIllegalCharacters'
IO Bytes -> IO () -> IO Bytes
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Bytes
result <- (Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes))
-> (Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes)
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
Text -> Ptr Bytes -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"uriUnescapeBytes" Ptr Bytes
result
Bytes
result' <- ((ManagedPtr Bytes -> Bytes) -> Ptr Bytes -> IO Bytes
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Bytes -> Bytes
GLib.Bytes.Bytes) Ptr Bytes
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
escapedString'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeIllegalCharacters
Bytes -> IO Bytes
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bytes
result'
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
escapedString'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeIllegalCharacters
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_unescape_segment" g_uri_unescape_segment ::
CString ->
CString ->
CString ->
IO CString
uriUnescapeSegment ::
(B.CallStack.HasCallStack, MonadIO m) =>
Maybe (T.Text)
-> Maybe (T.Text)
-> Maybe (T.Text)
-> m (Maybe T.Text)
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 = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
CString
maybeEscapedString <- case Maybe Text
escapedString of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jEscapedString -> do
CString
jEscapedString' <- Text -> IO CString
textToCString Text
jEscapedString
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jEscapedString'
CString
maybeEscapedStringEnd <- case Maybe Text
escapedStringEnd of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jEscapedStringEnd -> do
CString
jEscapedStringEnd' <- Text -> IO CString
textToCString Text
jEscapedStringEnd
CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jEscapedStringEnd'
CString
maybeIllegalCharacters <- case Maybe Text
illegalCharacters of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jIllegalCharacters -> do
CString
jIllegalCharacters' <- Text -> IO CString
textToCString Text
jIllegalCharacters
CString -> IO CString
forall a. a -> IO a
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 <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result'
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeEscapedString
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeEscapedStringEnd
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeIllegalCharacters
Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_uri_unescape_string" g_uri_unescape_string ::
CString ->
CString ->
IO CString
uriUnescapeString ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> Maybe (T.Text)
-> m (Maybe T.Text)
uriUnescapeString :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Maybe Text -> m (Maybe Text)
uriUnescapeString Text
escapedString Maybe Text
illegalCharacters = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
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 -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jIllegalCharacters -> do
CString
jIllegalCharacters' <- Text -> IO CString
textToCString Text
jIllegalCharacters
CString -> IO CString
forall a. a -> IO a
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 <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result'
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
escapedString'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeIllegalCharacters
Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
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