packages feed

gi-wireplumber-0.5.14: GI/Wp/Objects/SpaType.hs

{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

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

module GI.Wp.Objects.SpaType
    ( 

-- * Exported types
    SpaType(..)                             ,
    IsSpaType                               ,
    toSpaType                               ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [isFundamental]("GI.Wp.Objects.SpaType#g:method:isFundamental"), [isId]("GI.Wp.Objects.SpaType#g:method:isId"), [isObject]("GI.Wp.Objects.SpaType#g:method:isObject"), [name]("GI.Wp.Objects.SpaType#g:method:name"), [parent]("GI.Wp.Objects.SpaType#g:method:parent").
-- 
-- ==== Getters
-- [getObjectIdValuesTable]("GI.Wp.Objects.SpaType#g:method:getObjectIdValuesTable"), [getValuesTable]("GI.Wp.Objects.SpaType#g:method:getValuesTable").
-- 
-- ==== Setters
-- /None/.

#if defined(ENABLE_OVERLOADING)
    ResolveSpaTypeMethod                    ,
#endif

-- ** fromName #method:fromName#

    spaTypeFromName                         ,


-- ** getObjectIdValuesTable #method:getObjectIdValuesTable#

#if defined(ENABLE_OVERLOADING)
    SpaTypeGetObjectIdValuesTableMethodInfo ,
#endif
    spaTypeGetObjectIdValuesTable           ,


-- ** getValuesTable #method:getValuesTable#

#if defined(ENABLE_OVERLOADING)
    SpaTypeGetValuesTableMethodInfo         ,
#endif
    spaTypeGetValuesTable                   ,


-- ** isFundamental #method:isFundamental#

#if defined(ENABLE_OVERLOADING)
    SpaTypeIsFundamentalMethodInfo          ,
#endif
    spaTypeIsFundamental                    ,


-- ** isId #method:isId#

#if defined(ENABLE_OVERLOADING)
    SpaTypeIsIdMethodInfo                   ,
#endif
    spaTypeIsId                             ,


-- ** isObject #method:isObject#

#if defined(ENABLE_OVERLOADING)
    SpaTypeIsObjectMethodInfo               ,
#endif
    spaTypeIsObject                         ,


-- ** name #method:name#

#if defined(ENABLE_OVERLOADING)
    SpaTypeNameMethodInfo                   ,
#endif
    spaTypeName                             ,


-- ** parent #method:parent#

#if defined(ENABLE_OVERLOADING)
    SpaTypeParentMethodInfo                 ,
#endif
    spaTypeParent                           ,




    ) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)

#else

#endif

-- | Memory-managed wrapper type.
newtype SpaType = SpaType (SP.ManagedPtr SpaType)
    deriving (Eq)

instance SP.ManagedPtrNewtype SpaType where
    toManagedPtr (SpaType p) = p

foreign import ccall "wp_spa_type_get_type"
    c_wp_spa_type_get_type :: IO B.Types.GType

instance B.Types.TypedObject SpaType where
    glibType = c_wp_spa_type_get_type

-- | Type class for types which can be safely cast to t'SpaType', for instance with `toSpaType`.
class (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf SpaType o) => IsSpaType o
instance (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf SpaType o) => IsSpaType o

instance O.HasParentTypes SpaType
type instance O.ParentTypes SpaType = '[]

-- | Cast to t'SpaType', for types for which this is known to be safe. For general casts, use 'Data.GI.Base.ManagedPtr.castTo'.
toSpaType :: (MIO.MonadIO m, IsSpaType o) => o -> m SpaType
toSpaType = MIO.liftIO . B.ManagedPtr.unsafeCastTo SpaType

