{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

/No description available in the introspection data./
-}

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

module GI.WebKit2.Structs.WebViewSessionState
    (

-- * Exported types
    WebViewSessionState(..)                 ,
    noWebViewSessionState                   ,


 -- * Methods
-- ** new #method:new#

    webViewSessionStateNew                  ,


-- ** ref #method:ref#

#if ENABLE_OVERLOADING
    WebViewSessionStateRefMethodInfo        ,
#endif
    webViewSessionStateRef                  ,


-- ** serialize #method:serialize#

#if ENABLE_OVERLOADING
    WebViewSessionStateSerializeMethodInfo  ,
#endif
    webViewSessionStateSerialize            ,


-- ** unref #method:unref#

#if ENABLE_OVERLOADING
    WebViewSessionStateUnrefMethodInfo      ,
#endif
    webViewSessionStateUnref                ,




    ) 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.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.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.Bytes as GLib.Bytes

-- | Memory-managed wrapper type.
newtype WebViewSessionState = WebViewSessionState (ManagedPtr WebViewSessionState)
foreign import ccall "webkit_web_view_session_state_get_type" c_webkit_web_view_session_state_get_type ::
    IO GType

instance BoxedObject WebViewSessionState where
    boxedType _ = c_webkit_web_view_session_state_get_type

-- | A convenience alias for `Nothing` :: `Maybe` `WebViewSessionState`.
noWebViewSessionState :: Maybe WebViewSessionState
noWebViewSessionState = Nothing


