#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gst.Structs.ParseContext
(
ParseContext(..) ,
noParseContext ,
#if ENABLE_OVERLOADING
ParseContextCopyMethodInfo ,
#endif
parseContextCopy ,
#if ENABLE_OVERLOADING
ParseContextFreeMethodInfo ,
#endif
parseContextFree ,
#if ENABLE_OVERLOADING
ParseContextGetMissingElementsMethodInfo,
#endif
parseContextGetMissingElements ,
parseContextNew ,
) 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
newtype ParseContext = ParseContext (ManagedPtr ParseContext)
foreign import ccall "gst_parse_context_get_type" c_gst_parse_context_get_type ::
IO GType
instance BoxedObject ParseContext where
boxedType _ = c_gst_parse_context_get_type
noParseContext :: Maybe ParseContext
noParseContext = Nothing
#if ENABLE_OVERLOADING
instance O.HasAttributeList ParseContext
type instance O.AttributeList ParseContext = ParseContextAttributeList
type ParseContextAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "gst_parse_context_new" gst_parse_context_new ::
IO (Ptr ParseContext)
parseContextNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m (Maybe ParseContext)
parseContextNew = liftIO $ do
result <- gst_parse_context_new
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapBoxed ParseContext) result'
return result''
return maybeResult
#if ENABLE_OVERLOADING
#endif
foreign import ccall "gst_parse_context_copy" gst_parse_context_copy ::
Ptr ParseContext ->
IO (Ptr ParseContext)
parseContextCopy ::
(B.CallStack.HasCallStack, MonadIO m) =>
ParseContext
-> m (Maybe ParseContext)
parseContextCopy context = liftIO $ do
context' <- unsafeManagedPtrGetPtr context
result <- gst_parse_context_copy context'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapBoxed ParseContext) result'
return result''
touchManagedPtr context
return maybeResult
#if ENABLE_OVERLOADING
data ParseContextCopyMethodInfo
instance (signature ~ (m (Maybe ParseContext)), MonadIO m) => O.MethodInfo ParseContextCopyMethodInfo ParseContext signature where
overloadedMethod _ = parseContextCopy
#endif
foreign import ccall "gst_parse_context_free" gst_parse_context_free ::
Ptr ParseContext ->
IO ()
parseContextFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
ParseContext
-> m ()
parseContextFree context = liftIO $ do
context' <- B.ManagedPtr.disownBoxed context
gst_parse_context_free context'
touchManagedPtr context
return ()
#if ENABLE_OVERLOADING
data ParseContextFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo ParseContextFreeMethodInfo ParseContext signature where
overloadedMethod _ = parseContextFree
#endif
foreign import ccall "gst_parse_context_get_missing_elements" gst_parse_context_get_missing_elements ::
Ptr ParseContext ->
IO (Ptr CString)
parseContextGetMissingElements ::
(B.CallStack.HasCallStack, MonadIO m) =>
ParseContext
-> m (Maybe [T.Text])
parseContextGetMissingElements context = liftIO $ do
context' <- unsafeManagedPtrGetPtr context
result <- gst_parse_context_get_missing_elements context'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- unpackZeroTerminatedUTF8CArray result'
mapZeroTerminatedCArray freeMem result'
freeMem result'
return result''
touchManagedPtr context
return maybeResult
#if ENABLE_OVERLOADING
data ParseContextGetMissingElementsMethodInfo
instance (signature ~ (m (Maybe [T.Text])), MonadIO m) => O.MethodInfo ParseContextGetMissingElementsMethodInfo ParseContext signature where
overloadedMethod _ = parseContextGetMissingElements
#endif
#if ENABLE_OVERLOADING
type family ResolveParseContextMethod (t :: Symbol) (o :: *) :: * where
ResolveParseContextMethod "copy" o = ParseContextCopyMethodInfo
ResolveParseContextMethod "free" o = ParseContextFreeMethodInfo
ResolveParseContextMethod "getMissingElements" o = ParseContextGetMissingElementsMethodInfo
ResolveParseContextMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveParseContextMethod t ParseContext, O.MethodInfo info ParseContext p) => OL.IsLabel t (ParseContext -> 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