--- XXX Missing getter and/or setter, so no GValue instance could be generated.
#if defined(ENABLE_OVERLOADING)
type family ResolveSpaTypeMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveSpaTypeMethod "isFundamental" o = SpaTypeIsFundamentalMethodInfo
    ResolveSpaTypeMethod "isId" o = SpaTypeIsIdMethodInfo
    ResolveSpaTypeMethod "isObject" o = SpaTypeIsObjectMethodInfo
    ResolveSpaTypeMethod "name" o = SpaTypeNameMethodInfo
    ResolveSpaTypeMethod "parent" o = SpaTypeParentMethodInfo
    ResolveSpaTypeMethod "getObjectIdValuesTable" o = SpaTypeGetObjectIdValuesTableMethodInfo
    ResolveSpaTypeMethod "getValuesTable" o = SpaTypeGetValuesTableMethodInfo
    ResolveSpaTypeMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveSpaTypeMethod t SpaType, O.OverloadedMethod info SpaType p) => OL.IsLabel t (SpaType -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveSpaTypeMethod t SpaType, O.OverloadedMethod info SpaType p, R.HasField t SpaType p) => R.HasField t SpaType p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveSpaTypeMethod t SpaType, O.OverloadedMethodInfo info SpaType) => OL.IsLabel t (O.MethodProxy info SpaType) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

-- XXX Wrapping a foreign struct/union with no known destructor or size, leak?
instance BoxedPtr SpaType where
    boxedPtrCopy = return
    boxedPtrFree = \_x -> return ()


-- method SpaType::get_object_id_values_table
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaType" }
--           , argCType = Just "WpSpaType"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the type id of an object type"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "wp_spa_type_get_object_id_values_table" wp_spa_type_get_object_id_values_table :: 
    Ptr SpaType ->                          -- type : TInterface (Name {namespace = "Wp", name = "SpaType"})
    IO (Ptr ())

-- | Gets the table with the values that can be stored in the special \"id\" field of an object of the given /@type@/.
-- 
-- 
-- Object pods (see WpSpaPod) always have a special \"id\" field along with other fields that can be defined. This \"id\" field can only store values of a specific SPA_TYPE_Id type. This function returns the table that contains the possible values for that field.
spaTypeGetObjectIdValuesTable ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaType a) =>
    a
    -- ^ /@type@/: the type id of an object type
    -> m (Ptr ())
    -- ^ __Returns:__ the table with the values that can be stored in the special \"id\" field of an object of the given /@type@/
spaTypeGetObjectIdValuesTable type_ = liftIO $ do
    type_' <- unsafeManagedPtrCastPtr type_
    result <- wp_spa_type_get_object_id_values_table type_'
    touchManagedPtr type_
    return result

#if defined(ENABLE_OVERLOADING)
data SpaTypeGetObjectIdValuesTableMethodInfo
instance (signature ~ (m (Ptr ())), MonadIO m, IsSpaType a) => O.OverloadedMethod SpaTypeGetObjectIdValuesTableMethodInfo a signature where
    overloadedMethod = spaTypeGetObjectIdValuesTable

instance O.OverloadedMethodInfo SpaTypeGetObjectIdValuesTableMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.SpaType.spaTypeGetObjectIdValuesTable",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14/docs/GI-Wp-Objects-SpaType.html#v:spaTypeGetObjectIdValuesTable"
        })


#endif

-- method SpaType::get_values_table
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaType" }
--           , argCType = Just "WpSpaType"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a type id" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "wp_spa_type_get_values_table" wp_spa_type_get_values_table :: 
    Ptr SpaType ->                          -- type : TInterface (Name {namespace = "Wp", name = "SpaType"})
    IO (Ptr ())

-- | Gets the values table of an SPA type.
spaTypeGetValuesTable ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaType a) =>
    a
    -- ^ /@type@/: a type id
    -> m (Ptr ())
    -- ^ __Returns:__ the associated WpSpaIdTable that contains possible values or object fields for this type, or NULL
spaTypeGetValuesTable type_ = liftIO $ do
    type_' <- unsafeManagedPtrCastPtr type_
    result <- wp_spa_type_get_values_table type_'
    touchManagedPtr type_
    return result

