{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gst.Structs.DebugCategory
(
DebugCategory(..) ,
newZeroDebugCategory ,
noDebugCategory ,
#if defined(ENABLE_OVERLOADING)
ResolveDebugCategoryMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
DebugCategoryFreeMethodInfo ,
#endif
debugCategoryFree ,
#if defined(ENABLE_OVERLOADING)
DebugCategoryGetColorMethodInfo ,
#endif
debugCategoryGetColor ,
#if defined(ENABLE_OVERLOADING)
DebugCategoryGetDescriptionMethodInfo ,
#endif
debugCategoryGetDescription ,
#if defined(ENABLE_OVERLOADING)
DebugCategoryGetNameMethodInfo ,
#endif
debugCategoryGetName ,
#if defined(ENABLE_OVERLOADING)
DebugCategoryGetThresholdMethodInfo ,
#endif
debugCategoryGetThreshold ,
#if defined(ENABLE_OVERLOADING)
DebugCategoryResetThresholdMethodInfo ,
#endif
debugCategoryResetThreshold ,
#if defined(ENABLE_OVERLOADING)
DebugCategorySetThresholdMethodInfo ,
#endif
debugCategorySetThreshold ,
) 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.GI.Base.Signals as B.Signals
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.Gst.Enums as Gst.Enums
newtype DebugCategory = DebugCategory (ManagedPtr DebugCategory)
deriving (DebugCategory -> DebugCategory -> Bool
(DebugCategory -> DebugCategory -> Bool)
-> (DebugCategory -> DebugCategory -> Bool) -> Eq DebugCategory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DebugCategory -> DebugCategory -> Bool
$c/= :: DebugCategory -> DebugCategory -> Bool
== :: DebugCategory -> DebugCategory -> Bool
$c== :: DebugCategory -> DebugCategory -> Bool
Eq)
instance WrappedPtr DebugCategory where
wrappedPtrCalloc :: IO (Ptr DebugCategory)
wrappedPtrCalloc = Int -> IO (Ptr DebugCategory)
forall a. Int -> IO (Ptr a)
callocBytes 24
wrappedPtrCopy :: DebugCategory -> IO DebugCategory
wrappedPtrCopy = \p :: DebugCategory
p -> DebugCategory
-> (Ptr DebugCategory -> IO DebugCategory) -> IO DebugCategory
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DebugCategory
p (Int -> Ptr DebugCategory -> IO (Ptr DebugCategory)
forall a. WrappedPtr a => Int -> Ptr a -> IO (Ptr a)
copyBytes 24 (Ptr DebugCategory -> IO (Ptr DebugCategory))
-> (Ptr DebugCategory -> IO DebugCategory)
-> Ptr DebugCategory
-> IO DebugCategory
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr DebugCategory -> DebugCategory)
-> Ptr DebugCategory -> IO DebugCategory
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr DebugCategory -> DebugCategory
DebugCategory)
wrappedPtrFree :: Maybe (GDestroyNotify DebugCategory)
wrappedPtrFree = GDestroyNotify DebugCategory
-> Maybe (GDestroyNotify DebugCategory)
forall a. a -> Maybe a
Just GDestroyNotify DebugCategory
forall a. FunPtr (Ptr a -> IO ())
ptr_to_g_free
newZeroDebugCategory :: MonadIO m => m DebugCategory
newZeroDebugCategory :: m DebugCategory
newZeroDebugCategory = IO DebugCategory -> m DebugCategory
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DebugCategory -> m DebugCategory)
-> IO DebugCategory -> m DebugCategory
forall a b. (a -> b) -> a -> b
$ IO (Ptr DebugCategory)
forall a. WrappedPtr a => IO (Ptr a)
wrappedPtrCalloc IO (Ptr DebugCategory)
-> (Ptr DebugCategory -> IO DebugCategory) -> IO DebugCategory
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr DebugCategory -> DebugCategory)
-> Ptr DebugCategory -> IO DebugCategory
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr DebugCategory -> DebugCategory
DebugCategory
instance tag ~ 'AttrSet => Constructible DebugCategory tag where
new :: (ManagedPtr DebugCategory -> DebugCategory)
-> [AttrOp DebugCategory tag] -> m DebugCategory
new _ attrs :: [AttrOp DebugCategory tag]
attrs = do
DebugCategory
o <- m DebugCategory
forall (m :: * -> *). MonadIO m => m DebugCategory
newZeroDebugCategory
DebugCategory -> [AttrOp DebugCategory 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set DebugCategory
o [AttrOp DebugCategory tag]
[AttrOp DebugCategory 'AttrSet]
attrs
DebugCategory -> m DebugCategory
forall (m :: * -> *) a. Monad m => a -> m a
return DebugCategory
o
noDebugCategory :: Maybe DebugCategory
noDebugCategory :: Maybe DebugCategory
noDebugCategory = Maybe DebugCategory
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList DebugCategory
type instance O.AttributeList DebugCategory = DebugCategoryAttributeList
type DebugCategoryAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "gst_debug_category_free" gst_debug_category_free ::
Ptr DebugCategory ->
IO ()
debugCategoryFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
DebugCategory
-> m ()
debugCategoryFree :: DebugCategory -> m ()
debugCategoryFree category :: DebugCategory
category = 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 DebugCategory
category' <- DebugCategory -> IO (Ptr DebugCategory)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DebugCategory
category
Ptr DebugCategory -> IO ()
gst_debug_category_free Ptr DebugCategory
category'
DebugCategory -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DebugCategory
category
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data DebugCategoryFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo DebugCategoryFreeMethodInfo DebugCategory signature where
overloadedMethod = debugCategoryFree
#endif
foreign import ccall "gst_debug_category_get_color" gst_debug_category_get_color ::
Ptr DebugCategory ->
IO Word32
debugCategoryGetColor ::
(B.CallStack.HasCallStack, MonadIO m) =>
DebugCategory
-> m Word32
debugCategoryGetColor :: DebugCategory -> m Word32
debugCategoryGetColor category :: DebugCategory
category = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr DebugCategory
category' <- DebugCategory -> IO (Ptr DebugCategory)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DebugCategory
category
Word32
result <- Ptr DebugCategory -> IO Word32
gst_debug_category_get_color Ptr DebugCategory
category'
DebugCategory -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DebugCategory
category
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data DebugCategoryGetColorMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo DebugCategoryGetColorMethodInfo DebugCategory signature where
overloadedMethod = debugCategoryGetColor
#endif
foreign import ccall "gst_debug_category_get_description" gst_debug_category_get_description ::
Ptr DebugCategory ->
IO CString
debugCategoryGetDescription ::
(B.CallStack.HasCallStack, MonadIO m) =>
DebugCategory
-> m T.Text
debugCategoryGetDescription :: DebugCategory -> m Text
debugCategoryGetDescription category :: DebugCategory
category = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr DebugCategory
category' <- DebugCategory -> IO (Ptr DebugCategory)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DebugCategory
category
CString
result <- Ptr DebugCategory -> IO CString
gst_debug_category_get_description Ptr DebugCategory
category'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "debugCategoryGetDescription" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
DebugCategory -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DebugCategory
category
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data DebugCategoryGetDescriptionMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo DebugCategoryGetDescriptionMethodInfo DebugCategory signature where
overloadedMethod = debugCategoryGetDescription
#endif
foreign import ccall "gst_debug_category_get_name" gst_debug_category_get_name ::
Ptr DebugCategory ->
IO CString
debugCategoryGetName ::
(B.CallStack.HasCallStack, MonadIO m) =>
DebugCategory
-> m T.Text
debugCategoryGetName :: DebugCategory -> m Text
debugCategoryGetName category :: DebugCategory
category = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr DebugCategory
category' <- DebugCategory -> IO (Ptr DebugCategory)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DebugCategory
category
CString
result <- Ptr DebugCategory -> IO CString
gst_debug_category_get_name Ptr DebugCategory
category'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "debugCategoryGetName" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
DebugCategory -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DebugCategory
category
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data DebugCategoryGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo DebugCategoryGetNameMethodInfo DebugCategory signature where
overloadedMethod = debugCategoryGetName
#endif
foreign import ccall "gst_debug_category_get_threshold" gst_debug_category_get_threshold ::
Ptr DebugCategory ->
IO CUInt
debugCategoryGetThreshold ::
(B.CallStack.HasCallStack, MonadIO m) =>
DebugCategory
-> m Gst.Enums.DebugLevel
debugCategoryGetThreshold :: DebugCategory -> m DebugLevel
debugCategoryGetThreshold category :: DebugCategory
category = IO DebugLevel -> m DebugLevel
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DebugLevel -> m DebugLevel) -> IO DebugLevel -> m DebugLevel
forall a b. (a -> b) -> a -> b
$ do
Ptr DebugCategory
category' <- DebugCategory -> IO (Ptr DebugCategory)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DebugCategory
category
CUInt
result <- Ptr DebugCategory -> IO CUInt
gst_debug_category_get_threshold Ptr DebugCategory
category'
let result' :: DebugLevel
result' = (Int -> DebugLevel
forall a. Enum a => Int -> a
toEnum (Int -> DebugLevel) -> (CUInt -> Int) -> CUInt -> DebugLevel
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
DebugCategory -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DebugCategory
category
DebugLevel -> IO DebugLevel
forall (m :: * -> *) a. Monad m => a -> m a
return DebugLevel
result'
#if defined(ENABLE_OVERLOADING)
data DebugCategoryGetThresholdMethodInfo
instance (signature ~ (m Gst.Enums.DebugLevel), MonadIO m) => O.MethodInfo DebugCategoryGetThresholdMethodInfo DebugCategory signature where
overloadedMethod = debugCategoryGetThreshold
#endif
foreign import ccall "gst_debug_category_reset_threshold" gst_debug_category_reset_threshold ::
Ptr DebugCategory ->
IO ()
debugCategoryResetThreshold ::
(B.CallStack.HasCallStack, MonadIO m) =>
DebugCategory
-> m ()
debugCategoryResetThreshold :: DebugCategory -> m ()
debugCategoryResetThreshold category :: DebugCategory
category = 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 DebugCategory
category' <- DebugCategory -> IO (Ptr DebugCategory)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DebugCategory
category
Ptr DebugCategory -> IO ()
gst_debug_category_reset_threshold Ptr DebugCategory
category'
DebugCategory -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DebugCategory
category
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data DebugCategoryResetThresholdMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo DebugCategoryResetThresholdMethodInfo DebugCategory signature where
overloadedMethod = debugCategoryResetThreshold
#endif
foreign import ccall "gst_debug_category_set_threshold" gst_debug_category_set_threshold ::
Ptr DebugCategory ->
CUInt ->
IO ()
debugCategorySetThreshold ::
(B.CallStack.HasCallStack, MonadIO m) =>
DebugCategory
-> Gst.Enums.DebugLevel
-> m ()
debugCategorySetThreshold :: DebugCategory -> DebugLevel -> m ()
debugCategorySetThreshold category :: DebugCategory
category level :: DebugLevel
level = 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 DebugCategory
category' <- DebugCategory -> IO (Ptr DebugCategory)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DebugCategory
category
let level' :: CUInt
level' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (DebugLevel -> Int) -> DebugLevel -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DebugLevel -> Int
forall a. Enum a => a -> Int
fromEnum) DebugLevel
level
Ptr DebugCategory -> CUInt -> IO ()
gst_debug_category_set_threshold Ptr DebugCategory
category' CUInt
level'
DebugCategory -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DebugCategory
category
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data DebugCategorySetThresholdMethodInfo
instance (signature ~ (Gst.Enums.DebugLevel -> m ()), MonadIO m) => O.MethodInfo DebugCategorySetThresholdMethodInfo DebugCategory signature where
overloadedMethod = debugCategorySetThreshold
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveDebugCategoryMethod (t :: Symbol) (o :: *) :: * where
ResolveDebugCategoryMethod "free" o = DebugCategoryFreeMethodInfo
ResolveDebugCategoryMethod "resetThreshold" o = DebugCategoryResetThresholdMethodInfo
ResolveDebugCategoryMethod "getColor" o = DebugCategoryGetColorMethodInfo
ResolveDebugCategoryMethod "getDescription" o = DebugCategoryGetDescriptionMethodInfo
ResolveDebugCategoryMethod "getName" o = DebugCategoryGetNameMethodInfo
ResolveDebugCategoryMethod "getThreshold" o = DebugCategoryGetThresholdMethodInfo
ResolveDebugCategoryMethod "setThreshold" o = DebugCategorySetThresholdMethodInfo
ResolveDebugCategoryMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveDebugCategoryMethod t DebugCategory, O.MethodInfo info DebugCategory p) => OL.IsLabel t (DebugCategory -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif