gi-webkit2-4.0.21: GI/WebKit2/Structs/MimeInfo.hs
{- |
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.MimeInfo
(
-- * Exported types
MimeInfo(..) ,
noMimeInfo ,
-- * Methods
-- ** getDescription #method:getDescription#
#if ENABLE_OVERLOADING
MimeInfoGetDescriptionMethodInfo ,
#endif
mimeInfoGetDescription ,
-- ** getExtensions #method:getExtensions#
#if ENABLE_OVERLOADING
MimeInfoGetExtensionsMethodInfo ,
#endif
mimeInfoGetExtensions ,
-- ** getMimeType #method:getMimeType#
#if ENABLE_OVERLOADING
MimeInfoGetMimeTypeMethodInfo ,
#endif
mimeInfoGetMimeType ,
-- ** ref #method:ref#
#if ENABLE_OVERLOADING
MimeInfoRefMethodInfo ,
#endif
mimeInfoRef ,
-- ** unref #method:unref#
#if ENABLE_OVERLOADING
MimeInfoUnrefMethodInfo ,
#endif
mimeInfoUnref ,
) 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
-- | Memory-managed wrapper type.
newtype MimeInfo = MimeInfo (ManagedPtr MimeInfo)
foreign import ccall "webkit_mime_info_get_type" c_webkit_mime_info_get_type ::
IO GType
instance BoxedObject MimeInfo where
boxedType _ = c_webkit_mime_info_get_type
-- | A convenience alias for `Nothing` :: `Maybe` `MimeInfo`.
noMimeInfo :: Maybe MimeInfo
noMimeInfo = Nothing
#if ENABLE_OVERLOADING
instance O.HasAttributeList MimeInfo
type instance O.AttributeList MimeInfo = MimeInfoAttributeList
type MimeInfoAttributeList = ('[ ] :: [(Symbol, *)])
#endif
-- method MimeInfo::get_description
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "WebKit2", name = "MimeInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitMimeInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False
foreign import ccall "webkit_mime_info_get_description" webkit_mime_info_get_description ::
Ptr MimeInfo -> -- info : TInterface (Name {namespace = "WebKit2", name = "MimeInfo"})
IO CString
{- |
/No description available in the introspection data./
-}
mimeInfoGetDescription ::
(B.CallStack.HasCallStack, MonadIO m) =>
MimeInfo
{- ^ /@info@/: a 'GI.WebKit2.Structs.MimeInfo.MimeInfo' -}
-> m T.Text
{- ^ __Returns:__ the description of the MIME type of /@info@/ -}
mimeInfoGetDescription info = liftIO $ do
info' <- unsafeManagedPtrGetPtr info
result <- webkit_mime_info_get_description info'
checkUnexpectedReturnNULL "mimeInfoGetDescription" result
result' <- cstringToText result
touchManagedPtr info
return result'
#if ENABLE_OVERLOADING
data MimeInfoGetDescriptionMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo MimeInfoGetDescriptionMethodInfo MimeInfo signature where
overloadedMethod _ = mimeInfoGetDescription
#endif
-- method MimeInfo::get_extensions
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "WebKit2", name = "MimeInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitMimeInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False
foreign import ccall "webkit_mime_info_get_extensions" webkit_mime_info_get_extensions ::
Ptr MimeInfo -> -- info : TInterface (Name {namespace = "WebKit2", name = "MimeInfo"})
IO (Ptr CString)
{- |
Get the list of file extensions associated to the
MIME type of /@info@/
-}
mimeInfoGetExtensions ::
(B.CallStack.HasCallStack, MonadIO m) =>
MimeInfo
{- ^ /@info@/: a 'GI.WebKit2.Structs.MimeInfo.MimeInfo' -}
-> m [T.Text]
{- ^ __Returns:__ a
'Nothing'-terminated array of strings -}
mimeInfoGetExtensions info = liftIO $ do
info' <- unsafeManagedPtrGetPtr info
result <- webkit_mime_info_get_extensions info'
checkUnexpectedReturnNULL "mimeInfoGetExtensions" result
result' <- unpackZeroTerminatedUTF8CArray result
touchManagedPtr info
return result'
#if ENABLE_OVERLOADING
data MimeInfoGetExtensionsMethodInfo
instance (signature ~ (m [T.Text]), MonadIO m) => O.MethodInfo MimeInfoGetExtensionsMethodInfo MimeInfo signature where
overloadedMethod _ = mimeInfoGetExtensions
#endif
-- method MimeInfo::get_mime_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "WebKit2", name = "MimeInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitMimeInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False
foreign import ccall "webkit_mime_info_get_mime_type" webkit_mime_info_get_mime_type ::
Ptr MimeInfo -> -- info : TInterface (Name {namespace = "WebKit2", name = "MimeInfo"})
IO CString
{- |
/No description available in the introspection data./
-}
mimeInfoGetMimeType ::
(B.CallStack.HasCallStack, MonadIO m) =>
MimeInfo
{- ^ /@info@/: a 'GI.WebKit2.Structs.MimeInfo.MimeInfo' -}
-> m T.Text
{- ^ __Returns:__ the MIME type of /@info@/ -}
mimeInfoGetMimeType info = liftIO $ do
info' <- unsafeManagedPtrGetPtr info
result <- webkit_mime_info_get_mime_type info'
checkUnexpectedReturnNULL "mimeInfoGetMimeType" result
result' <- cstringToText result
touchManagedPtr info
return result'
#if ENABLE_OVERLOADING
data MimeInfoGetMimeTypeMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo MimeInfoGetMimeTypeMethodInfo MimeInfo signature where
overloadedMethod _ = mimeInfoGetMimeType
#endif
-- method MimeInfo::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "WebKit2", name = "MimeInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitMimeInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "MimeInfo"}))
-- throws : False
-- Skip return : False
foreign import ccall "webkit_mime_info_ref" webkit_mime_info_ref ::
Ptr MimeInfo -> -- info : TInterface (Name {namespace = "WebKit2", name = "MimeInfo"})
IO (Ptr MimeInfo)
{- |
Atomically increments the reference count of /@info@/ by one. This
function is MT-safe and may be called from any thread.
-}
mimeInfoRef ::
(B.CallStack.HasCallStack, MonadIO m) =>
MimeInfo
{- ^ /@info@/: a 'GI.WebKit2.Structs.MimeInfo.MimeInfo' -}
-> m MimeInfo
{- ^ __Returns:__ The passed in 'GI.WebKit2.Structs.MimeInfo.MimeInfo' -}
mimeInfoRef info = liftIO $ do
info' <- unsafeManagedPtrGetPtr info
result <- webkit_mime_info_ref info'
checkUnexpectedReturnNULL "mimeInfoRef" result
result' <- (wrapBoxed MimeInfo) result
touchManagedPtr info
return result'
#if ENABLE_OVERLOADING
data MimeInfoRefMethodInfo
instance (signature ~ (m MimeInfo), MonadIO m) => O.MethodInfo MimeInfoRefMethodInfo MimeInfo signature where
overloadedMethod _ = mimeInfoRef
#endif
-- method MimeInfo::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "WebKit2", name = "MimeInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitMimeInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "webkit_mime_info_unref" webkit_mime_info_unref ::
Ptr MimeInfo -> -- info : TInterface (Name {namespace = "WebKit2", name = "MimeInfo"})
IO ()
{- |
Atomically decrements the reference count of /@info@/ by one. If the
reference count drops to 0, all memory allocated by the 'GI.WebKit2.Structs.MimeInfo.MimeInfo' is
released. This function is MT-safe and may be called from any
thread.
-}
mimeInfoUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
MimeInfo
{- ^ /@info@/: a 'GI.WebKit2.Structs.MimeInfo.MimeInfo' -}
-> m ()
mimeInfoUnref info = liftIO $ do
info' <- unsafeManagedPtrGetPtr info
webkit_mime_info_unref info'
touchManagedPtr info
return ()
#if ENABLE_OVERLOADING
data MimeInfoUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo MimeInfoUnrefMethodInfo MimeInfo signature where
overloadedMethod _ = mimeInfoUnref
#endif
#if ENABLE_OVERLOADING
type family ResolveMimeInfoMethod (t :: Symbol) (o :: *) :: * where
ResolveMimeInfoMethod "ref" o = MimeInfoRefMethodInfo
ResolveMimeInfoMethod "unref" o = MimeInfoUnrefMethodInfo
ResolveMimeInfoMethod "getDescription" o = MimeInfoGetDescriptionMethodInfo
ResolveMimeInfoMethod "getExtensions" o = MimeInfoGetExtensionsMethodInfo
ResolveMimeInfoMethod "getMimeType" o = MimeInfoGetMimeTypeMethodInfo
ResolveMimeInfoMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveMimeInfoMethod t MimeInfo, O.MethodInfo info MimeInfo p) => OL.IsLabel t (MimeInfo -> 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