#if defined(ENABLE_OVERLOADING)
data SpaTypeGetValuesTableMethodInfo
instance (signature ~ (m (Ptr ())), MonadIO m, IsSpaType a) => O.OverloadedMethod SpaTypeGetValuesTableMethodInfo a signature where
    overloadedMethod = spaTypeGetValuesTable

instance O.OverloadedMethodInfo SpaTypeGetValuesTableMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.SpaType.spaTypeGetValuesTable",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14/docs/GI-Wp-Objects-SpaType.html#v:spaTypeGetValuesTable"
        })


#endif

-- method SpaType::is_fundamental
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaType" }
--           , argCType = Just "WpSpaType"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a type id" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "wp_spa_type_is_fundamental" wp_spa_type_is_fundamental :: 
    Ptr SpaType ->                          -- type : TInterface (Name {namespace = "Wp", name = "SpaType"})
    IO CInt

-- | Checks if an SPA type is a fundamental type.
spaTypeIsFundamental ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaType a) =>
    a
    -- ^ /@type@/: a type id
    -> m Bool
    -- ^ __Returns:__ TRUE if the /@type@/ has no parent, FALSE otherwise
spaTypeIsFundamental type_ = liftIO $ do
    type_' <- unsafeManagedPtrCastPtr type_
    result <- wp_spa_type_is_fundamental type_'
    let result' = (/= 0) result
    touchManagedPtr type_
    return result'

#if defined(ENABLE_OVERLOADING)
data SpaTypeIsFundamentalMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSpaType a) => O.OverloadedMethod SpaTypeIsFundamentalMethodInfo a signature where
    overloadedMethod = spaTypeIsFundamental

instance O.OverloadedMethodInfo SpaTypeIsFundamentalMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.SpaType.spaTypeIsFundamental",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14/docs/GI-Wp-Objects-SpaType.html#v:spaTypeIsFundamental"
        })


#endif

-- method SpaType::is_id
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaType" }
--           , argCType = Just "WpSpaType"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a type id" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "wp_spa_type_is_id" wp_spa_type_is_id :: 
    Ptr SpaType ->                          -- type : TInterface (Name {namespace = "Wp", name = "SpaType"})
    IO CInt

-- | Checks if an SPA type is an Id type.
spaTypeIsId ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaType a) =>
    a
    -- ^ /@type@/: a type id
    -> m Bool
    -- ^ __Returns:__ TRUE if the /@type@/ is a SPA_TYPE_Id, FALSE otherwise
spaTypeIsId type_ = liftIO $ do
    type_' <- unsafeManagedPtrCastPtr type_
    result <- wp_spa_type_is_id type_'
    let result' = (/= 0) result
    touchManagedPtr type_
    return result'

#if defined(ENABLE_OVERLOADING)
data SpaTypeIsIdMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSpaType a) => O.OverloadedMethod SpaTypeIsIdMethodInfo a signature where
    overloadedMethod = spaTypeIsId

instance O.OverloadedMethodInfo SpaTypeIsIdMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.SpaType.spaTypeIsId",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14/docs/GI-Wp-Objects-SpaType.html#v:spaTypeIsId"
        })


#endif

-- method SpaType::is_object
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaType" }
--           , argCType = Just "WpSpaType"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a type id" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "wp_spa_type_is_object" wp_spa_type_is_object :: 
    Ptr SpaType ->                          -- type : TInterface (Name {namespace = "Wp", name = "SpaType"})
    IO CInt

-- | Checks if an SPA type is an Object type.
spaTypeIsObject ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaType a) =>
    a
    -- ^ /@type@/: a type id
    -> m Bool
    -- ^ __Returns:__ TRUE if the /@type@/ is a SPA_TYPE_Object, FALSE otherwise
spaTypeIsObject type_ = liftIO $ do
    type_' <- unsafeManagedPtrCastPtr type_
    result <- wp_spa_type_is_object type_'
    let result' = (/= 0) result
    touchManagedPtr type_
    return result'

#if defined(ENABLE_OVERLOADING)
data SpaTypeIsObjectMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSpaType a) => O.OverloadedMethod SpaTypeIsObjectMethodInfo a signature where
    overloadedMethod = spaTypeIsObject

instance O.OverloadedMethodInfo SpaTypeIsObjectMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.SpaType.spaTypeIsObject",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14/docs/GI-Wp-Objects-SpaType.html#v:spaTypeIsObject"
        })


#endif

-- method SpaType::name
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaType" }
--           , argCType = Just "WpSpaType"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a type id" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "wp_spa_type_name" wp_spa_type_name :: 
    Ptr SpaType ->                          -- type : TInterface (Name {namespace = "Wp", name = "SpaType"})
    IO CString

-- | Gets the name of an SPA type.
spaTypeName ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaType a) =>
    a
    -- ^ /@type@/: a type id
    -> m T.Text
    -- ^ __Returns:__ the complete name of the given /@type@/ or NULL if /@type@/ is invalid
spaTypeName type_ = liftIO $ do
    type_' <- unsafeManagedPtrCastPtr type_
    result <- wp_spa_type_name type_'
    checkUnexpectedReturnNULL "spaTypeName" result
    result' <- cstringToText result
    touchManagedPtr type_
    return result'

#if defined(ENABLE_OVERLOADING)
data SpaTypeNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsSpaType a) => O.OverloadedMethod SpaTypeNameMethodInfo a signature where
    overloadedMethod = spaTypeName

instance O.OverloadedMethodInfo SpaTypeNameMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.SpaType.spaTypeName",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14/docs/GI-Wp-Objects-SpaType.html#v:spaTypeName"
        })


#endif

-- method SpaType::parent
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaType" }
--           , argCType = Just "WpSpaType"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a type id" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "SpaType" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_spa_type_parent" wp_spa_type_parent :: 
    Ptr SpaType ->                          -- type : TInterface (Name {namespace = "Wp", name = "SpaType"})
    IO (Ptr SpaType)

-- | Gets the parent type of an SPA type.
spaTypeParent ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaType a) =>
    a
    -- ^ /@type@/: a type id
    -> m SpaType
    -- ^ __Returns:__ the direct parent type of the given /@type@/; if the type is fundamental (i.e. has no parent), the returned type is the same as /@type@/
spaTypeParent type_ = liftIO $ do
    type_' <- unsafeManagedPtrCastPtr type_
    result <- wp_spa_type_parent type_'
    checkUnexpectedReturnNULL "spaTypeParent" result
    result' <- (newPtr SpaType) result
    touchManagedPtr type_
    return result'

#if defined(ENABLE_OVERLOADING)
data SpaTypeParentMethodInfo
instance (signature ~ (m SpaType), MonadIO m, IsSpaType a) => O.OverloadedMethod SpaTypeParentMethodInfo a signature where
    overloadedMethod = spaTypeParent

instance O.OverloadedMethodInfo SpaTypeParentMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.SpaType.spaTypeParent",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14/docs/GI-Wp-Objects-SpaType.html#v:spaTypeParent"
        })


#endif

-- method SpaType::from_name
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name to look up"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "SpaType" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_spa_type_from_name" wp_spa_type_from_name :: 
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr SpaType)

-- | Looks up the type id from a given type name.
spaTypeFromName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@name@/: the name to look up
    -> m SpaType
    -- ^ __Returns:__ the corresponding type id or WP_SPA_TYPE_INVALID if not found
spaTypeFromName name = liftIO $ do
    name' <- textToCString name
    result <- wp_spa_type_from_name name'
    checkUnexpectedReturnNULL "spaTypeFromName" result
    result' <- (newPtr SpaType) result
    freeMem name'
    return result'

#if defined(ENABLE_OVERLOADING)
#endif