{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Soup.Interfaces.ProxyResolver
(
ProxyResolver(..) ,
IsProxyResolver ,
toProxyResolver ,
#if defined(ENABLE_OVERLOADING)
ResolveProxyResolverMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
ProxyResolverGetProxyAsyncMethodInfo ,
#endif
proxyResolverGetProxyAsync ,
#if defined(ENABLE_OVERLOADING)
ProxyResolverGetProxySyncMethodInfo ,
#endif
proxyResolverGetProxySync ,
) 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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
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.Text as T
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 GI.GLib.Structs.MainContext as GLib.MainContext
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Soup.Callbacks as Soup.Callbacks
import {-# SOURCE #-} qualified GI.Soup.Interfaces.SessionFeature as Soup.SessionFeature
import {-# SOURCE #-} qualified GI.Soup.Objects.Address as Soup.Address
import {-# SOURCE #-} qualified GI.Soup.Objects.Message as Soup.Message
newtype ProxyResolver = ProxyResolver (SP.ManagedPtr ProxyResolver)
deriving (ProxyResolver -> ProxyResolver -> Bool
(ProxyResolver -> ProxyResolver -> Bool)
-> (ProxyResolver -> ProxyResolver -> Bool) -> Eq ProxyResolver
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProxyResolver -> ProxyResolver -> Bool
$c/= :: ProxyResolver -> ProxyResolver -> Bool
== :: ProxyResolver -> ProxyResolver -> Bool
$c== :: ProxyResolver -> ProxyResolver -> Bool
Eq)
instance SP.ManagedPtrNewtype ProxyResolver where
toManagedPtr :: ProxyResolver -> ManagedPtr ProxyResolver
toManagedPtr (ProxyResolver ManagedPtr ProxyResolver
p) = ManagedPtr ProxyResolver
p
foreign import ccall "soup_proxy_resolver_get_type"
c_soup_proxy_resolver_get_type :: IO B.Types.GType
instance B.Types.TypedObject ProxyResolver where
glibType :: IO GType
glibType = IO GType
c_soup_proxy_resolver_get_type
instance B.Types.GObject ProxyResolver
instance B.GValue.IsGValue ProxyResolver where
toGValue :: ProxyResolver -> IO GValue
toGValue ProxyResolver
o = do
GType
gtype <- IO GType
c_soup_proxy_resolver_get_type
ProxyResolver -> (Ptr ProxyResolver -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr ProxyResolver
o (GType
-> (GValue -> Ptr ProxyResolver -> IO ())
-> Ptr ProxyResolver
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr ProxyResolver -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO ProxyResolver
fromGValue GValue
gv = do
Ptr ProxyResolver
ptr <- GValue -> IO (Ptr ProxyResolver)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr ProxyResolver)
(ManagedPtr ProxyResolver -> ProxyResolver)
-> Ptr ProxyResolver -> IO ProxyResolver
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr ProxyResolver -> ProxyResolver
ProxyResolver Ptr ProxyResolver
ptr
class (SP.GObject o, O.IsDescendantOf ProxyResolver o) => IsProxyResolver o
instance (SP.GObject o, O.IsDescendantOf ProxyResolver o) => IsProxyResolver o
instance O.HasParentTypes ProxyResolver
type instance O.ParentTypes ProxyResolver = '[Soup.SessionFeature.SessionFeature, GObject.Object.Object]
toProxyResolver :: (MonadIO m, IsProxyResolver o) => o -> m ProxyResolver
toProxyResolver :: o -> m ProxyResolver
toProxyResolver = IO ProxyResolver -> m ProxyResolver
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ProxyResolver -> m ProxyResolver)
-> (o -> IO ProxyResolver) -> o -> m ProxyResolver
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr ProxyResolver -> ProxyResolver)
-> o -> IO ProxyResolver
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr ProxyResolver -> ProxyResolver
ProxyResolver
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ProxyResolver
type instance O.AttributeList ProxyResolver = ProxyResolverAttributeList
type ProxyResolverAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveProxyResolverMethod (t :: Symbol) (o :: *) :: * where
ResolveProxyResolverMethod "addFeature" o = Soup.SessionFeature.SessionFeatureAddFeatureMethodInfo
ResolveProxyResolverMethod "attach" o = Soup.SessionFeature.SessionFeatureAttachMethodInfo
ResolveProxyResolverMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveProxyResolverMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveProxyResolverMethod "detach" o = Soup.SessionFeature.SessionFeatureDetachMethodInfo
ResolveProxyResolverMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveProxyResolverMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveProxyResolverMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveProxyResolverMethod "hasFeature" o = Soup.SessionFeature.SessionFeatureHasFeatureMethodInfo
ResolveProxyResolverMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveProxyResolverMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveProxyResolverMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveProxyResolverMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveProxyResolverMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveProxyResolverMethod "removeFeature" o = Soup.SessionFeature.SessionFeatureRemoveFeatureMethodInfo
ResolveProxyResolverMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveProxyResolverMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveProxyResolverMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveProxyResolverMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveProxyResolverMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveProxyResolverMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveProxyResolverMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveProxyResolverMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveProxyResolverMethod "getProxyAsync" o = ProxyResolverGetProxyAsyncMethodInfo
ResolveProxyResolverMethod "getProxySync" o = ProxyResolverGetProxySyncMethodInfo
ResolveProxyResolverMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveProxyResolverMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveProxyResolverMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveProxyResolverMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveProxyResolverMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveProxyResolverMethod t ProxyResolver, O.MethodInfo info ProxyResolver p) => OL.IsLabel t (ProxyResolver -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
foreign import ccall "soup_proxy_resolver_get_proxy_async" soup_proxy_resolver_get_proxy_async ::
Ptr ProxyResolver ->
Ptr Soup.Message.Message ->
Ptr GLib.MainContext.MainContext ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Soup.Callbacks.C_ProxyResolverCallback ->
Ptr () ->
IO ()
{-# DEPRECATED proxyResolverGetProxyAsync ["(Since version 2.28)","Use SoupProxyURIResolver.get_proxy_uri_async instead"] #-}
proxyResolverGetProxyAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsProxyResolver a, Soup.Message.IsMessage b, Gio.Cancellable.IsCancellable c) =>
a
-> b
-> GLib.MainContext.MainContext
-> Maybe (c)
-> Soup.Callbacks.ProxyResolverCallback
-> m ()
proxyResolverGetProxyAsync :: a -> b -> MainContext -> Maybe c -> ProxyResolverCallback -> m ()
proxyResolverGetProxyAsync a
proxyResolver b
msg MainContext
asyncContext Maybe c
cancellable ProxyResolverCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr ProxyResolver
proxyResolver' <- a -> IO (Ptr ProxyResolver)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
proxyResolver
Ptr Message
msg' <- b -> IO (Ptr Message)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
msg
Ptr MainContext
asyncContext' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
asyncContext
Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
Ptr (FunPtr C_ProxyResolverCallback)
ptrcallback <- IO (Ptr (FunPtr C_ProxyResolverCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Soup.Callbacks.C_ProxyResolverCallback))
FunPtr C_ProxyResolverCallback
callback' <- C_ProxyResolverCallback -> IO (FunPtr C_ProxyResolverCallback)
Soup.Callbacks.mk_ProxyResolverCallback (Maybe (Ptr (FunPtr C_ProxyResolverCallback))
-> ProxyResolverCallback_WithClosures -> C_ProxyResolverCallback
Soup.Callbacks.wrap_ProxyResolverCallback (Ptr (FunPtr C_ProxyResolverCallback)
-> Maybe (Ptr (FunPtr C_ProxyResolverCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_ProxyResolverCallback)
ptrcallback) (ProxyResolverCallback -> ProxyResolverCallback_WithClosures
Soup.Callbacks.drop_closures_ProxyResolverCallback ProxyResolverCallback
callback))
Ptr (FunPtr C_ProxyResolverCallback)
-> FunPtr C_ProxyResolverCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_ProxyResolverCallback)
ptrcallback FunPtr C_ProxyResolverCallback
callback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr ProxyResolver
-> Ptr Message
-> Ptr MainContext
-> Ptr Cancellable
-> FunPtr C_ProxyResolverCallback
-> Ptr ()
-> IO ()
soup_proxy_resolver_get_proxy_async Ptr ProxyResolver
proxyResolver' Ptr Message
msg' Ptr MainContext
asyncContext' Ptr Cancellable
maybeCancellable FunPtr C_ProxyResolverCallback
callback' Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
proxyResolver
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
msg
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
asyncContext
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data ProxyResolverGetProxyAsyncMethodInfo
instance (signature ~ (b -> GLib.MainContext.MainContext -> Maybe (c) -> Soup.Callbacks.ProxyResolverCallback -> m ()), MonadIO m, IsProxyResolver a, Soup.Message.IsMessage b, Gio.Cancellable.IsCancellable c) => O.MethodInfo ProxyResolverGetProxyAsyncMethodInfo a signature where
overloadedMethod = proxyResolverGetProxyAsync
#endif
foreign import ccall "soup_proxy_resolver_get_proxy_sync" soup_proxy_resolver_get_proxy_sync ::
Ptr ProxyResolver ->
Ptr Soup.Message.Message ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr Soup.Address.Address) ->
IO Word32
{-# DEPRECATED proxyResolverGetProxySync ["(Since version 2.28)","Use SoupProxyURIResolver.@/get_proxy_uri_sync()/@ instead"] #-}
proxyResolverGetProxySync ::
(B.CallStack.HasCallStack, MonadIO m, IsProxyResolver a, Soup.Message.IsMessage b, Gio.Cancellable.IsCancellable c) =>
a
-> b
-> Maybe (c)
-> m ((Word32, Soup.Address.Address))
proxyResolverGetProxySync :: a -> b -> Maybe c -> m (Word32, Address)
proxyResolverGetProxySync a
proxyResolver b
msg Maybe c
cancellable = IO (Word32, Address) -> m (Word32, Address)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Word32, Address) -> m (Word32, Address))
-> IO (Word32, Address) -> m (Word32, Address)
forall a b. (a -> b) -> a -> b
$ do
Ptr ProxyResolver
proxyResolver' <- a -> IO (Ptr ProxyResolver)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
proxyResolver
Ptr Message
msg' <- b -> IO (Ptr Message)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
msg
Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
Ptr (Ptr Address)
addr <- IO (Ptr (Ptr Address))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Soup.Address.Address))
Word32
result <- Ptr ProxyResolver
-> Ptr Message -> Ptr Cancellable -> Ptr (Ptr Address) -> IO Word32
soup_proxy_resolver_get_proxy_sync Ptr ProxyResolver
proxyResolver' Ptr Message
msg' Ptr Cancellable
maybeCancellable Ptr (Ptr Address)
addr
Ptr Address
addr' <- Ptr (Ptr Address) -> IO (Ptr Address)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Address)
addr
Address
addr'' <- ((ManagedPtr Address -> Address) -> Ptr Address -> IO Address
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Address -> Address
Soup.Address.Address) Ptr Address
addr'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
proxyResolver
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
msg
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr (Ptr Address) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Address)
addr
(Word32, Address) -> IO (Word32, Address)
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32
result, Address
addr'')
#if defined(ENABLE_OVERLOADING)
data ProxyResolverGetProxySyncMethodInfo
instance (signature ~ (b -> Maybe (c) -> m ((Word32, Soup.Address.Address))), MonadIO m, IsProxyResolver a, Soup.Message.IsMessage b, Gio.Cancellable.IsCancellable c) => O.MethodInfo ProxyResolverGetProxySyncMethodInfo a signature where
overloadedMethod = proxyResolverGetProxySync
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList ProxyResolver = ProxyResolverSignalList
type ProxyResolverSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif