gi-wireplumber-0.5.14: GI/Wp/Objects/SiFactory.hs
{-# LANGUAGE TypeApplications #-}
-- | Copyright : Will Thompson and Iñaki García Etxebarria
-- License : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
--
-- A factory for session items.
-- The most simple way to register a new item implementation would be:
--
-- === /C code/
-- >
-- > wp_si_factory_register (core,
-- > wp_si_factory_new_simple (
--
-- And the most simple way to construct an item from a registered factory:
--
-- === /C code/
-- >
-- > item = wp_session_item_make (core,
--
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Wp.Objects.SiFactory
(
-- * Exported types
SiFactory(..) ,
IsSiFactory ,
toSiFactory ,
-- * Methods
-- |
--
-- === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [construct]("GI.Wp.Objects.SiFactory#g:method:construct"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
--
-- ==== Getters
-- [getData]("GI.GObject.Objects.Object#g:method:getData"), [getName]("GI.Wp.Objects.SiFactory#g:method:getName"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata").
--
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").
#if defined(ENABLE_OVERLOADING)
ResolveSiFactoryMethod ,
#endif
-- ** construct #method:construct#
#if defined(ENABLE_OVERLOADING)
SiFactoryConstructMethodInfo ,
#endif
siFactoryConstruct ,
-- ** find #method:find#
siFactoryFind ,
-- ** getName #method:getName#
#if defined(ENABLE_OVERLOADING)
SiFactoryGetNameMethodInfo ,
#endif
siFactoryGetName ,
-- ** newSimple #method:newSimple#
siFactoryNewSimple ,
-- * Properties
-- ** name #attr:name#
-- | /No description available in the introspection data./
#if defined(ENABLE_OVERLOADING)
SiFactoryNamePropertyInfo ,
#endif
constructSiFactoryName ,
getSiFactoryName ,
#if defined(ENABLE_OVERLOADING)
siFactoryName ,
#endif
) 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)
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Structs.MainContext as GLib.MainContext
import qualified GI.GLib.Structs.Source as GLib.Source
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Wp.Callbacks as Wp.Callbacks
import {-# SOURCE #-} qualified GI.Wp.Enums as Wp.Enums
import {-# SOURCE #-} qualified GI.Wp.Flags as Wp.Flags
import {-# SOURCE #-} qualified GI.Wp.Objects.Conf as Wp.Conf
import {-# SOURCE #-} qualified GI.Wp.Objects.Core as Wp.Core
import {-# SOURCE #-} qualified GI.Wp.Objects.Object as Wp.Object
import {-# SOURCE #-} qualified GI.Wp.Objects.ObjectManager as Wp.ObjectManager
import {-# SOURCE #-} qualified GI.Wp.Objects.Proxy as Wp.Proxy
import {-# SOURCE #-} qualified GI.Wp.Objects.SessionItem as Wp.SessionItem
import {-# SOURCE #-} qualified GI.Wp.Structs.Iterator as Wp.Iterator
import {-# SOURCE #-} qualified GI.Wp.Structs.IteratorMethods as Wp.IteratorMethods
import {-# SOURCE #-} qualified GI.Wp.Structs.ObjectInterest as Wp.ObjectInterest
import {-# SOURCE #-} qualified GI.Wp.Structs.Properties as Wp.Properties
import {-# SOURCE #-} qualified GI.Wp.Structs.SpaJson as Wp.SpaJson
#else
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Wp.Objects.Core as Wp.Core
import {-# SOURCE #-} qualified GI.Wp.Objects.SessionItem as Wp.SessionItem
#endif
-- | Memory-managed wrapper type.
newtype SiFactory = SiFactory (SP.ManagedPtr SiFactory)
deriving (Eq)
instance SP.ManagedPtrNewtype SiFactory where
toManagedPtr (SiFactory p) = p
foreign import ccall "wp_si_factory_get_type"
c_wp_si_factory_get_type :: IO B.Types.GType
instance B.Types.TypedObject SiFactory where
glibType = c_wp_si_factory_get_type
instance B.Types.GObject SiFactory
-- | Type class for types which can be safely cast to t'SiFactory', for instance with `toSiFactory`.
class (SP.GObject o, O.IsDescendantOf SiFactory o) => IsSiFactory o
instance (SP.GObject o, O.IsDescendantOf SiFactory o) => IsSiFactory o
instance O.HasParentTypes SiFactory
type instance O.ParentTypes SiFactory = '[GObject.Object.Object]
-- | Cast to t'SiFactory', for types for which this is known to be safe. For general casts, use 'Data.GI.Base.ManagedPtr.castTo'.
toSiFactory :: (MIO.MonadIO m, IsSiFactory o) => o -> m SiFactory
toSiFactory = MIO.liftIO . B.ManagedPtr.unsafeCastTo SiFactory
-- | Convert t'SiFactory' to and from t'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe SiFactory) where
gvalueGType_ = c_wp_si_factory_get_type
gvalueSet_ gv P.Nothing = B.GValue.set_object gv (FP.nullPtr :: FP.Ptr SiFactory)
gvalueSet_ gv (P.Just obj) = B.ManagedPtr.withManagedPtr obj (B.GValue.set_object gv)
gvalueGet_ gv = do
ptr <- B.GValue.get_object gv :: IO (FP.Ptr SiFactory)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject SiFactory ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveSiFactoryMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveSiFactoryMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveSiFactoryMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveSiFactoryMethod "construct" o = SiFactoryConstructMethodInfo
ResolveSiFactoryMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveSiFactoryMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveSiFactoryMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveSiFactoryMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveSiFactoryMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveSiFactoryMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveSiFactoryMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveSiFactoryMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveSiFactoryMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveSiFactoryMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveSiFactoryMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveSiFactoryMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveSiFactoryMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveSiFactoryMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveSiFactoryMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveSiFactoryMethod "getName" o = SiFactoryGetNameMethodInfo
ResolveSiFactoryMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveSiFactoryMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveSiFactoryMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveSiFactoryMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveSiFactoryMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveSiFactoryMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveSiFactoryMethod t SiFactory, O.OverloadedMethod info SiFactory p) => OL.IsLabel t (SiFactory -> 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 ~ ResolveSiFactoryMethod t SiFactory, O.OverloadedMethod info SiFactory p, R.HasField t SiFactory p) => R.HasField t SiFactory p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveSiFactoryMethod t SiFactory, O.OverloadedMethodInfo info SiFactory) => OL.IsLabel t (O.MethodProxy info SiFactory) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
-- VVV Prop "name"
-- Type: TBasicType TUTF8
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
-- Nullable: (Just False,Nothing)
-- | Get the value of the “@name@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
--
-- @
-- 'Data.GI.Base.Attributes.get' siFactory #name
-- @
getSiFactoryName :: (MonadIO m, IsSiFactory o) => o -> m T.Text
getSiFactoryName obj = MIO.liftIO $ checkUnexpectedNothing "getSiFactoryName" $ B.Properties.getObjectPropertyString obj "name"
-- | Construct a t'GValueConstruct' with valid value for the “@name@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructSiFactoryName :: (IsSiFactory o, MIO.MonadIO m) => T.Text -> m (GValueConstruct o)
constructSiFactoryName val = MIO.liftIO $ do
MIO.liftIO $ B.Properties.constructObjectPropertyString "name" (P.Just val)
#if defined(ENABLE_OVERLOADING)
data SiFactoryNamePropertyInfo
instance AttrInfo SiFactoryNamePropertyInfo where
type AttrAllowedOps SiFactoryNamePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint SiFactoryNamePropertyInfo = IsSiFactory
type AttrSetTypeConstraint SiFactoryNamePropertyInfo = (~) T.Text
type AttrTransferTypeConstraint SiFactoryNamePropertyInfo = (~) T.Text
type AttrTransferType SiFactoryNamePropertyInfo = T.Text
type AttrGetType SiFactoryNamePropertyInfo = T.Text
type AttrLabel SiFactoryNamePropertyInfo = "name"
type AttrOrigin SiFactoryNamePropertyInfo = SiFactory
attrGet = getSiFactoryName
attrSet = undefined
attrPut = undefined
attrTransfer _ v = do
return v
attrConstruct = constructSiFactoryName
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Wp.Objects.SiFactory.name"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14/docs/GI-Wp-Objects-SiFactory.html#g:attr:name"
})
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList SiFactory
type instance O.AttributeList SiFactory = SiFactoryAttributeList
type SiFactoryAttributeList = ('[ '("name", SiFactoryNamePropertyInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
siFactoryName :: AttrLabelProxy "name"
siFactoryName = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList SiFactory = SiFactorySignalList
type SiFactorySignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
-- method SiFactory::new_simple
-- method type : Constructor
-- Args: [ Arg
-- { argCName = "factory_name"
-- , argType = TBasicType TUTF8
-- , argCType = Just "const gchar*"
-- , direction = DirectionIn
-- , mayBeNull = False
-- , argDoc =
-- Documentation
-- { rawDocText = Just "the factory name; must be a static string!"
-- , sinceVersion = Nothing
-- }
-- , argScope = ScopeTypeInvalid
-- , argClosure = -1
-- , argDestroy = -1
-- , argCallerAllocates = False
-- , argCallbackUserData = False
-- , transfer = TransferNothing
-- }
-- , Arg
-- { argCName = "si_type"
-- , argType = TBasicType TGType
-- , argCType = Just "GType"
-- , direction = DirectionIn
-- , mayBeNull = False
-- , argDoc =
-- Documentation
-- { rawDocText =
-- Just
-- "the WpSessionItem subclass type to instantiate for constructing items"
-- , sinceVersion = Nothing
-- }
-- , argScope = ScopeTypeInvalid
-- , argClosure = -1
-- , argDestroy = -1
-- , argCallerAllocates = False
-- , argCallbackUserData = False
-- , transfer = TransferNothing
-- }
-- ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "SiFactory" })
-- throws : False
-- Skip return : False
foreign import ccall "wp_si_factory_new_simple" wp_si_factory_new_simple ::
CString -> -- factory_name : TBasicType TUTF8
CGType -> -- si_type : TBasicType TGType
IO (Ptr SiFactory)
-- | Creates a simple factory that constructs objects of a given GType.
siFactoryNewSimple ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-- ^ /@factoryName@/: the factory name; must be a static string!
-> GType
-- ^ /@siType@/: the WpSessionItem subclass type to instantiate for constructing items
-> m SiFactory
-- ^ __Returns:__ the new factory
siFactoryNewSimple factoryName siType = liftIO $ do
factoryName' <- textToCString factoryName
let siType' = gtypeToCGType siType
result <- wp_si_factory_new_simple factoryName' siType'
checkUnexpectedReturnNULL "siFactoryNewSimple" result
result' <- (wrapObject SiFactory) result
freeMem factoryName'
return result'
#if defined(ENABLE_OVERLOADING)
#endif
-- method SiFactory::construct
-- method type : OrdinaryMethod
-- Args: [ Arg
-- { argCName = "self"
-- , argType =
-- TInterface Name { namespace = "Wp" , name = "SiFactory" }
-- , argCType = Just "WpSiFactory*"
-- , direction = DirectionIn
-- , mayBeNull = False
-- , argDoc =
-- Documentation
-- { rawDocText = Just "the factory" , sinceVersion = Nothing }
-- , argScope = ScopeTypeInvalid
-- , argClosure = -1
-- , argDestroy = -1
-- , argCallerAllocates = False
-- , argCallbackUserData = False
-- , transfer = TransferNothing
-- }
-- , Arg
-- { argCName = "core"
-- , argType = TInterface Name { namespace = "Wp" , name = "Core" }
-- , argCType = Just "WpCore*"
-- , direction = DirectionIn
-- , mayBeNull = False
-- , argDoc =
-- Documentation
-- { rawDocText = Just "the core" , sinceVersion = Nothing }
-- , argScope = ScopeTypeInvalid
-- , argClosure = -1
-- , argDestroy = -1
-- , argCallerAllocates = False
-- , argCallbackUserData = False
-- , transfer = TransferNothing
-- }
-- ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "SessionItem" })
-- throws : False
-- Skip return : False
foreign import ccall "wp_si_factory_construct" wp_si_factory_construct ::
Ptr SiFactory -> -- self : TInterface (Name {namespace = "Wp", name = "SiFactory"})
Ptr Wp.Core.Core -> -- core : TInterface (Name {namespace = "Wp", name = "Core"})
IO (Ptr Wp.SessionItem.SessionItem)
-- | Creates a new instance of the session item that is constructed by this factory.
siFactoryConstruct ::
(B.CallStack.HasCallStack, MonadIO m, IsSiFactory a, Wp.Core.IsCore b) =>
a
-- ^ /@self@/: the factory
-> b
-- ^ /@core@/: the core
-> m Wp.SessionItem.SessionItem
-- ^ __Returns:__ a new session item instance
siFactoryConstruct self core = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
core' <- unsafeManagedPtrCastPtr core
result <- wp_si_factory_construct self' core'
checkUnexpectedReturnNULL "siFactoryConstruct" result
result' <- (wrapObject Wp.SessionItem.SessionItem) result
touchManagedPtr self
touchManagedPtr core
return result'
#if defined(ENABLE_OVERLOADING)
data SiFactoryConstructMethodInfo
instance (signature ~ (b -> m Wp.SessionItem.SessionItem), MonadIO m, IsSiFactory a, Wp.Core.IsCore b) => O.OverloadedMethod SiFactoryConstructMethodInfo a signature where
overloadedMethod = siFactoryConstruct
instance O.OverloadedMethodInfo SiFactoryConstructMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Wp.Objects.SiFactory.siFactoryConstruct",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14/docs/GI-Wp-Objects-SiFactory.html#v:siFactoryConstruct"
})
#endif
-- method SiFactory::get_name
-- method type : OrdinaryMethod
-- Args: [ Arg
-- { argCName = "self"
-- , argType =
-- TInterface Name { namespace = "Wp" , name = "SiFactory" }
-- , argCType = Just "WpSiFactory*"
-- , direction = DirectionIn
-- , mayBeNull = False
-- , argDoc =
-- Documentation
-- { rawDocText = Just "the factory" , 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_si_factory_get_name" wp_si_factory_get_name ::
Ptr SiFactory -> -- self : TInterface (Name {namespace = "Wp", name = "SiFactory"})
IO CString
-- | Gets the name of the factory.
siFactoryGetName ::
(B.CallStack.HasCallStack, MonadIO m, IsSiFactory a) =>
a
-- ^ /@self@/: the factory
-> m T.Text
-- ^ __Returns:__ the factory name
siFactoryGetName self = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
result <- wp_si_factory_get_name self'
checkUnexpectedReturnNULL "siFactoryGetName" result
result' <- cstringToText result
touchManagedPtr self
return result'
#if defined(ENABLE_OVERLOADING)
data SiFactoryGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsSiFactory a) => O.OverloadedMethod SiFactoryGetNameMethodInfo a signature where
overloadedMethod = siFactoryGetName
instance O.OverloadedMethodInfo SiFactoryGetNameMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Wp.Objects.SiFactory.siFactoryGetName",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14/docs/GI-Wp-Objects-SiFactory.html#v:siFactoryGetName"
})
#endif
-- method SiFactory::find
-- method type : MemberFunction
-- Args: [ Arg
-- { argCName = "core"
-- , argType = TInterface Name { namespace = "Wp" , name = "Core" }
-- , argCType = Just "WpCore*"
-- , direction = DirectionIn
-- , mayBeNull = False
-- , argDoc =
-- Documentation
-- { rawDocText = Just "the core" , sinceVersion = Nothing }
-- , argScope = ScopeTypeInvalid
-- , argClosure = -1
-- , argDestroy = -1
-- , argCallerAllocates = False
-- , argCallbackUserData = False
-- , transfer = TransferNothing
-- }
-- , Arg
-- { argCName = "factory_name"
-- , argType = TBasicType TUTF8
-- , argCType = Just "const gchar*"
-- , direction = DirectionIn
-- , mayBeNull = False
-- , argDoc =
-- Documentation
-- { rawDocText = Just "the lookup name" , sinceVersion = Nothing }
-- , argScope = ScopeTypeInvalid
-- , argClosure = -1
-- , argDestroy = -1
-- , argCallerAllocates = False
-- , argCallbackUserData = False
-- , transfer = TransferNothing
-- }
-- ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "SiFactory" })
-- throws : False
-- Skip return : False
foreign import ccall "wp_si_factory_find" wp_si_factory_find ::
Ptr Wp.Core.Core -> -- core : TInterface (Name {namespace = "Wp", name = "Core"})
CString -> -- factory_name : TBasicType TUTF8
IO (Ptr SiFactory)
-- | Looks up a factory matching a name.
siFactoryFind ::
(B.CallStack.HasCallStack, MonadIO m, Wp.Core.IsCore a) =>
a
-- ^ /@core@/: the core
-> T.Text
-- ^ /@factoryName@/: the lookup name
-> m (Maybe SiFactory)
-- ^ __Returns:__ the factory matching the lookup name
siFactoryFind core factoryName = liftIO $ do
core' <- unsafeManagedPtrCastPtr core
factoryName' <- textToCString factoryName
result <- wp_si_factory_find core' factoryName'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject SiFactory) result'
return result''
touchManagedPtr core
freeMem factoryName'
return maybeResult
#if defined(ENABLE_OVERLOADING)
#endif