#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gio.Structs.StaticResource
(
StaticResource(..) ,
newZeroStaticResource ,
noStaticResource ,
#if ENABLE_OVERLOADING
StaticResourceFiniMethodInfo ,
#endif
staticResourceFini ,
#if ENABLE_OVERLOADING
StaticResourceGetResourceMethodInfo ,
#endif
staticResourceGetResource ,
#if ENABLE_OVERLOADING
StaticResourceInitMethodInfo ,
#endif
staticResourceInit ,
) 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 {-# SOURCE #-} qualified GI.Gio.Structs.Resource as Gio.Resource
newtype StaticResource = StaticResource (ManagedPtr StaticResource)
instance WrappedPtr StaticResource where
wrappedPtrCalloc = callocBytes 40
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 40 >=> wrapPtr StaticResource)
wrappedPtrFree = Just ptr_to_g_free
newZeroStaticResource :: MonadIO m => m StaticResource
newZeroStaticResource = liftIO $ wrappedPtrCalloc >>= wrapPtr StaticResource
instance tag ~ 'AttrSet => Constructible StaticResource tag where
new _ attrs = do
o <- newZeroStaticResource
GI.Attributes.set o attrs
return o
noStaticResource :: Maybe StaticResource
noStaticResource = Nothing
#if ENABLE_OVERLOADING
instance O.HasAttributeList StaticResource
type instance O.AttributeList StaticResource = StaticResourceAttributeList
type StaticResourceAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "g_static_resource_fini" g_static_resource_fini ::
Ptr StaticResource ->
IO ()
staticResourceFini ::
(B.CallStack.HasCallStack, MonadIO m) =>
StaticResource
-> m ()
staticResourceFini staticResource = liftIO $ do
staticResource' <- unsafeManagedPtrGetPtr staticResource
g_static_resource_fini staticResource'
touchManagedPtr staticResource
return ()
#if ENABLE_OVERLOADING
data StaticResourceFiniMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo StaticResourceFiniMethodInfo StaticResource signature where
overloadedMethod _ = staticResourceFini
#endif
foreign import ccall "g_static_resource_get_resource" g_static_resource_get_resource ::
Ptr StaticResource ->
IO (Ptr Gio.Resource.Resource)
staticResourceGetResource ::
(B.CallStack.HasCallStack, MonadIO m) =>
StaticResource
-> m Gio.Resource.Resource
staticResourceGetResource staticResource = liftIO $ do
staticResource' <- unsafeManagedPtrGetPtr staticResource
result <- g_static_resource_get_resource staticResource'
checkUnexpectedReturnNULL "staticResourceGetResource" result
result' <- (newBoxed Gio.Resource.Resource) result
touchManagedPtr staticResource
return result'
#if ENABLE_OVERLOADING
data StaticResourceGetResourceMethodInfo
instance (signature ~ (m Gio.Resource.Resource), MonadIO m) => O.MethodInfo StaticResourceGetResourceMethodInfo StaticResource signature where
overloadedMethod _ = staticResourceGetResource
#endif
foreign import ccall "g_static_resource_init" g_static_resource_init ::
Ptr StaticResource ->
IO ()
staticResourceInit ::
(B.CallStack.HasCallStack, MonadIO m) =>
StaticResource
-> m ()
staticResourceInit staticResource = liftIO $ do
staticResource' <- unsafeManagedPtrGetPtr staticResource
g_static_resource_init staticResource'
touchManagedPtr staticResource
return ()
#if ENABLE_OVERLOADING
data StaticResourceInitMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo StaticResourceInitMethodInfo StaticResource signature where
overloadedMethod _ = staticResourceInit
#endif
#if ENABLE_OVERLOADING
type family ResolveStaticResourceMethod (t :: Symbol) (o :: *) :: * where
ResolveStaticResourceMethod "fini" o = StaticResourceFiniMethodInfo
ResolveStaticResourceMethod "init" o = StaticResourceInitMethodInfo
ResolveStaticResourceMethod "getResource" o = StaticResourceGetResourceMethodInfo
ResolveStaticResourceMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveStaticResourceMethod t StaticResource, O.MethodInfo info StaticResource p) => OL.IsLabel t (StaticResource -> 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