#if ENABLE_OVERLOADING
instance O.HasAttributeList WebViewSessionState
type instance O.AttributeList WebViewSessionState = WebViewSessionStateAttributeList
type WebViewSessionStateAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method WebViewSessionState::new
-- method type : Constructor
-- Args : [Arg {argCName = "data", argType = TInterface (Name {namespace = "GLib", name = "Bytes"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBytes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "WebViewSessionState"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_view_session_state_new" webkit_web_view_session_state_new ::
    Ptr GLib.Bytes.Bytes ->                 -- data : TInterface (Name {namespace = "GLib", name = "Bytes"})
    IO (Ptr WebViewSessionState)

{- |
Creates a new 'GI.WebKit2.Structs.WebViewSessionState.WebViewSessionState' from serialized data.

/Since: 2.12/
-}
webViewSessionStateNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.Bytes.Bytes
    {- ^ /@data@/: a 'GI.GLib.Structs.Bytes.Bytes' -}
    -> m WebViewSessionState
    {- ^ __Returns:__ a new 'GI.WebKit2.Structs.WebViewSessionState.WebViewSessionState', or 'Nothing' if /@data@/ doesn\'t contain a
    valid serialized 'GI.WebKit2.Structs.WebViewSessionState.WebViewSessionState'. -}
webViewSessionStateNew data_ = liftIO $ do
    data_' <- unsafeManagedPtrGetPtr data_
    result <- webkit_web_view_session_state_new data_'
    checkUnexpectedReturnNULL "webViewSessionStateNew" result
    result' <- (wrapBoxed WebViewSessionState) result
    touchManagedPtr data_
    return result'

#if ENABLE_OVERLOADING
#endif

-- method WebViewSessionState::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "state", argType = TInterface (Name {namespace = "WebKit2", name = "WebViewSessionState"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitWebViewSessionState", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "WebViewSessionState"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_view_session_state_ref" webkit_web_view_session_state_ref ::
    Ptr WebViewSessionState ->              -- state : TInterface (Name {namespace = "WebKit2", name = "WebViewSessionState"})
    IO (Ptr WebViewSessionState)

{- |
Atomically increments the reference count of /@state@/ by one. This
function is MT-safe and may be called from any thread.

/Since: 2.12/
-}
webViewSessionStateRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    WebViewSessionState
    {- ^ /@state@/: a 'GI.WebKit2.Structs.WebViewSessionState.WebViewSessionState' -}
    -> m WebViewSessionState
    {- ^ __Returns:__ The passed in 'GI.WebKit2.Structs.WebViewSessionState.WebViewSessionState' -}
webViewSessionStateRef state = liftIO $ do
    state' <- unsafeManagedPtrGetPtr state
    result <- webkit_web_view_session_state_ref state'
    checkUnexpectedReturnNULL "webViewSessionStateRef" result
    result' <- (wrapBoxed WebViewSessionState) result
    touchManagedPtr state
    return result'

#if ENABLE_OVERLOADING
data WebViewSessionStateRefMethodInfo
instance (signature ~ (m WebViewSessionState), MonadIO m) => O.MethodInfo WebViewSessionStateRefMethodInfo WebViewSessionState signature where
    overloadedMethod _ = webViewSessionStateRef

#endif

-- method WebViewSessionState::serialize
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "state", argType = TInterface (Name {namespace = "WebKit2", name = "WebViewSessionState"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitWebViewSessionState", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "Bytes"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_view_session_state_serialize" webkit_web_view_session_state_serialize ::
    Ptr WebViewSessionState ->              -- state : TInterface (Name {namespace = "WebKit2", name = "WebViewSessionState"})
    IO (Ptr GLib.Bytes.Bytes)

{- |
Serializes a 'GI.WebKit2.Structs.WebViewSessionState.WebViewSessionState'.

/Since: 2.12/
-}
webViewSessionStateSerialize ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    WebViewSessionState
    {- ^ /@state@/: a 'GI.WebKit2.Structs.WebViewSessionState.WebViewSessionState' -}
    -> m GLib.Bytes.Bytes
    {- ^ __Returns:__ a 'GI.GLib.Structs.Bytes.Bytes' containing the /@state@/ serialized. -}
webViewSessionStateSerialize state = liftIO $ do
    state' <- unsafeManagedPtrGetPtr state
    result <- webkit_web_view_session_state_serialize state'
    checkUnexpectedReturnNULL "webViewSessionStateSerialize" result
    result' <- (wrapBoxed GLib.Bytes.Bytes) result
    touchManagedPtr state
    return result'

#if ENABLE_OVERLOADING
data WebViewSessionStateSerializeMethodInfo
instance (signature ~ (m GLib.Bytes.Bytes), MonadIO m) => O.MethodInfo WebViewSessionStateSerializeMethodInfo WebViewSessionState signature where
    overloadedMethod _ = webViewSessionStateSerialize

#endif

-- method WebViewSessionState::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "state", argType = TInterface (Name {namespace = "WebKit2", name = "WebViewSessionState"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitWebViewSessionState", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_web_view_session_state_unref" webkit_web_view_session_state_unref ::
    Ptr WebViewSessionState ->              -- state : TInterface (Name {namespace = "WebKit2", name = "WebViewSessionState"})
    IO ()

{- |
Atomically decrements the reference count of /@state@/ by one. If the
reference count drops to 0, all memory allocated by the 'GI.WebKit2.Structs.WebViewSessionState.WebViewSessionState' is
released. This function is MT-safe and may be called from any thread.

/Since: 2.12/
-}
webViewSessionStateUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    WebViewSessionState
    {- ^ /@state@/: a 'GI.WebKit2.Structs.WebViewSessionState.WebViewSessionState' -}
    -> m ()
webViewSessionStateUnref state = liftIO $ do
    state' <- unsafeManagedPtrGetPtr state
    webkit_web_view_session_state_unref state'
    touchManagedPtr state
    return ()

#if ENABLE_OVERLOADING
data WebViewSessionStateUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo WebViewSessionStateUnrefMethodInfo WebViewSessionState signature where
    overloadedMethod _ = webViewSessionStateUnref

#endif

#if ENABLE_OVERLOADING
type family ResolveWebViewSessionStateMethod (t :: Symbol) (o :: *) :: * where
    ResolveWebViewSessionStateMethod "ref" o = WebViewSessionStateRefMethodInfo
    ResolveWebViewSessionStateMethod "serialize" o = WebViewSessionStateSerializeMethodInfo
    ResolveWebViewSessionStateMethod "unref" o = WebViewSessionStateUnrefMethodInfo
    ResolveWebViewSessionStateMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveWebViewSessionStateMethod t WebViewSessionState, O.MethodInfo info WebViewSessionState p) => OL.IsLabel t (WebViewSessionState -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif