{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Soup.Objects.ContentDecoder
    ( 

-- * Exported types
    ContentDecoder(..)                      ,
    IsContentDecoder                        ,
    toContentDecoder                        ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [addFeature]("GI.Soup.Interfaces.SessionFeature#g:method:addFeature"), [attach]("GI.Soup.Interfaces.SessionFeature#g:method:attach"), [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [detach]("GI.Soup.Interfaces.SessionFeature#g:method:detach"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [hasFeature]("GI.Soup.Interfaces.SessionFeature#g:method:hasFeature"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [removeFeature]("GI.Soup.Interfaces.SessionFeature#g:method:removeFeature"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getData]("GI.GObject.Objects.Object#g:method:getData"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveContentDecoderMethod             ,
#endif



    ) 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

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GLib.Structs.MainContext as GLib.MainContext
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Enums as Gio.Enums
import qualified GI.Gio.Flags as Gio.Flags
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Interfaces.Initable as Gio.Initable
import qualified GI.Gio.Interfaces.ProxyResolver as Gio.ProxyResolver
import qualified GI.Gio.Interfaces.SocketConnectable as Gio.SocketConnectable
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Gio.Objects.IOStream as Gio.IOStream
import qualified GI.Gio.Objects.InputStream as Gio.InputStream
import qualified GI.Gio.Objects.Socket as Gio.Socket
import qualified GI.Gio.Objects.SocketAddress as Gio.SocketAddress
import qualified GI.Gio.Objects.TlsCertificate as Gio.TlsCertificate
import qualified GI.Gio.Objects.TlsDatabase as Gio.TlsDatabase
import qualified GI.Gio.Objects.TlsInteraction as Gio.TlsInteraction
import qualified GI.Soup.Callbacks as Soup.Callbacks
import {-# SOURCE #-} qualified GI.Soup.Enums as Soup.Enums
import {-# SOURCE #-} qualified GI.Soup.Flags as Soup.Flags
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.Auth as Soup.Auth
import {-# SOURCE #-} qualified GI.Soup.Objects.Message as Soup.Message
import {-# SOURCE #-} qualified GI.Soup.Objects.Request as Soup.Request
import {-# SOURCE #-} qualified GI.Soup.Objects.RequestHTTP as Soup.RequestHTTP
import {-# SOURCE #-} qualified GI.Soup.Objects.Session as Soup.Session
import {-# SOURCE #-} qualified GI.Soup.Objects.Socket as Soup.Socket
import {-# SOURCE #-} qualified GI.Soup.Objects.WebsocketConnection as Soup.WebsocketConnection
import {-# SOURCE #-} qualified GI.Soup.Objects.WebsocketExtension as Soup.WebsocketExtension
import {-# SOURCE #-} qualified GI.Soup.Structs.Buffer as Soup.Buffer
import {-# SOURCE #-} qualified GI.Soup.Structs.MessageBody as Soup.MessageBody
import {-# SOURCE #-} qualified GI.Soup.Structs.MessageHeaders as Soup.MessageHeaders
import {-# SOURCE #-} qualified GI.Soup.Structs.Range as Soup.Range
import {-# SOURCE #-} qualified GI.Soup.Structs.URI as Soup.URI

#else
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Soup.Interfaces.SessionFeature as Soup.SessionFeature

#endif

-- | Memory-managed wrapper type.
newtype ContentDecoder = ContentDecoder (SP.ManagedPtr ContentDecoder)
    deriving (ContentDecoder -> ContentDecoder -> Bool
(ContentDecoder -> ContentDecoder -> Bool)
-> (ContentDecoder -> ContentDecoder -> Bool) -> Eq ContentDecoder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ContentDecoder -> ContentDecoder -> Bool
== :: ContentDecoder -> ContentDecoder -> Bool
$c/= :: ContentDecoder -> ContentDecoder -> Bool
/= :: ContentDecoder -> ContentDecoder -> Bool
Eq)

instance SP.ManagedPtrNewtype ContentDecoder where
    toManagedPtr :: ContentDecoder -> ManagedPtr ContentDecoder
toManagedPtr (ContentDecoder ManagedPtr ContentDecoder
p) = ManagedPtr ContentDecoder
p

foreign import ccall "soup_content_decoder_get_type"
    c_soup_content_decoder_get_type :: IO B.Types.GType

instance B.Types.TypedObject ContentDecoder where
    glibType :: IO GType
glibType = IO GType
c_soup_content_decoder_get_type

instance B.Types.GObject ContentDecoder

-- | Type class for types which can be safely cast to `ContentDecoder`, for instance with `toContentDecoder`.
class (SP.GObject o, O.IsDescendantOf ContentDecoder o) => IsContentDecoder o
instance (SP.GObject o, O.IsDescendantOf ContentDecoder o) => IsContentDecoder o

instance O.HasParentTypes ContentDecoder
type instance O.ParentTypes ContentDecoder = '[GObject.Object.Object, Soup.SessionFeature.SessionFeature]

-- | Cast to `ContentDecoder`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toContentDecoder :: (MIO.MonadIO m, IsContentDecoder o) => o -> m ContentDecoder
toContentDecoder :: forall (m :: * -> *) o.
(MonadIO m, IsContentDecoder o) =>
o -> m ContentDecoder
toContentDecoder = IO ContentDecoder -> m ContentDecoder
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO ContentDecoder -> m ContentDecoder)
-> (o -> IO ContentDecoder) -> o -> m ContentDecoder
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr ContentDecoder -> ContentDecoder)
-> o -> IO ContentDecoder
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr ContentDecoder -> ContentDecoder
ContentDecoder

-- | Convert 'ContentDecoder' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe ContentDecoder) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_soup_content_decoder_get_type
    gvalueSet_ :: Ptr GValue -> Maybe ContentDecoder -> IO ()
gvalueSet_ Ptr GValue
gv Maybe ContentDecoder
P.Nothing = Ptr GValue -> Ptr ContentDecoder -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr ContentDecoder
forall a. Ptr a
FP.nullPtr :: FP.Ptr ContentDecoder)
    gvalueSet_ Ptr GValue
gv (P.Just ContentDecoder
obj) = ContentDecoder -> (Ptr ContentDecoder -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr ContentDecoder
obj (Ptr GValue -> Ptr ContentDecoder -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe ContentDecoder)
gvalueGet_ Ptr GValue
gv = do
        Ptr ContentDecoder
ptr <- Ptr GValue -> IO (Ptr ContentDecoder)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr ContentDecoder)
        if Ptr ContentDecoder
ptr Ptr ContentDecoder -> Ptr ContentDecoder -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr ContentDecoder
forall a. Ptr a
FP.nullPtr
        then ContentDecoder -> Maybe ContentDecoder
forall a. a -> Maybe a
P.Just (ContentDecoder -> Maybe ContentDecoder)
-> IO ContentDecoder -> IO (Maybe ContentDecoder)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr ContentDecoder -> ContentDecoder)
-> Ptr ContentDecoder -> IO ContentDecoder
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr ContentDecoder -> ContentDecoder
ContentDecoder Ptr ContentDecoder
ptr
        else Maybe ContentDecoder -> IO (Maybe ContentDecoder)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe ContentDecoder
forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveContentDecoderMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveContentDecoderMethod "addFeature" o = Soup.SessionFeature.SessionFeatureAddFeatureMethodInfo
    ResolveContentDecoderMethod "attach" o = Soup.SessionFeature.SessionFeatureAttachMethodInfo
    ResolveContentDecoderMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveContentDecoderMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveContentDecoderMethod "detach" o = Soup.SessionFeature.SessionFeatureDetachMethodInfo
    ResolveContentDecoderMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveContentDecoderMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveContentDecoderMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveContentDecoderMethod "hasFeature" o = Soup.SessionFeature.SessionFeatureHasFeatureMethodInfo
    ResolveContentDecoderMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveContentDecoderMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveContentDecoderMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveContentDecoderMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveContentDecoderMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveContentDecoderMethod "removeFeature" o = Soup.SessionFeature.SessionFeatureRemoveFeatureMethodInfo
    ResolveContentDecoderMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveContentDecoderMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveContentDecoderMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveContentDecoderMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveContentDecoderMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveContentDecoderMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveContentDecoderMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveContentDecoderMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveContentDecoderMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveContentDecoderMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveContentDecoderMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveContentDecoderMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveContentDecoderMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveContentDecoderMethod t ContentDecoder, O.OverloadedMethod info ContentDecoder p) => OL.IsLabel t (ContentDecoder -> 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 ~ ResolveContentDecoderMethod t ContentDecoder, O.OverloadedMethod info ContentDecoder p, R.HasField t ContentDecoder p) => R.HasField t ContentDecoder p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveContentDecoderMethod t ContentDecoder, O.OverloadedMethodInfo info ContentDecoder) => OL.IsLabel t (O.MethodProxy info ContentDecoder) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ContentDecoder
type instance O.AttributeList ContentDecoder = ContentDecoderAttributeList
type ContentDecoderAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList ContentDecoder = ContentDecoderSignalList
type ContentDecoderSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])

#endif