{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

A 'GI.Gst.Structs.Structure.Structure' is a collection of key\/value pairs. The keys are expressed
as GQuarks and the values can be of any GType.

In addition to the key\/value pairs, a 'GI.Gst.Structs.Structure.Structure' also has a name. The name
starts with a letter and can be filled by letters, numbers and any of \"\/-_.:\".

'GI.Gst.Structs.Structure.Structure' is used by various GStreamer subsystems to store information
in a flexible and extensible way. A 'GI.Gst.Structs.Structure.Structure' does not have a refcount
because it usually is part of a higher level object such as 'GI.Gst.Structs.Caps.Caps',
'GI.Gst.Structs.Message.Message', 'GI.Gst.Structs.Event.Event', 'GI.Gst.Structs.Query.Query'. It provides a means to enforce mutability
using the refcount of the parent with the 'GI.Gst.Structs.Structure.structureSetParentRefcount'
method.

A 'GI.Gst.Structs.Structure.Structure' can be created with 'GI.Gst.Structs.Structure.structureNewEmpty' or
@/gst_structure_new()/@, which both take a name and an optional set of
key\/value pairs along with the types of the values.

Field values can be changed with 'GI.Gst.Structs.Structure.structureSetValue' or
@/gst_structure_set()/@.

Field values can be retrieved with 'GI.Gst.Structs.Structure.structureGetValue' or the more
convenient gst_structure_get_*() functions.

Fields can be removed with 'GI.Gst.Structs.Structure.structureRemoveField' or
@/gst_structure_remove_fields()/@.

Strings in structures must be ASCII or UTF-8 encoded. Other encodings are
not allowed. Strings may be 'Nothing' however.

Be aware that the current 'GI.Gst.Structs.Caps.Caps' \/ 'GI.Gst.Structs.Structure.Structure' serialization into string
has limited support for nested 'GI.Gst.Structs.Caps.Caps' \/ 'GI.Gst.Structs.Structure.Structure' fields. It can only
support one level of nesting. Using more levels will lead to unexpected
behavior when using serialization features, such as 'GI.Gst.Structs.Caps.capsToString' or
'GI.Gst.Functions.valueSerialize' and their counterparts.
-}

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

module GI.Gst.Structs.Structure
    (

-- * Exported types
    Structure(..)                           ,
    newZeroStructure                        ,
    noStructure                             ,


 -- * Methods
-- ** canIntersect #method:canIntersect#

#if ENABLE_OVERLOADING
    StructureCanIntersectMethodInfo         ,
#endif
    structureCanIntersect                   ,


-- ** copy #method:copy#

#if ENABLE_OVERLOADING
    StructureCopyMethodInfo                 ,
#endif
    structureCopy                           ,


-- ** filterAndMapInPlace #method:filterAndMapInPlace#

#if ENABLE_OVERLOADING
    StructureFilterAndMapInPlaceMethodInfo  ,
#endif
    structureFilterAndMapInPlace            ,


-- ** fixate #method:fixate#

#if ENABLE_OVERLOADING
    StructureFixateMethodInfo               ,
#endif
    structureFixate                         ,


-- ** fixateField #method:fixateField#

#if ENABLE_OVERLOADING
    StructureFixateFieldMethodInfo          ,
#endif
    structureFixateField                    ,


-- ** fixateFieldBoolean #method:fixateFieldBoolean#

#if ENABLE_OVERLOADING
    StructureFixateFieldBooleanMethodInfo   ,
#endif
    structureFixateFieldBoolean             ,


-- ** fixateFieldNearestDouble #method:fixateFieldNearestDouble#

#if ENABLE_OVERLOADING
    StructureFixateFieldNearestDoubleMethodInfo,
#endif
    structureFixateFieldNearestDouble       ,


-- ** fixateFieldNearestFraction #method:fixateFieldNearestFraction#

#if ENABLE_OVERLOADING
    StructureFixateFieldNearestFractionMethodInfo,
#endif
    structureFixateFieldNearestFraction     ,


-- ** fixateFieldNearestInt #method:fixateFieldNearestInt#

#if ENABLE_OVERLOADING
    StructureFixateFieldNearestIntMethodInfo,
#endif
    structureFixateFieldNearestInt          ,


-- ** fixateFieldString #method:fixateFieldString#

#if ENABLE_OVERLOADING
    StructureFixateFieldStringMethodInfo    ,
#endif
    structureFixateFieldString              ,


-- ** foreach #method:foreach#

#if ENABLE_OVERLOADING
    StructureForeachMethodInfo              ,
#endif
    structureForeach                        ,


-- ** free #method:free#

#if ENABLE_OVERLOADING
    StructureFreeMethodInfo                 ,
#endif
    structureFree                           ,


-- ** fromString #method:fromString#

    structureFromString                     ,


-- ** getArray #method:getArray#

#if ENABLE_OVERLOADING
    StructureGetArrayMethodInfo             ,
#endif
    structureGetArray                       ,


-- ** getBoolean #method:getBoolean#

#if ENABLE_OVERLOADING
    StructureGetBooleanMethodInfo           ,
#endif
    structureGetBoolean                     ,


-- ** getClockTime #method:getClockTime#

#if ENABLE_OVERLOADING
    StructureGetClockTimeMethodInfo         ,
#endif
    structureGetClockTime                   ,


-- ** getDate #method:getDate#

#if ENABLE_OVERLOADING
    StructureGetDateMethodInfo              ,
#endif
    structureGetDate                        ,


-- ** getDateTime #method:getDateTime#

#if ENABLE_OVERLOADING
    StructureGetDateTimeMethodInfo          ,
#endif
    structureGetDateTime                    ,


-- ** getDouble #method:getDouble#

#if ENABLE_OVERLOADING
    StructureGetDoubleMethodInfo            ,
#endif
    structureGetDouble                      ,


-- ** getEnum #method:getEnum#

#if ENABLE_OVERLOADING
    StructureGetEnumMethodInfo              ,
#endif
    structureGetEnum                        ,


-- ** getFieldType #method:getFieldType#

#if ENABLE_OVERLOADING
    StructureGetFieldTypeMethodInfo         ,
#endif
    structureGetFieldType                   ,


-- ** getFlagset #method:getFlagset#

#if ENABLE_OVERLOADING
    StructureGetFlagsetMethodInfo           ,
#endif
    structureGetFlagset                     ,


-- ** getFraction #method:getFraction#

#if ENABLE_OVERLOADING
    StructureGetFractionMethodInfo          ,
#endif
    structureGetFraction                    ,


-- ** getInt #method:getInt#

#if ENABLE_OVERLOADING
    StructureGetIntMethodInfo               ,
#endif
    structureGetInt                         ,


-- ** getInt64 #method:getInt64#

#if ENABLE_OVERLOADING
    StructureGetInt64MethodInfo             ,
#endif
    structureGetInt64                       ,


-- ** getList #method:getList#

#if ENABLE_OVERLOADING
    StructureGetListMethodInfo              ,
#endif
    structureGetList                        ,


-- ** getName #method:getName#

#if ENABLE_OVERLOADING
    StructureGetNameMethodInfo              ,
#endif
    structureGetName                        ,


-- ** getNameId #method:getNameId#

#if ENABLE_OVERLOADING
    StructureGetNameIdMethodInfo            ,
#endif
    structureGetNameId                      ,


-- ** getString #method:getString#

#if ENABLE_OVERLOADING
    StructureGetStringMethodInfo            ,
#endif
    structureGetString                      ,


-- ** getUint #method:getUint#

#if ENABLE_OVERLOADING
    StructureGetUintMethodInfo              ,
#endif
    structureGetUint                        ,


-- ** getUint64 #method:getUint64#

#if ENABLE_OVERLOADING
    StructureGetUint64MethodInfo            ,
#endif
    structureGetUint64                      ,


-- ** getValue #method:getValue#

#if ENABLE_OVERLOADING
    StructureGetValueMethodInfo             ,
#endif
    structureGetValue                       ,


-- ** hasField #method:hasField#

#if ENABLE_OVERLOADING
    StructureHasFieldMethodInfo             ,
#endif
    structureHasField                       ,


-- ** hasFieldTyped #method:hasFieldTyped#

#if ENABLE_OVERLOADING
    StructureHasFieldTypedMethodInfo        ,
#endif
    structureHasFieldTyped                  ,


-- ** hasName #method:hasName#

#if ENABLE_OVERLOADING
    StructureHasNameMethodInfo              ,
#endif
    structureHasName                        ,


-- ** idGetValue #method:idGetValue#

#if ENABLE_OVERLOADING
    StructureIdGetValueMethodInfo           ,
#endif
    structureIdGetValue                     ,


-- ** idHasField #method:idHasField#

#if ENABLE_OVERLOADING
    StructureIdHasFieldMethodInfo           ,
#endif
    structureIdHasField                     ,


-- ** idHasFieldTyped #method:idHasFieldTyped#

#if ENABLE_OVERLOADING
    StructureIdHasFieldTypedMethodInfo      ,
#endif
    structureIdHasFieldTyped                ,


-- ** idSetValue #method:idSetValue#

#if ENABLE_OVERLOADING
    StructureIdSetValueMethodInfo           ,
#endif
    structureIdSetValue                     ,


-- ** idTakeValue #method:idTakeValue#

#if ENABLE_OVERLOADING
    StructureIdTakeValueMethodInfo          ,
#endif
    structureIdTakeValue                    ,


-- ** intersect #method:intersect#

#if ENABLE_OVERLOADING
    StructureIntersectMethodInfo            ,
#endif
    structureIntersect                      ,


-- ** isEqual #method:isEqual#

#if ENABLE_OVERLOADING
    StructureIsEqualMethodInfo              ,
#endif
    structureIsEqual                        ,


-- ** isSubset #method:isSubset#

#if ENABLE_OVERLOADING
    StructureIsSubsetMethodInfo             ,
#endif
    structureIsSubset                       ,


-- ** mapInPlace #method:mapInPlace#

#if ENABLE_OVERLOADING
    StructureMapInPlaceMethodInfo           ,
#endif
    structureMapInPlace                     ,


-- ** nFields #method:nFields#

#if ENABLE_OVERLOADING
    StructureNFieldsMethodInfo              ,
#endif
    structureNFields                        ,


-- ** newEmpty #method:newEmpty#

    structureNewEmpty                       ,


-- ** newFromString #method:newFromString#

    structureNewFromString                  ,


-- ** newIdEmpty #method:newIdEmpty#

    structureNewIdEmpty                     ,


-- ** nthFieldName #method:nthFieldName#

#if ENABLE_OVERLOADING
    StructureNthFieldNameMethodInfo         ,
#endif
    structureNthFieldName                   ,


-- ** removeAllFields #method:removeAllFields#

#if ENABLE_OVERLOADING
    StructureRemoveAllFieldsMethodInfo      ,
#endif
    structureRemoveAllFields                ,


-- ** removeField #method:removeField#

#if ENABLE_OVERLOADING
    StructureRemoveFieldMethodInfo          ,
#endif
    structureRemoveField                    ,


-- ** setArray #method:setArray#

#if ENABLE_OVERLOADING
    StructureSetArrayMethodInfo             ,
#endif
    structureSetArray                       ,


-- ** setList #method:setList#

#if ENABLE_OVERLOADING
    StructureSetListMethodInfo              ,
#endif
    structureSetList                        ,


-- ** setName #method:setName#

#if ENABLE_OVERLOADING
    StructureSetNameMethodInfo              ,
#endif
    structureSetName                        ,


-- ** setParentRefcount #method:setParentRefcount#

#if ENABLE_OVERLOADING
    StructureSetParentRefcountMethodInfo    ,
#endif
    structureSetParentRefcount              ,


-- ** setValue #method:setValue#

#if ENABLE_OVERLOADING
    StructureSetValueMethodInfo             ,
#endif
    structureSetValue                       ,


-- ** takeValue #method:takeValue#

#if ENABLE_OVERLOADING
    StructureTakeValueMethodInfo            ,
#endif
    structureTakeValue                      ,


-- ** toString #method:toString#

#if ENABLE_OVERLOADING
    StructureToStringMethodInfo             ,
#endif
    structureToString                       ,




 -- * Properties
-- ** type #attr:type#
{- | the GType of a structure
-}
    getStructureType                        ,
    setStructureType                        ,
#if ENABLE_OVERLOADING
    structure_type                          ,
#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.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

import qualified GI.GLib.Structs.Date as GLib.Date
import qualified GI.GObject.Structs.ValueArray as GObject.ValueArray
import qualified GI.Gst.Callbacks as Gst.Callbacks
import {-# SOURCE #-} qualified GI.Gst.Structs.DateTime as Gst.DateTime

-- | Memory-managed wrapper type.
newtype Structure = Structure (ManagedPtr Structure)
foreign import ccall "gst_structure_get_type" c_gst_structure_get_type ::
    IO GType

instance BoxedObject Structure where
    boxedType _ = c_gst_structure_get_type

-- | Construct a `Structure` struct initialized to zero.
newZeroStructure :: MonadIO m => m Structure
newZeroStructure = liftIO $ callocBoxedBytes 16 >>= wrapBoxed Structure

instance tag ~ 'AttrSet => Constructible Structure tag where
    new _ attrs = do
        o <- newZeroStructure
        GI.Attributes.set o attrs
        return o


-- | A convenience alias for `Nothing` :: `Maybe` `Structure`.
noStructure :: Maybe Structure
noStructure = Nothing

{- |
Get the value of the “@type@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' structure #type
@
-}
getStructureType :: MonadIO m => Structure -> m GType
getStructureType s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO CGType
    let val' = GType val
    return val'

{- |
Set the value of the “@type@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' structure [ #type 'Data.GI.Base.Attributes.:=' value ]
@
-}
setStructureType :: MonadIO m => Structure -> GType -> m ()
setStructureType s val = liftIO $ withManagedPtr s $ \ptr -> do
    let val' = gtypeToCGType val
    poke (ptr `plusPtr` 0) (val' :: CGType)

#if ENABLE_OVERLOADING
data StructureTypeFieldInfo
instance AttrInfo StructureTypeFieldInfo where
    type AttrAllowedOps StructureTypeFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint StructureTypeFieldInfo = (~) GType
    type AttrBaseTypeConstraint StructureTypeFieldInfo = (~) Structure
    type AttrGetType StructureTypeFieldInfo = GType
    type AttrLabel StructureTypeFieldInfo = "type"
    type AttrOrigin StructureTypeFieldInfo = Structure
    attrGet _ = getStructureType
    attrSet _ = setStructureType
    attrConstruct = undefined
    attrClear _ = undefined

structure_type :: AttrLabelProxy "type"
structure_type = AttrLabelProxy

#endif



#if ENABLE_OVERLOADING
instance O.HasAttributeList Structure
type instance O.AttributeList Structure = StructureAttributeList
type StructureAttributeList = ('[ '("type", StructureTypeFieldInfo)] :: [(Symbol, *)])
#endif

-- method Structure::new_empty
-- method type : Constructor
-- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "name of new structure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Structure"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_new_empty" gst_structure_new_empty ::
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Structure)

{- |
Creates a new, empty 'GI.Gst.Structs.Structure.Structure' with the given /@name@/.

See 'GI.Gst.Structs.Structure.structureSetName' for constraints on the /@name@/ parameter.

Free-function: gst_structure_free
-}
structureNewEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@name@/: name of new structure -}
    -> m Structure
    {- ^ __Returns:__ a new, empty 'GI.Gst.Structs.Structure.Structure' -}
structureNewEmpty name = liftIO $ do
    name' <- textToCString name
    result <- gst_structure_new_empty name'
    checkUnexpectedReturnNULL "structureNewEmpty" result
    result' <- (wrapBoxed Structure) result
    freeMem name'
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Structure::new_from_string
-- method type : Constructor
-- Args : [Arg {argCName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a string representation of a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Structure"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_new_from_string" gst_structure_new_from_string ::
    CString ->                              -- string : TBasicType TUTF8
    IO (Ptr Structure)

{- |
Creates a 'GI.Gst.Structs.Structure.Structure' from a string representation.
If end is not 'Nothing', a pointer to the place inside the given string
where parsing ended will be returned.

The current implementation of serialization will lead to unexpected results
when there are nested 'GI.Gst.Structs.Caps.Caps' \/ 'GI.Gst.Structs.Structure.Structure' deeper than one level.

Free-function: gst_structure_free

/Since: 1.2/
-}
structureNewFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@string@/: a string representation of a 'GI.Gst.Structs.Structure.Structure' -}
    -> m (Maybe Structure)
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Structure.Structure' or 'Nothing'
    when the string could not be parsed. Free with
    'GI.Gst.Structs.Structure.structureFree' after use. -}
structureNewFromString string = liftIO $ do
    string' <- textToCString string
    result <- gst_structure_new_from_string string'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Structure) result'
        return result''
    freeMem string'
    return maybeResult

#if ENABLE_OVERLOADING
#endif

-- method Structure::new_id_empty
-- method type : Constructor
-- Args : [Arg {argCName = "quark", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "name of new structure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Structure"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_new_id_empty" gst_structure_new_id_empty ::
    Word32 ->                               -- quark : TBasicType TUInt32
    IO (Ptr Structure)

{- |
Creates a new, empty 'GI.Gst.Structs.Structure.Structure' with the given name as a GQuark.

Free-function: gst_structure_free
-}
structureNewIdEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    {- ^ /@quark@/: name of new structure -}
    -> m Structure
    {- ^ __Returns:__ a new, empty 'GI.Gst.Structs.Structure.Structure' -}
structureNewIdEmpty quark = liftIO $ do
    result <- gst_structure_new_id_empty quark
    checkUnexpectedReturnNULL "structureNewIdEmpty" result
    result' <- (wrapBoxed Structure) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Structure::can_intersect
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "struct1", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "struct2", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_can_intersect" gst_structure_can_intersect ::
    Ptr Structure ->                        -- struct1 : TInterface (Name {namespace = "Gst", name = "Structure"})
    Ptr Structure ->                        -- struct2 : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO CInt

{- |
Tries intersecting /@struct1@/ and /@struct2@/ and reports whether the result
would not be empty.
-}
structureCanIntersect ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@struct1@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> Structure
    {- ^ /@struct2@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if intersection would not be empty -}
structureCanIntersect struct1 struct2 = liftIO $ do
    struct1' <- unsafeManagedPtrGetPtr struct1
    struct2' <- unsafeManagedPtrGetPtr struct2
    result <- gst_structure_can_intersect struct1' struct2'
    let result' = (/= 0) result
    touchManagedPtr struct1
    touchManagedPtr struct2
    return result'

#if ENABLE_OVERLOADING
data StructureCanIntersectMethodInfo
instance (signature ~ (Structure -> m Bool), MonadIO m) => O.MethodInfo StructureCanIntersectMethodInfo Structure signature where
    overloadedMethod _ = structureCanIntersect

#endif

-- method Structure::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure to duplicate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Structure"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_copy" gst_structure_copy ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO (Ptr Structure)

{- |
Duplicates a 'GI.Gst.Structs.Structure.Structure' and all its fields and values.

Free-function: gst_structure_free
-}
structureCopy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' to duplicate -}
    -> m Structure
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Structure.Structure'. -}
structureCopy structure = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    result <- gst_structure_copy structure'
    checkUnexpectedReturnNULL "structureCopy" result
    result' <- (wrapBoxed Structure) result
    touchManagedPtr structure
    return result'

#if ENABLE_OVERLOADING
data StructureCopyMethodInfo
instance (signature ~ (m Structure), MonadIO m) => O.MethodInfo StructureCopyMethodInfo Structure signature where
    overloadedMethod _ = structureCopy

#endif

-- method Structure::filter_and_map_in_place
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "func", argType = TInterface (Name {namespace = "Gst", name = "StructureFilterMapFunc"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a function to call for each field", sinceVersion = Nothing}, argScope = ScopeTypeCall, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "private data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_filter_and_map_in_place" gst_structure_filter_and_map_in_place ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    FunPtr Gst.Callbacks.C_StructureFilterMapFunc -> -- func : TInterface (Name {namespace = "Gst", name = "StructureFilterMapFunc"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
Calls the provided function once for each field in the 'GI.Gst.Structs.Structure.Structure'. In
contrast to 'GI.Gst.Structs.Structure.structureForeach', the function may modify the fields.
In contrast to 'GI.Gst.Structs.Structure.structureMapInPlace', the field is removed from
the structure if 'False' is returned from the function.
The structure must be mutable.

/Since: 1.6/
-}
structureFilterAndMapInPlace ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> Gst.Callbacks.StructureFilterMapFunc
    {- ^ /@func@/: a function to call for each field -}
    -> m ()
structureFilterAndMapInPlace structure func = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    func' <- Gst.Callbacks.mk_StructureFilterMapFunc (Gst.Callbacks.wrap_StructureFilterMapFunc Nothing (Gst.Callbacks.drop_closures_StructureFilterMapFunc func))
    let userData = nullPtr
    gst_structure_filter_and_map_in_place structure' func' userData
    safeFreeFunPtr $ castFunPtrToPtr func'
    touchManagedPtr structure
    return ()

#if ENABLE_OVERLOADING
data StructureFilterAndMapInPlaceMethodInfo
instance (signature ~ (Gst.Callbacks.StructureFilterMapFunc -> m ()), MonadIO m) => O.MethodInfo StructureFilterAndMapInPlaceMethodInfo Structure signature where
    overloadedMethod _ = structureFilterAndMapInPlace

#endif

-- method Structure::fixate
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_fixate" gst_structure_fixate ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO ()

{- |
Fixate all values in /@structure@/ using 'GI.Gst.Functions.valueFixate'.
/@structure@/ will be modified in-place and should be writable.
-}
structureFixate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> m ()
structureFixate structure = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    gst_structure_fixate structure'
    touchManagedPtr structure
    return ()

#if ENABLE_OVERLOADING
data StructureFixateMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo StructureFixateMethodInfo Structure signature where
    overloadedMethod _ = structureFixate

#endif

-- method Structure::fixate_field
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "field_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a field in @structure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_fixate_field" gst_structure_fixate_field ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- field_name : TBasicType TUTF8
    IO CInt

{- |
Fixates a 'GI.Gst.Structs.Structure.Structure' by changing the given field with its fixated value.
-}
structureFixateField ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldName@/: a field in /@structure@/ -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the structure field could be fixated -}
structureFixateField structure fieldName = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldName' <- textToCString fieldName
    result <- gst_structure_fixate_field structure' fieldName'
    let result' = (/= 0) result
    touchManagedPtr structure
    freeMem fieldName'
    return result'

#if ENABLE_OVERLOADING
data StructureFixateFieldMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo StructureFixateFieldMethodInfo Structure signature where
    overloadedMethod _ = structureFixateField

#endif

-- method Structure::fixate_field_boolean
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "field_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a field in @structure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "target", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the target value of the fixation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_fixate_field_boolean" gst_structure_fixate_field_boolean ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- field_name : TBasicType TUTF8
    CInt ->                                 -- target : TBasicType TBoolean
    IO CInt

{- |
Fixates a 'GI.Gst.Structs.Structure.Structure' by changing the given /@fieldName@/ field to the given
/@target@/ boolean if that field is not fixed yet.
-}
structureFixateFieldBoolean ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldName@/: a field in /@structure@/ -}
    -> Bool
    {- ^ /@target@/: the target value of the fixation -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the structure could be fixated -}
structureFixateFieldBoolean structure fieldName target = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldName' <- textToCString fieldName
    let target' = (fromIntegral . fromEnum) target
    result <- gst_structure_fixate_field_boolean structure' fieldName' target'
    let result' = (/= 0) result
    touchManagedPtr structure
    freeMem fieldName'
    return result'

#if ENABLE_OVERLOADING
data StructureFixateFieldBooleanMethodInfo
instance (signature ~ (T.Text -> Bool -> m Bool), MonadIO m) => O.MethodInfo StructureFixateFieldBooleanMethodInfo Structure signature where
    overloadedMethod _ = structureFixateFieldBoolean

#endif

-- method Structure::fixate_field_nearest_double
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "field_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a field in @structure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "target", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the target value of the fixation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_fixate_field_nearest_double" gst_structure_fixate_field_nearest_double ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- field_name : TBasicType TUTF8
    CDouble ->                              -- target : TBasicType TDouble
    IO CInt

{- |
Fixates a 'GI.Gst.Structs.Structure.Structure' by changing the given field to the nearest
double to /@target@/ that is a subset of the existing field.
-}
structureFixateFieldNearestDouble ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldName@/: a field in /@structure@/ -}
    -> Double
    {- ^ /@target@/: the target value of the fixation -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the structure could be fixated -}
structureFixateFieldNearestDouble structure fieldName target = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldName' <- textToCString fieldName
    let target' = realToFrac target
    result <- gst_structure_fixate_field_nearest_double structure' fieldName' target'
    let result' = (/= 0) result
    touchManagedPtr structure
    freeMem fieldName'
    return result'

#if ENABLE_OVERLOADING
data StructureFixateFieldNearestDoubleMethodInfo
instance (signature ~ (T.Text -> Double -> m Bool), MonadIO m) => O.MethodInfo StructureFixateFieldNearestDoubleMethodInfo Structure signature where
    overloadedMethod _ = structureFixateFieldNearestDouble

#endif

-- method Structure::fixate_field_nearest_fraction
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "field_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a field in @structure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "target_numerator", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The numerator of the target value of the fixation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "target_denominator", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The denominator of the target value of the fixation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_fixate_field_nearest_fraction" gst_structure_fixate_field_nearest_fraction ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- field_name : TBasicType TUTF8
    Int32 ->                                -- target_numerator : TBasicType TInt
    Int32 ->                                -- target_denominator : TBasicType TInt
    IO CInt

{- |
Fixates a 'GI.Gst.Structs.Structure.Structure' by changing the given field to the nearest
fraction to /@targetNumerator@/\//@targetDenominator@/ that is a subset
of the existing field.
-}
structureFixateFieldNearestFraction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldName@/: a field in /@structure@/ -}
    -> Int32
    {- ^ /@targetNumerator@/: The numerator of the target value of the fixation -}
    -> Int32
    {- ^ /@targetDenominator@/: The denominator of the target value of the fixation -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the structure could be fixated -}
structureFixateFieldNearestFraction structure fieldName targetNumerator targetDenominator = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldName' <- textToCString fieldName
    result <- gst_structure_fixate_field_nearest_fraction structure' fieldName' targetNumerator targetDenominator
    let result' = (/= 0) result
    touchManagedPtr structure
    freeMem fieldName'
    return result'

#if ENABLE_OVERLOADING
data StructureFixateFieldNearestFractionMethodInfo
instance (signature ~ (T.Text -> Int32 -> Int32 -> m Bool), MonadIO m) => O.MethodInfo StructureFixateFieldNearestFractionMethodInfo Structure signature where
    overloadedMethod _ = structureFixateFieldNearestFraction

#endif

-- method Structure::fixate_field_nearest_int
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "field_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a field in @structure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "target", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the target value of the fixation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_fixate_field_nearest_int" gst_structure_fixate_field_nearest_int ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- field_name : TBasicType TUTF8
    Int32 ->                                -- target : TBasicType TInt
    IO CInt

{- |
Fixates a 'GI.Gst.Structs.Structure.Structure' by changing the given field to the nearest
integer to /@target@/ that is a subset of the existing field.
-}
structureFixateFieldNearestInt ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldName@/: a field in /@structure@/ -}
    -> Int32
    {- ^ /@target@/: the target value of the fixation -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the structure could be fixated -}
structureFixateFieldNearestInt structure fieldName target = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldName' <- textToCString fieldName
    result <- gst_structure_fixate_field_nearest_int structure' fieldName' target
    let result' = (/= 0) result
    touchManagedPtr structure
    freeMem fieldName'
    return result'

#if ENABLE_OVERLOADING
data StructureFixateFieldNearestIntMethodInfo
instance (signature ~ (T.Text -> Int32 -> m Bool), MonadIO m) => O.MethodInfo StructureFixateFieldNearestIntMethodInfo Structure signature where
    overloadedMethod _ = structureFixateFieldNearestInt

#endif

-- method Structure::fixate_field_string
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "field_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a field in @structure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "target", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the target value of the fixation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_fixate_field_string" gst_structure_fixate_field_string ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- field_name : TBasicType TUTF8
    CString ->                              -- target : TBasicType TUTF8
    IO CInt

{- |
Fixates a 'GI.Gst.Structs.Structure.Structure' by changing the given /@fieldName@/ field to the given
/@target@/ string if that field is not fixed yet.
-}
structureFixateFieldString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldName@/: a field in /@structure@/ -}
    -> T.Text
    {- ^ /@target@/: the target value of the fixation -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the structure could be fixated -}
structureFixateFieldString structure fieldName target = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldName' <- textToCString fieldName
    target' <- textToCString target
    result <- gst_structure_fixate_field_string structure' fieldName' target'
    let result' = (/= 0) result
    touchManagedPtr structure
    freeMem fieldName'
    freeMem target'
    return result'

#if ENABLE_OVERLOADING
data StructureFixateFieldStringMethodInfo
instance (signature ~ (T.Text -> T.Text -> m Bool), MonadIO m) => O.MethodInfo StructureFixateFieldStringMethodInfo Structure signature where
    overloadedMethod _ = structureFixateFieldString

#endif

-- method Structure::foreach
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "func", argType = TInterface (Name {namespace = "Gst", name = "StructureForeachFunc"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a function to call for each field", sinceVersion = Nothing}, argScope = ScopeTypeCall, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "private data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_foreach" gst_structure_foreach ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    FunPtr Gst.Callbacks.C_StructureForeachFunc -> -- func : TInterface (Name {namespace = "Gst", name = "StructureForeachFunc"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO CInt

{- |
Calls the provided function once for each field in the 'GI.Gst.Structs.Structure.Structure'. The
function must not modify the fields. Also see 'GI.Gst.Structs.Structure.structureMapInPlace'
and 'GI.Gst.Structs.Structure.structureFilterAndMapInPlace'.
-}
structureForeach ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> Gst.Callbacks.StructureForeachFunc
    {- ^ /@func@/: a function to call for each field -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the supplied function returns 'True' For each of the fields,
'False' otherwise. -}
structureForeach structure func = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    func' <- Gst.Callbacks.mk_StructureForeachFunc (Gst.Callbacks.wrap_StructureForeachFunc Nothing (Gst.Callbacks.drop_closures_StructureForeachFunc func))
    let userData = nullPtr
    result <- gst_structure_foreach structure' func' userData
    let result' = (/= 0) result
    safeFreeFunPtr $ castFunPtrToPtr func'
    touchManagedPtr structure
    return result'

#if ENABLE_OVERLOADING
data StructureForeachMethodInfo
instance (signature ~ (Gst.Callbacks.StructureForeachFunc -> m Bool), MonadIO m) => O.MethodInfo StructureForeachMethodInfo Structure signature where
    overloadedMethod _ = structureForeach

#endif

-- method Structure::free
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstStructure to free", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_free" gst_structure_free ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO ()

{- |
Frees a 'GI.Gst.Structs.Structure.Structure' and all its fields and values. The structure must not
have a parent when this function is called.
-}
structureFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: the 'GI.Gst.Structs.Structure.Structure' to free -}
    -> m ()
structureFree structure = liftIO $ do
    structure' <- B.ManagedPtr.disownBoxed structure
    gst_structure_free structure'
    touchManagedPtr structure
    return ()

#if ENABLE_OVERLOADING
data StructureFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo StructureFreeMethodInfo Structure signature where
    overloadedMethod _ = structureFree

#endif

-- method Structure::get_array
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "array", argType = TInterface (Name {namespace = "GObject", name = "ValueArray"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a #GValueArray", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_get_array" gst_structure_get_array ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    Ptr (Ptr GObject.ValueArray.ValueArray) -> -- array : TInterface (Name {namespace = "GObject", name = "ValueArray"})
    IO CInt

{- |
This is useful in language bindings where unknown 'GI.GObject.Structs.Value.Value' types are not
supported. This function will convert the @/GST_TYPE_ARRAY/@ into a newly
allocated 'GI.GObject.Structs.ValueArray.ValueArray' and return it through /@array@/. Be aware that this is
slower then getting the 'GI.GObject.Structs.Value.Value' directly.
-}
structureGetArray ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> m ((Bool, GObject.ValueArray.ValueArray))
    {- ^ __Returns:__ 'True' if the value could be set correctly. If there was no field
with /@fieldname@/ or the existing field did not contain a @/GST_TYPE_ARRAY/@,
this function returns 'False'. -}
structureGetArray structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    array <- allocMem :: IO (Ptr (Ptr GObject.ValueArray.ValueArray))
    result <- gst_structure_get_array structure' fieldname' array
    let result' = (/= 0) result
    array' <- peek array
    array'' <- (wrapBoxed GObject.ValueArray.ValueArray) array'
    touchManagedPtr structure
    freeMem fieldname'
    freeMem array
    return (result', array'')

#if ENABLE_OVERLOADING
data StructureGetArrayMethodInfo
instance (signature ~ (T.Text -> m ((Bool, GObject.ValueArray.ValueArray))), MonadIO m) => O.MethodInfo StructureGetArrayMethodInfo Structure signature where
    overloadedMethod _ = structureGetArray

#endif

-- method Structure::get_boolean
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a #gboolean to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_get_boolean" gst_structure_get_boolean ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    Ptr CInt ->                             -- value : TBasicType TBoolean
    IO CInt

{- |
Sets the boolean pointed to by /@value@/ corresponding to the value of the
given field.  Caller is responsible for making sure the field exists
and has the correct type.
-}
structureGetBoolean ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> m ((Bool, Bool))
    {- ^ __Returns:__ 'True' if the value could be set correctly. If there was no field
with /@fieldname@/ or the existing field did not contain a boolean, this
function returns 'False'. -}
structureGetBoolean structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    value <- allocMem :: IO (Ptr CInt)
    result <- gst_structure_get_boolean structure' fieldname' value
    let result' = (/= 0) result
    value' <- peek value
    let value'' = (/= 0) value'
    touchManagedPtr structure
    freeMem fieldname'
    freeMem value
    return (result', value'')

#if ENABLE_OVERLOADING
data StructureGetBooleanMethodInfo
instance (signature ~ (T.Text -> m ((Bool, Bool))), MonadIO m) => O.MethodInfo StructureGetBooleanMethodInfo Structure signature where
    overloadedMethod _ = structureGetBoolean

#endif

-- method Structure::get_clock_time
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a #GstClockTime to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_get_clock_time" gst_structure_get_clock_time ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    Ptr Word64 ->                           -- value : TBasicType TUInt64
    IO CInt

{- |
Sets the clock time pointed to by /@value@/ corresponding to the clock time
of the given field.  Caller is responsible for making sure the field exists
and has the correct type.
-}
structureGetClockTime ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> m ((Bool, Word64))
    {- ^ __Returns:__ 'True' if the value could be set correctly. If there was no field
with /@fieldname@/ or the existing field did not contain a @/GstClockTime/@, this
function returns 'False'. -}
structureGetClockTime structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    value <- allocMem :: IO (Ptr Word64)
    result <- gst_structure_get_clock_time structure' fieldname' value
    let result' = (/= 0) result
    value' <- peek value
    touchManagedPtr structure
    freeMem fieldname'
    freeMem value
    return (result', value')

#if ENABLE_OVERLOADING
data StructureGetClockTimeMethodInfo
instance (signature ~ (T.Text -> m ((Bool, Word64))), MonadIO m) => O.MethodInfo StructureGetClockTimeMethodInfo Structure signature where
    overloadedMethod _ = structureGetClockTime

#endif

-- method Structure::get_date
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a #GDate to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_get_date" gst_structure_get_date ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    Ptr (Ptr GLib.Date.Date) ->             -- value : TInterface (Name {namespace = "GLib", name = "Date"})
    IO CInt

{- |
Sets the date pointed to by /@value@/ corresponding to the date of the
given field.  Caller is responsible for making sure the field exists
and has the correct type.

On success /@value@/ will point to a newly-allocated copy of the date which
should be freed with 'GI.GLib.Structs.Date.dateFree' when no longer needed (note: this is
inconsistent with e.g. 'GI.Gst.Structs.Structure.structureGetString' which doesn\'t return a
copy of the string).
-}
structureGetDate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> m ((Bool, GLib.Date.Date))
    {- ^ __Returns:__ 'True' if the value could be set correctly. If there was no field
with /@fieldname@/ or the existing field did not contain a data, this function
returns 'False'. -}
structureGetDate structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    value <- allocMem :: IO (Ptr (Ptr GLib.Date.Date))
    result <- gst_structure_get_date structure' fieldname' value
    let result' = (/= 0) result
    value' <- peek value
    value'' <- (wrapBoxed GLib.Date.Date) value'
    touchManagedPtr structure
    freeMem fieldname'
    freeMem value
    return (result', value'')

#if ENABLE_OVERLOADING
data StructureGetDateMethodInfo
instance (signature ~ (T.Text -> m ((Bool, GLib.Date.Date))), MonadIO m) => O.MethodInfo StructureGetDateMethodInfo Structure signature where
    overloadedMethod _ = structureGetDate

#endif

-- method Structure::get_date_time
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TInterface (Name {namespace = "Gst", name = "DateTime"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a #GstDateTime to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_get_date_time" gst_structure_get_date_time ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    Ptr (Ptr Gst.DateTime.DateTime) ->      -- value : TInterface (Name {namespace = "Gst", name = "DateTime"})
    IO CInt

{- |
Sets the datetime pointed to by /@value@/ corresponding to the datetime of the
given field. Caller is responsible for making sure the field exists
and has the correct type.

On success /@value@/ will point to a reference of the datetime which
should be unreffed with 'GI.Gst.Structs.DateTime.dateTimeUnref' when no longer needed
(note: this is inconsistent with e.g. 'GI.Gst.Structs.Structure.structureGetString'
which doesn\'t return a copy of the string).
-}
structureGetDateTime ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> m ((Bool, Gst.DateTime.DateTime))
    {- ^ __Returns:__ 'True' if the value could be set correctly. If there was no field
with /@fieldname@/ or the existing field did not contain a data, this function
returns 'False'. -}
structureGetDateTime structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    value <- allocMem :: IO (Ptr (Ptr Gst.DateTime.DateTime))
    result <- gst_structure_get_date_time structure' fieldname' value
    let result' = (/= 0) result
    value' <- peek value
    value'' <- (wrapBoxed Gst.DateTime.DateTime) value'
    touchManagedPtr structure
    freeMem fieldname'
    freeMem value
    return (result', value'')

#if ENABLE_OVERLOADING
data StructureGetDateTimeMethodInfo
instance (signature ~ (T.Text -> m ((Bool, Gst.DateTime.DateTime))), MonadIO m) => O.MethodInfo StructureGetDateTimeMethodInfo Structure signature where
    overloadedMethod _ = structureGetDateTime

#endif

-- method Structure::get_double
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a gdouble to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_get_double" gst_structure_get_double ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    Ptr CDouble ->                          -- value : TBasicType TDouble
    IO CInt

{- |
Sets the double pointed to by /@value@/ corresponding to the value of the
given field.  Caller is responsible for making sure the field exists
and has the correct type.
-}
structureGetDouble ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> m ((Bool, Double))
    {- ^ __Returns:__ 'True' if the value could be set correctly. If there was no field
with /@fieldname@/ or the existing field did not contain a double, this
function returns 'False'. -}
structureGetDouble structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    value <- allocMem :: IO (Ptr CDouble)
    result <- gst_structure_get_double structure' fieldname' value
    let result' = (/= 0) result
    value' <- peek value
    let value'' = realToFrac value'
    touchManagedPtr structure
    freeMem fieldname'
    freeMem value
    return (result', value'')

#if ENABLE_OVERLOADING
data StructureGetDoubleMethodInfo
instance (signature ~ (T.Text -> m ((Bool, Double))), MonadIO m) => O.MethodInfo StructureGetDoubleMethodInfo Structure signature where
    overloadedMethod _ = structureGetDouble

#endif

-- method Structure::get_enum
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "enumtype", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the enum type of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to an int to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_get_enum" gst_structure_get_enum ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    CGType ->                               -- enumtype : TBasicType TGType
    Ptr Int32 ->                            -- value : TBasicType TInt
    IO CInt

{- |
Sets the int pointed to by /@value@/ corresponding to the value of the
given field.  Caller is responsible for making sure the field exists,
has the correct type and that the enumtype is correct.
-}
structureGetEnum ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> GType
    {- ^ /@enumtype@/: the enum type of a field -}
    -> m ((Bool, Int32))
    {- ^ __Returns:__ 'True' if the value could be set correctly. If there was no field
with /@fieldname@/ or the existing field did not contain an enum of the given
type, this function returns 'False'. -}
structureGetEnum structure fieldname enumtype = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    let enumtype' = gtypeToCGType enumtype
    value <- allocMem :: IO (Ptr Int32)
    result <- gst_structure_get_enum structure' fieldname' enumtype' value
    let result' = (/= 0) result
    value' <- peek value
    touchManagedPtr structure
    freeMem fieldname'
    freeMem value
    return (result', value')

#if ENABLE_OVERLOADING
data StructureGetEnumMethodInfo
instance (signature ~ (T.Text -> GType -> m ((Bool, Int32))), MonadIO m) => O.MethodInfo StructureGetEnumMethodInfo Structure signature where
    overloadedMethod _ = structureGetEnum

#endif

-- method Structure::get_field_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TGType)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_get_field_type" gst_structure_get_field_type ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    IO CGType

{- |
Finds the field with the given name, and returns the type of the
value it contains.  If the field is not found, G_TYPE_INVALID is
returned.
-}
structureGetFieldType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of the field -}
    -> m GType
    {- ^ __Returns:__ the 'GI.GObject.Structs.Value.Value' of the field -}
structureGetFieldType structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    result <- gst_structure_get_field_type structure' fieldname'
    let result' = GType result
    touchManagedPtr structure
    freeMem fieldname'
    return result'

#if ENABLE_OVERLOADING
data StructureGetFieldTypeMethodInfo
instance (signature ~ (T.Text -> m GType), MonadIO m) => O.MethodInfo StructureGetFieldTypeMethodInfo Structure signature where
    overloadedMethod _ = structureGetFieldType

#endif

-- method Structure::get_flagset
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value_flags", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a guint for the flags field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "value_mask", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a guint for the mask field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_get_flagset" gst_structure_get_flagset ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    Ptr Word32 ->                           -- value_flags : TBasicType TUInt
    Ptr Word32 ->                           -- value_mask : TBasicType TUInt
    IO CInt

{- |
Read the GstFlagSet flags and mask out of the structure into the
provided pointers.

/Since: 1.6/
-}
structureGetFlagset ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> m ((Bool, Word32, Word32))
    {- ^ __Returns:__ 'True' if the values could be set correctly. If there was no field
with /@fieldname@/ or the existing field did not contain a GstFlagSet, this
function returns 'False'. -}
structureGetFlagset structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    valueFlags <- allocMem :: IO (Ptr Word32)
    valueMask <- allocMem :: IO (Ptr Word32)
    result <- gst_structure_get_flagset structure' fieldname' valueFlags valueMask
    let result' = (/= 0) result
    valueFlags' <- peek valueFlags
    valueMask' <- peek valueMask
    touchManagedPtr structure
    freeMem fieldname'
    freeMem valueFlags
    freeMem valueMask
    return (result', valueFlags', valueMask')

#if ENABLE_OVERLOADING
data StructureGetFlagsetMethodInfo
instance (signature ~ (T.Text -> m ((Bool, Word32, Word32))), MonadIO m) => O.MethodInfo StructureGetFlagsetMethodInfo Structure signature where
    overloadedMethod _ = structureGetFlagset

#endif

-- method Structure::get_fraction
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value_numerator", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to an int to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "value_denominator", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to an int to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_get_fraction" gst_structure_get_fraction ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    Ptr Int32 ->                            -- value_numerator : TBasicType TInt
    Ptr Int32 ->                            -- value_denominator : TBasicType TInt
    IO CInt

{- |
Sets the integers pointed to by /@valueNumerator@/ and /@valueDenominator@/
corresponding to the value of the given field.  Caller is responsible
for making sure the field exists and has the correct type.
-}
structureGetFraction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> m ((Bool, Int32, Int32))
    {- ^ __Returns:__ 'True' if the values could be set correctly. If there was no field
with /@fieldname@/ or the existing field did not contain a GstFraction, this
function returns 'False'. -}
structureGetFraction structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    valueNumerator <- allocMem :: IO (Ptr Int32)
    valueDenominator <- allocMem :: IO (Ptr Int32)
    result <- gst_structure_get_fraction structure' fieldname' valueNumerator valueDenominator
    let result' = (/= 0) result
    valueNumerator' <- peek valueNumerator
    valueDenominator' <- peek valueDenominator
    touchManagedPtr structure
    freeMem fieldname'
    freeMem valueNumerator
    freeMem valueDenominator
    return (result', valueNumerator', valueDenominator')

#if ENABLE_OVERLOADING
data StructureGetFractionMethodInfo
instance (signature ~ (T.Text -> m ((Bool, Int32, Int32))), MonadIO m) => O.MethodInfo StructureGetFractionMethodInfo Structure signature where
    overloadedMethod _ = structureGetFraction

#endif

-- method Structure::get_int
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to an int to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_get_int" gst_structure_get_int ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    Ptr Int32 ->                            -- value : TBasicType TInt
    IO CInt

{- |
Sets the int pointed to by /@value@/ corresponding to the value of the
given field.  Caller is responsible for making sure the field exists
and has the correct type.
-}
structureGetInt ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> m ((Bool, Int32))
    {- ^ __Returns:__ 'True' if the value could be set correctly. If there was no field
with /@fieldname@/ or the existing field did not contain an int, this function
returns 'False'. -}
structureGetInt structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    value <- allocMem :: IO (Ptr Int32)
    result <- gst_structure_get_int structure' fieldname' value
    let result' = (/= 0) result
    value' <- peek value
    touchManagedPtr structure
    freeMem fieldname'
    freeMem value
    return (result', value')

#if ENABLE_OVERLOADING
data StructureGetIntMethodInfo
instance (signature ~ (T.Text -> m ((Bool, Int32))), MonadIO m) => O.MethodInfo StructureGetIntMethodInfo Structure signature where
    overloadedMethod _ = structureGetInt

#endif

-- method Structure::get_int64
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a #gint64 to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_get_int64" gst_structure_get_int64 ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    Ptr Int64 ->                            -- value : TBasicType TInt64
    IO CInt

{- |
Sets the @/gint64/@ pointed to by /@value@/ corresponding to the value of the
given field. Caller is responsible for making sure the field exists
and has the correct type.

/Since: 1.4/
-}
structureGetInt64 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> m ((Bool, Int64))
    {- ^ __Returns:__ 'True' if the value could be set correctly. If there was no field
with /@fieldname@/ or the existing field did not contain a @/gint64/@, this function
returns 'False'. -}
structureGetInt64 structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    value <- allocMem :: IO (Ptr Int64)
    result <- gst_structure_get_int64 structure' fieldname' value
    let result' = (/= 0) result
    value' <- peek value
    touchManagedPtr structure
    freeMem fieldname'
    freeMem value
    return (result', value')

#if ENABLE_OVERLOADING
data StructureGetInt64MethodInfo
instance (signature ~ (T.Text -> m ((Bool, Int64))), MonadIO m) => O.MethodInfo StructureGetInt64MethodInfo Structure signature where
    overloadedMethod _ = structureGetInt64

#endif

-- method Structure::get_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "array", argType = TInterface (Name {namespace = "GObject", name = "ValueArray"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a #GValueArray", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_get_list" gst_structure_get_list ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    Ptr (Ptr GObject.ValueArray.ValueArray) -> -- array : TInterface (Name {namespace = "GObject", name = "ValueArray"})
    IO CInt

{- |
This is useful in language bindings where unknown 'GI.GObject.Structs.Value.Value' types are not
supported. This function will convert the @/GST_TYPE_LIST/@ into a newly
allocated GValueArray and return it through /@array@/. Be aware that this is
slower then getting the 'GI.GObject.Structs.Value.Value' directly.
-}
structureGetList ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> m ((Bool, GObject.ValueArray.ValueArray))
    {- ^ __Returns:__ 'True' if the value could be set correctly. If there was no field
with /@fieldname@/ or the existing field did not contain a @/GST_TYPE_LIST/@, this
function returns 'False'.

Since 1.12 -}
structureGetList structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    array <- allocMem :: IO (Ptr (Ptr GObject.ValueArray.ValueArray))
    result <- gst_structure_get_list structure' fieldname' array
    let result' = (/= 0) result
    array' <- peek array
    array'' <- (wrapBoxed GObject.ValueArray.ValueArray) array'
    touchManagedPtr structure
    freeMem fieldname'
    freeMem array
    return (result', array'')

#if ENABLE_OVERLOADING
data StructureGetListMethodInfo
instance (signature ~ (T.Text -> m ((Bool, GObject.ValueArray.ValueArray))), MonadIO m) => O.MethodInfo StructureGetListMethodInfo Structure signature where
    overloadedMethod _ = structureGetList

#endif

-- method Structure::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", 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 "gst_structure_get_name" gst_structure_get_name ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO CString

{- |
Get the name of /@structure@/ as a string.
-}
structureGetName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> m T.Text
    {- ^ __Returns:__ the name of the structure. -}
structureGetName structure = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    result <- gst_structure_get_name structure'
    checkUnexpectedReturnNULL "structureGetName" result
    result' <- cstringToText result
    touchManagedPtr structure
    return result'

#if ENABLE_OVERLOADING
data StructureGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo StructureGetNameMethodInfo Structure signature where
    overloadedMethod _ = structureGetName

#endif

-- method Structure::get_name_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_get_name_id" gst_structure_get_name_id ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO Word32

{- |
Get the name of /@structure@/ as a GQuark.
-}
structureGetNameId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> m Word32
    {- ^ __Returns:__ the quark representing the name of the structure. -}
structureGetNameId structure = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    result <- gst_structure_get_name_id structure'
    touchManagedPtr structure
    return result

#if ENABLE_OVERLOADING
data StructureGetNameIdMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo StructureGetNameIdMethodInfo Structure signature where
    overloadedMethod _ = structureGetNameId

#endif

-- method Structure::get_string
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", 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 "gst_structure_get_string" gst_structure_get_string ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    IO CString

{- |
Finds the field corresponding to /@fieldname@/, and returns the string
contained in the field\'s value.  Caller is responsible for making
sure the field exists and has the correct type.

The string should not be modified, and remains valid until the next
call to a gst_structure_*() function with the given structure.
-}
structureGetString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ a pointer to the string or 'Nothing' when the
field did not exist or did not contain a string. -}
structureGetString structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    result <- gst_structure_get_string structure' fieldname'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    touchManagedPtr structure
    freeMem fieldname'
    return maybeResult

#if ENABLE_OVERLOADING
data StructureGetStringMethodInfo
instance (signature ~ (T.Text -> m (Maybe T.Text)), MonadIO m) => O.MethodInfo StructureGetStringMethodInfo Structure signature where
    overloadedMethod _ = structureGetString

#endif

-- method Structure::get_uint
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a uint to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_get_uint" gst_structure_get_uint ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    Ptr Word32 ->                           -- value : TBasicType TUInt
    IO CInt

{- |
Sets the uint pointed to by /@value@/ corresponding to the value of the
given field.  Caller is responsible for making sure the field exists
and has the correct type.
-}
structureGetUint ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> m ((Bool, Word32))
    {- ^ __Returns:__ 'True' if the value could be set correctly. If there was no field
with /@fieldname@/ or the existing field did not contain a uint, this function
returns 'False'. -}
structureGetUint structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    value <- allocMem :: IO (Ptr Word32)
    result <- gst_structure_get_uint structure' fieldname' value
    let result' = (/= 0) result
    value' <- peek value
    touchManagedPtr structure
    freeMem fieldname'
    freeMem value
    return (result', value')

#if ENABLE_OVERLOADING
data StructureGetUintMethodInfo
instance (signature ~ (T.Text -> m ((Bool, Word32))), MonadIO m) => O.MethodInfo StructureGetUintMethodInfo Structure signature where
    overloadedMethod _ = structureGetUint

#endif

-- method Structure::get_uint64
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a #guint64 to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_get_uint64" gst_structure_get_uint64 ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    Ptr Word64 ->                           -- value : TBasicType TUInt64
    IO CInt

{- |
Sets the @/guint64/@ pointed to by /@value@/ corresponding to the value of the
given field. Caller is responsible for making sure the field exists
and has the correct type.

/Since: 1.4/
-}
structureGetUint64 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> m ((Bool, Word64))
    {- ^ __Returns:__ 'True' if the value could be set correctly. If there was no field
with /@fieldname@/ or the existing field did not contain a @/guint64/@, this function
returns 'False'. -}
structureGetUint64 structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    value <- allocMem :: IO (Ptr Word64)
    result <- gst_structure_get_uint64 structure' fieldname' value
    let result' = (/= 0) result
    value' <- peek value
    touchManagedPtr structure
    freeMem fieldname'
    freeMem value
    return (result', value')

#if ENABLE_OVERLOADING
data StructureGetUint64MethodInfo
instance (signature ~ (T.Text -> m ((Bool, Word64))), MonadIO m) => O.MethodInfo StructureGetUint64MethodInfo Structure signature where
    overloadedMethod _ = structureGetUint64

#endif

-- method Structure::get_value
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the field to get", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GObject", name = "Value"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_get_value" gst_structure_get_value ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    IO (Ptr GValue)

{- |
Get the value of the field with name /@fieldname@/.
-}
structureGetValue ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of the field to get -}
    -> m (Maybe GValue)
    {- ^ __Returns:__ the 'GI.GObject.Structs.Value.Value' corresponding to the field with the given
name. -}
structureGetValue structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    result <- gst_structure_get_value structure' fieldname'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed GValue) result'
        return result''
    touchManagedPtr structure
    freeMem fieldname'
    return maybeResult

#if ENABLE_OVERLOADING
data StructureGetValueMethodInfo
instance (signature ~ (T.Text -> m (Maybe GValue)), MonadIO m) => O.MethodInfo StructureGetValueMethodInfo Structure signature where
    overloadedMethod _ = structureGetValue

#endif

-- method Structure::has_field
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_has_field" gst_structure_has_field ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    IO CInt

{- |
Check if /@structure@/ contains a field named /@fieldname@/.
-}
structureHasField ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the structure contains a field with the given name -}
structureHasField structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    result <- gst_structure_has_field structure' fieldname'
    let result' = (/= 0) result
    touchManagedPtr structure
    freeMem fieldname'
    return result'

#if ENABLE_OVERLOADING
data StructureHasFieldMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo StructureHasFieldMethodInfo Structure signature where
    overloadedMethod _ = structureHasField

#endif

-- method Structure::has_field_typed
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the type of a value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_has_field_typed" gst_structure_has_field_typed ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    CGType ->                               -- type : TBasicType TGType
    IO CInt

{- |
Check if /@structure@/ contains a field named /@fieldname@/ and with GType /@type@/.
-}
structureHasFieldTyped ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> GType
    {- ^ /@type@/: the type of a value -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the structure contains a field with the given name and type -}
structureHasFieldTyped structure fieldname type_ = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    let type_' = gtypeToCGType type_
    result <- gst_structure_has_field_typed structure' fieldname' type_'
    let result' = (/= 0) result
    touchManagedPtr structure
    freeMem fieldname'
    return result'

#if ENABLE_OVERLOADING
data StructureHasFieldTypedMethodInfo
instance (signature ~ (T.Text -> GType -> m Bool), MonadIO m) => O.MethodInfo StructureHasFieldTypedMethodInfo Structure signature where
    overloadedMethod _ = structureHasFieldTyped

#endif

-- method Structure::has_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "structure name to check for", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_has_name" gst_structure_has_name ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- name : TBasicType TUTF8
    IO CInt

{- |
Checks if the structure has the given name
-}
structureHasName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@name@/: structure name to check for -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@name@/ matches the name of the structure. -}
structureHasName structure name = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    name' <- textToCString name
    result <- gst_structure_has_name structure' name'
    let result' = (/= 0) result
    touchManagedPtr structure
    freeMem name'
    return result'

#if ENABLE_OVERLOADING
data StructureHasNameMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo StructureHasNameMethodInfo Structure signature where
    overloadedMethod _ = structureHasName

#endif

-- method Structure::id_get_value
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "field", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GQuark of the field to get", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GObject", name = "Value"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_id_get_value" gst_structure_id_get_value ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    Word32 ->                               -- field : TBasicType TUInt32
    IO (Ptr GValue)

{- |
Get the value of the field with GQuark /@field@/.
-}
structureIdGetValue ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> Word32
    {- ^ /@field@/: the @/GQuark/@ of the field to get -}
    -> m (Maybe GValue)
    {- ^ __Returns:__ the 'GI.GObject.Structs.Value.Value' corresponding to the field with the given
name identifier. -}
structureIdGetValue structure field = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    result <- gst_structure_id_get_value structure' field
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed GValue) result'
        return result''
    touchManagedPtr structure
    return maybeResult

#if ENABLE_OVERLOADING
data StructureIdGetValueMethodInfo
instance (signature ~ (Word32 -> m (Maybe GValue)), MonadIO m) => O.MethodInfo StructureIdGetValueMethodInfo Structure signature where
    overloadedMethod _ = structureIdGetValue

#endif

-- method Structure::id_has_field
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "field", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GQuark of the field name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_id_has_field" gst_structure_id_has_field ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    Word32 ->                               -- field : TBasicType TUInt32
    IO CInt

{- |
Check if /@structure@/ contains a field named /@field@/.
-}
structureIdHasField ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> Word32
    {- ^ /@field@/: @/GQuark/@ of the field name -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the structure contains a field with the given name -}
structureIdHasField structure field = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    result <- gst_structure_id_has_field structure' field
    let result' = (/= 0) result
    touchManagedPtr structure
    return result'

#if ENABLE_OVERLOADING
data StructureIdHasFieldMethodInfo
instance (signature ~ (Word32 -> m Bool), MonadIO m) => O.MethodInfo StructureIdHasFieldMethodInfo Structure signature where
    overloadedMethod _ = structureIdHasField

#endif

-- method Structure::id_has_field_typed
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "field", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GQuark of the field name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the type of a value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_id_has_field_typed" gst_structure_id_has_field_typed ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    Word32 ->                               -- field : TBasicType TUInt32
    CGType ->                               -- type : TBasicType TGType
    IO CInt

{- |
Check if /@structure@/ contains a field named /@field@/ and with GType /@type@/.
-}
structureIdHasFieldTyped ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> Word32
    {- ^ /@field@/: @/GQuark/@ of the field name -}
    -> GType
    {- ^ /@type@/: the type of a value -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the structure contains a field with the given name and type -}
structureIdHasFieldTyped structure field type_ = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    let type_' = gtypeToCGType type_
    result <- gst_structure_id_has_field_typed structure' field type_'
    let result' = (/= 0) result
    touchManagedPtr structure
    return result'

#if ENABLE_OVERLOADING
data StructureIdHasFieldTypedMethodInfo
instance (signature ~ (Word32 -> GType -> m Bool), MonadIO m) => O.MethodInfo StructureIdHasFieldTypedMethodInfo Structure signature where
    overloadedMethod _ = structureIdHasFieldTyped

#endif

-- method Structure::id_set_value
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "field", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GQuark representing a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new value of the field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_id_set_value" gst_structure_id_set_value ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    Word32 ->                               -- field : TBasicType TUInt32
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO ()

{- |
Sets the field with the given GQuark /@field@/ to /@value@/.  If the field
does not exist, it is created.  If the field exists, the previous
value is replaced and freed.
-}
structureIdSetValue ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> Word32
    {- ^ /@field@/: a @/GQuark/@ representing a field -}
    -> GValue
    {- ^ /@value@/: the new value of the field -}
    -> m ()
structureIdSetValue structure field value = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    value' <- unsafeManagedPtrGetPtr value
    gst_structure_id_set_value structure' field value'
    touchManagedPtr structure
    touchManagedPtr value
    return ()

#if ENABLE_OVERLOADING
data StructureIdSetValueMethodInfo
instance (signature ~ (Word32 -> GValue -> m ()), MonadIO m) => O.MethodInfo StructureIdSetValueMethodInfo Structure signature where
    overloadedMethod _ = structureIdSetValue

#endif

-- method Structure::id_take_value
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "field", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GQuark representing a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new value of the field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_id_take_value" gst_structure_id_take_value ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    Word32 ->                               -- field : TBasicType TUInt32
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO ()

{- |
Sets the field with the given GQuark /@field@/ to /@value@/.  If the field
does not exist, it is created.  If the field exists, the previous
value is replaced and freed.
-}
structureIdTakeValue ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> Word32
    {- ^ /@field@/: a @/GQuark/@ representing a field -}
    -> GValue
    {- ^ /@value@/: the new value of the field -}
    -> m ()
structureIdTakeValue structure field value = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    value' <- B.ManagedPtr.disownBoxed value
    gst_structure_id_take_value structure' field value'
    touchManagedPtr structure
    touchManagedPtr value
    return ()

#if ENABLE_OVERLOADING
data StructureIdTakeValueMethodInfo
instance (signature ~ (Word32 -> GValue -> m ()), MonadIO m) => O.MethodInfo StructureIdTakeValueMethodInfo Structure signature where
    overloadedMethod _ = structureIdTakeValue

#endif

-- method Structure::intersect
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "struct1", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "struct2", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Structure"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_intersect" gst_structure_intersect ::
    Ptr Structure ->                        -- struct1 : TInterface (Name {namespace = "Gst", name = "Structure"})
    Ptr Structure ->                        -- struct2 : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO (Ptr Structure)

{- |
Intersects /@struct1@/ and /@struct2@/ and returns the intersection.
-}
structureIntersect ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@struct1@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> Structure
    {- ^ /@struct2@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> m (Maybe Structure)
    {- ^ __Returns:__ Intersection of /@struct1@/ and /@struct2@/ -}
structureIntersect struct1 struct2 = liftIO $ do
    struct1' <- unsafeManagedPtrGetPtr struct1
    struct2' <- unsafeManagedPtrGetPtr struct2
    result <- gst_structure_intersect struct1' struct2'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Structure) result'
        return result''
    touchManagedPtr struct1
    touchManagedPtr struct2
    return maybeResult

#if ENABLE_OVERLOADING
data StructureIntersectMethodInfo
instance (signature ~ (Structure -> m (Maybe Structure)), MonadIO m) => O.MethodInfo StructureIntersectMethodInfo Structure signature where
    overloadedMethod _ = structureIntersect

#endif

-- method Structure::is_equal
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure1", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "structure2", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_is_equal" gst_structure_is_equal ::
    Ptr Structure ->                        -- structure1 : TInterface (Name {namespace = "Gst", name = "Structure"})
    Ptr Structure ->                        -- structure2 : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO CInt

{- |
Tests if the two 'GI.Gst.Structs.Structure.Structure' are equal.
-}
structureIsEqual ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure1@/: a 'GI.Gst.Structs.Structure.Structure'. -}
    -> Structure
    {- ^ /@structure2@/: a 'GI.Gst.Structs.Structure.Structure'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the two structures have the same name and field. -}
structureIsEqual structure1 structure2 = liftIO $ do
    structure1' <- unsafeManagedPtrGetPtr structure1
    structure2' <- unsafeManagedPtrGetPtr structure2
    result <- gst_structure_is_equal structure1' structure2'
    let result' = (/= 0) result
    touchManagedPtr structure1
    touchManagedPtr structure2
    return result'

#if ENABLE_OVERLOADING
data StructureIsEqualMethodInfo
instance (signature ~ (Structure -> m Bool), MonadIO m) => O.MethodInfo StructureIsEqualMethodInfo Structure signature where
    overloadedMethod _ = structureIsEqual

#endif

-- method Structure::is_subset
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "subset", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "superset", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a potentially greater #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_is_subset" gst_structure_is_subset ::
    Ptr Structure ->                        -- subset : TInterface (Name {namespace = "Gst", name = "Structure"})
    Ptr Structure ->                        -- superset : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO CInt

{- |
Checks if /@subset@/ is a subset of /@superset@/, i.e. has the same
structure name and for all fields that are existing in /@superset@/,
/@subset@/ has a value that is a subset of the value in /@superset@/.
-}
structureIsSubset ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@subset@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> Structure
    {- ^ /@superset@/: a potentially greater 'GI.Gst.Structs.Structure.Structure' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@subset@/ is a subset of /@superset@/ -}
structureIsSubset subset superset = liftIO $ do
    subset' <- unsafeManagedPtrGetPtr subset
    superset' <- unsafeManagedPtrGetPtr superset
    result <- gst_structure_is_subset subset' superset'
    let result' = (/= 0) result
    touchManagedPtr subset
    touchManagedPtr superset
    return result'

#if ENABLE_OVERLOADING
data StructureIsSubsetMethodInfo
instance (signature ~ (Structure -> m Bool), MonadIO m) => O.MethodInfo StructureIsSubsetMethodInfo Structure signature where
    overloadedMethod _ = structureIsSubset

#endif

-- method Structure::map_in_place
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "func", argType = TInterface (Name {namespace = "Gst", name = "StructureMapFunc"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a function to call for each field", sinceVersion = Nothing}, argScope = ScopeTypeCall, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "private data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_map_in_place" gst_structure_map_in_place ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    FunPtr Gst.Callbacks.C_StructureMapFunc -> -- func : TInterface (Name {namespace = "Gst", name = "StructureMapFunc"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO CInt

{- |
Calls the provided function once for each field in the 'GI.Gst.Structs.Structure.Structure'. In
contrast to 'GI.Gst.Structs.Structure.structureForeach', the function may modify but not delete the
fields. The structure must be mutable.
-}
structureMapInPlace ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> Gst.Callbacks.StructureMapFunc
    {- ^ /@func@/: a function to call for each field -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the supplied function returns 'True' For each of the fields,
'False' otherwise. -}
structureMapInPlace structure func = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    func' <- Gst.Callbacks.mk_StructureMapFunc (Gst.Callbacks.wrap_StructureMapFunc Nothing (Gst.Callbacks.drop_closures_StructureMapFunc func))
    let userData = nullPtr
    result <- gst_structure_map_in_place structure' func' userData
    let result' = (/= 0) result
    safeFreeFunPtr $ castFunPtrToPtr func'
    touchManagedPtr structure
    return result'

#if ENABLE_OVERLOADING
data StructureMapInPlaceMethodInfo
instance (signature ~ (Gst.Callbacks.StructureMapFunc -> m Bool), MonadIO m) => O.MethodInfo StructureMapInPlaceMethodInfo Structure signature where
    overloadedMethod _ = structureMapInPlace

#endif

-- method Structure::n_fields
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_n_fields" gst_structure_n_fields ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO Int32

{- |
Get the number of fields in the structure.
-}
structureNFields ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> m Int32
    {- ^ __Returns:__ the number of fields in the structure -}
structureNFields structure = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    result <- gst_structure_n_fields structure'
    touchManagedPtr structure
    return result

#if ENABLE_OVERLOADING
data StructureNFieldsMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo StructureNFieldsMethodInfo Structure signature where
    overloadedMethod _ = structureNFields

#endif

-- method Structure::nth_field_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the index to get the name of", 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 "gst_structure_nth_field_name" gst_structure_nth_field_name ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    Word32 ->                               -- index : TBasicType TUInt
    IO CString

{- |
Get the name of the given field number, counting from 0 onwards.
-}
structureNthFieldName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> Word32
    {- ^ /@index@/: the index to get the name of -}
    -> m T.Text
    {- ^ __Returns:__ the name of the given field number -}
structureNthFieldName structure index = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    result <- gst_structure_nth_field_name structure' index
    checkUnexpectedReturnNULL "structureNthFieldName" result
    result' <- cstringToText result
    touchManagedPtr structure
    return result'

#if ENABLE_OVERLOADING
data StructureNthFieldNameMethodInfo
instance (signature ~ (Word32 -> m T.Text), MonadIO m) => O.MethodInfo StructureNthFieldNameMethodInfo Structure signature where
    overloadedMethod _ = structureNthFieldName

#endif

-- method Structure::remove_all_fields
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_remove_all_fields" gst_structure_remove_all_fields ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO ()

{- |
Removes all fields in a GstStructure.
-}
structureRemoveAllFields ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> m ()
structureRemoveAllFields structure = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    gst_structure_remove_all_fields structure'
    touchManagedPtr structure
    return ()

#if ENABLE_OVERLOADING
data StructureRemoveAllFieldsMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo StructureRemoveAllFieldsMethodInfo Structure signature where
    overloadedMethod _ = structureRemoveAllFields

#endif

-- method Structure::remove_field
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the field to remove", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_remove_field" gst_structure_remove_field ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    IO ()

{- |
Removes the field with the given name.  If the field with the given
name does not exist, the structure is unchanged.
-}
structureRemoveField ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of the field to remove -}
    -> m ()
structureRemoveField structure fieldname = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    gst_structure_remove_field structure' fieldname'
    touchManagedPtr structure
    freeMem fieldname'
    return ()

#if ENABLE_OVERLOADING
data StructureRemoveFieldMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo StructureRemoveFieldMethodInfo Structure signature where
    overloadedMethod _ = structureRemoveField

#endif

-- method Structure::set_array
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "array", argType = TInterface (Name {namespace = "GObject", name = "ValueArray"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a #GValueArray", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_set_array" gst_structure_set_array ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    Ptr GObject.ValueArray.ValueArray ->    -- array : TInterface (Name {namespace = "GObject", name = "ValueArray"})
    IO ()

{- |
This is useful in language bindings where unknown GValue types are not
supported. This function will convert a /@array@/ to @/GST_TYPE_ARRAY/@ and set
the field specified by /@fieldname@/.  Be aware that this is slower then using
@/GST_TYPE_ARRAY/@ in a 'GI.GObject.Structs.Value.Value' directly.

Since 1.12
-}
structureSetArray ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> GObject.ValueArray.ValueArray
    {- ^ /@array@/: a pointer to a 'GI.GObject.Structs.ValueArray.ValueArray' -}
    -> m ()
structureSetArray structure fieldname array = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    array' <- unsafeManagedPtrGetPtr array
    gst_structure_set_array structure' fieldname' array'
    touchManagedPtr structure
    touchManagedPtr array
    freeMem fieldname'
    return ()

#if ENABLE_OVERLOADING
data StructureSetArrayMethodInfo
instance (signature ~ (T.Text -> GObject.ValueArray.ValueArray -> m ()), MonadIO m) => O.MethodInfo StructureSetArrayMethodInfo Structure signature where
    overloadedMethod _ = structureSetArray

#endif

-- method Structure::set_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of a field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "array", argType = TInterface (Name {namespace = "GObject", name = "ValueArray"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a #GValueArray", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_set_list" gst_structure_set_list ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    Ptr GObject.ValueArray.ValueArray ->    -- array : TInterface (Name {namespace = "GObject", name = "ValueArray"})
    IO ()

{- |
This is useful in language bindings where unknown GValue types are not
supported. This function will convert a /@array@/ to @/GST_TYPE_LIST/@ and set
the field specified by /@fieldname@/. Be aware that this is slower then using
@/GST_TYPE_LIST/@ in a 'GI.GObject.Structs.Value.Value' directly.

Since 1.12
-}
structureSetList ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of a field -}
    -> GObject.ValueArray.ValueArray
    {- ^ /@array@/: a pointer to a 'GI.GObject.Structs.ValueArray.ValueArray' -}
    -> m ()
structureSetList structure fieldname array = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    array' <- unsafeManagedPtrGetPtr array
    gst_structure_set_list structure' fieldname' array'
    touchManagedPtr structure
    touchManagedPtr array
    freeMem fieldname'
    return ()

#if ENABLE_OVERLOADING
data StructureSetListMethodInfo
instance (signature ~ (T.Text -> GObject.ValueArray.ValueArray -> m ()), MonadIO m) => O.MethodInfo StructureSetListMethodInfo Structure signature where
    overloadedMethod _ = structureSetList

#endif

-- method Structure::set_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new name of the structure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_set_name" gst_structure_set_name ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- name : TBasicType TUTF8
    IO ()

{- |
Sets the name of the structure to the given /@name@/.  The string
provided is copied before being used. It must not be empty, start with a
letter and can be followed by letters, numbers and any of \"\/-_.:\".
-}
structureSetName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@name@/: the new name of the structure -}
    -> m ()
structureSetName structure name = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    name' <- textToCString name
    gst_structure_set_name structure' name'
    touchManagedPtr structure
    freeMem name'
    return ()

#if ENABLE_OVERLOADING
data StructureSetNameMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo StructureSetNameMethodInfo Structure signature where
    overloadedMethod _ = structureSetName

#endif

-- method Structure::set_parent_refcount
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "refcount", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to the parent's refcount", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_set_parent_refcount" gst_structure_set_parent_refcount ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    Int32 ->                                -- refcount : TBasicType TInt
    IO CInt

{- |
Sets the parent_refcount field of 'GI.Gst.Structs.Structure.Structure'. This field is used to
determine whether a structure is mutable or not. This function should only be
called by code implementing parent objects of 'GI.Gst.Structs.Structure.Structure', as described in
the MT Refcounting section of the design documents.
-}
structureSetParentRefcount ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> Int32
    {- ^ /@refcount@/: a pointer to the parent\'s refcount -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the parent refcount could be set. -}
structureSetParentRefcount structure refcount = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    result <- gst_structure_set_parent_refcount structure' refcount
    let result' = (/= 0) result
    touchManagedPtr structure
    return result'

#if ENABLE_OVERLOADING
data StructureSetParentRefcountMethodInfo
instance (signature ~ (Int32 -> m Bool), MonadIO m) => O.MethodInfo StructureSetParentRefcountMethodInfo Structure signature where
    overloadedMethod _ = structureSetParentRefcount

#endif

-- method Structure::set_value
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the field to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new value of the field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_set_value" gst_structure_set_value ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO ()

{- |
Sets the field with the given name /@field@/ to /@value@/.  If the field
does not exist, it is created.  If the field exists, the previous
value is replaced and freed.
-}
structureSetValue ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of the field to set -}
    -> GValue
    {- ^ /@value@/: the new value of the field -}
    -> m ()
structureSetValue structure fieldname value = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    value' <- unsafeManagedPtrGetPtr value
    gst_structure_set_value structure' fieldname' value'
    touchManagedPtr structure
    touchManagedPtr value
    freeMem fieldname'
    return ()

#if ENABLE_OVERLOADING
data StructureSetValueMethodInfo
instance (signature ~ (T.Text -> GValue -> m ()), MonadIO m) => O.MethodInfo StructureSetValueMethodInfo Structure signature where
    overloadedMethod _ = structureSetValue

#endif

-- method Structure::take_value
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fieldname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the field to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new value of the field", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_take_value" gst_structure_take_value ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    CString ->                              -- fieldname : TBasicType TUTF8
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO ()

{- |
Sets the field with the given name /@field@/ to /@value@/.  If the field
does not exist, it is created.  If the field exists, the previous
value is replaced and freed. The function will take ownership of /@value@/.
-}
structureTakeValue ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> T.Text
    {- ^ /@fieldname@/: the name of the field to set -}
    -> GValue
    {- ^ /@value@/: the new value of the field -}
    -> m ()
structureTakeValue structure fieldname value = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    fieldname' <- textToCString fieldname
    value' <- B.ManagedPtr.disownBoxed value
    gst_structure_take_value structure' fieldname' value'
    touchManagedPtr structure
    touchManagedPtr value
    freeMem fieldname'
    return ()

#if ENABLE_OVERLOADING
data StructureTakeValueMethodInfo
instance (signature ~ (T.Text -> GValue -> m ()), MonadIO m) => O.MethodInfo StructureTakeValueMethodInfo Structure signature where
    overloadedMethod _ = structureTakeValue

#endif

-- method Structure::to_string
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", 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 "gst_structure_to_string" gst_structure_to_string ::
    Ptr Structure ->                        -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO CString

{- |
Converts /@structure@/ to a human-readable string representation.

For debugging purposes its easier to do something like this:

=== /C code/
>
>GST_LOG ("structure is %" GST_PTR_FORMAT, structure);

This prints the structure in human readable form.

The current implementation of serialization will lead to unexpected results
when there are nested 'GI.Gst.Structs.Caps.Caps' \/ 'GI.Gst.Structs.Structure.Structure' deeper than one level.

Free-function: g_free
-}
structureToString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Structure
    {- ^ /@structure@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> m T.Text
    {- ^ __Returns:__ a pointer to string allocated by 'GI.GLib.Functions.malloc'.
    'GI.GLib.Functions.free' after usage. -}
structureToString structure = liftIO $ do
    structure' <- unsafeManagedPtrGetPtr structure
    result <- gst_structure_to_string structure'
    checkUnexpectedReturnNULL "structureToString" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr structure
    return result'

#if ENABLE_OVERLOADING
data StructureToStringMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo StructureToStringMethodInfo Structure signature where
    overloadedMethod _ = structureToString

#endif

-- method Structure::from_string
-- method type : MemberFunction
-- Args : [Arg {argCName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a string representation of a #GstStructure.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to store the end of the string in.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Structure"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_structure_from_string" gst_structure_from_string ::
    CString ->                              -- string : TBasicType TUTF8
    Ptr CString ->                          -- end : TBasicType TUTF8
    IO (Ptr Structure)

{- |
Creates a 'GI.Gst.Structs.Structure.Structure' from a string representation.
If end is not 'Nothing', a pointer to the place inside the given string
where parsing ended will be returned.

Free-function: gst_structure_free
-}
structureFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@string@/: a string representation of a 'GI.Gst.Structs.Structure.Structure'. -}
    -> m ((Maybe Structure, T.Text))
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Structure.Structure' or 'Nothing'
    when the string could not be parsed. Free with
    'GI.Gst.Structs.Structure.structureFree' after use. -}
structureFromString string = liftIO $ do
    string' <- textToCString string
    end <- allocMem :: IO (Ptr CString)
    result <- gst_structure_from_string string' end
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Structure) result'
        return result''
    end' <- peek end
    end'' <- cstringToText end'
    freeMem string'
    freeMem end
    return (maybeResult, end'')

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type family ResolveStructureMethod (t :: Symbol) (o :: *) :: * where
    ResolveStructureMethod "canIntersect" o = StructureCanIntersectMethodInfo
    ResolveStructureMethod "copy" o = StructureCopyMethodInfo
    ResolveStructureMethod "filterAndMapInPlace" o = StructureFilterAndMapInPlaceMethodInfo
    ResolveStructureMethod "fixate" o = StructureFixateMethodInfo
    ResolveStructureMethod "fixateField" o = StructureFixateFieldMethodInfo
    ResolveStructureMethod "fixateFieldBoolean" o = StructureFixateFieldBooleanMethodInfo
    ResolveStructureMethod "fixateFieldNearestDouble" o = StructureFixateFieldNearestDoubleMethodInfo
    ResolveStructureMethod "fixateFieldNearestFraction" o = StructureFixateFieldNearestFractionMethodInfo
    ResolveStructureMethod "fixateFieldNearestInt" o = StructureFixateFieldNearestIntMethodInfo
    ResolveStructureMethod "fixateFieldString" o = StructureFixateFieldStringMethodInfo
    ResolveStructureMethod "foreach" o = StructureForeachMethodInfo
    ResolveStructureMethod "free" o = StructureFreeMethodInfo
    ResolveStructureMethod "hasField" o = StructureHasFieldMethodInfo
    ResolveStructureMethod "hasFieldTyped" o = StructureHasFieldTypedMethodInfo
    ResolveStructureMethod "hasName" o = StructureHasNameMethodInfo
    ResolveStructureMethod "idGetValue" o = StructureIdGetValueMethodInfo
    ResolveStructureMethod "idHasField" o = StructureIdHasFieldMethodInfo
    ResolveStructureMethod "idHasFieldTyped" o = StructureIdHasFieldTypedMethodInfo
    ResolveStructureMethod "idSetValue" o = StructureIdSetValueMethodInfo
    ResolveStructureMethod "idTakeValue" o = StructureIdTakeValueMethodInfo
    ResolveStructureMethod "intersect" o = StructureIntersectMethodInfo
    ResolveStructureMethod "isEqual" o = StructureIsEqualMethodInfo
    ResolveStructureMethod "isSubset" o = StructureIsSubsetMethodInfo
    ResolveStructureMethod "mapInPlace" o = StructureMapInPlaceMethodInfo
    ResolveStructureMethod "nFields" o = StructureNFieldsMethodInfo
    ResolveStructureMethod "nthFieldName" o = StructureNthFieldNameMethodInfo
    ResolveStructureMethod "removeAllFields" o = StructureRemoveAllFieldsMethodInfo
    ResolveStructureMethod "removeField" o = StructureRemoveFieldMethodInfo
    ResolveStructureMethod "takeValue" o = StructureTakeValueMethodInfo
    ResolveStructureMethod "toString" o = StructureToStringMethodInfo
    ResolveStructureMethod "getArray" o = StructureGetArrayMethodInfo
    ResolveStructureMethod "getBoolean" o = StructureGetBooleanMethodInfo
    ResolveStructureMethod "getClockTime" o = StructureGetClockTimeMethodInfo
    ResolveStructureMethod "getDate" o = StructureGetDateMethodInfo
    ResolveStructureMethod "getDateTime" o = StructureGetDateTimeMethodInfo
    ResolveStructureMethod "getDouble" o = StructureGetDoubleMethodInfo
    ResolveStructureMethod "getEnum" o = StructureGetEnumMethodInfo
    ResolveStructureMethod "getFieldType" o = StructureGetFieldTypeMethodInfo
    ResolveStructureMethod "getFlagset" o = StructureGetFlagsetMethodInfo
    ResolveStructureMethod "getFraction" o = StructureGetFractionMethodInfo
    ResolveStructureMethod "getInt" o = StructureGetIntMethodInfo
    ResolveStructureMethod "getInt64" o = StructureGetInt64MethodInfo
    ResolveStructureMethod "getList" o = StructureGetListMethodInfo
    ResolveStructureMethod "getName" o = StructureGetNameMethodInfo
    ResolveStructureMethod "getNameId" o = StructureGetNameIdMethodInfo
    ResolveStructureMethod "getString" o = StructureGetStringMethodInfo
    ResolveStructureMethod "getUint" o = StructureGetUintMethodInfo
    ResolveStructureMethod "getUint64" o = StructureGetUint64MethodInfo
    ResolveStructureMethod "getValue" o = StructureGetValueMethodInfo
    ResolveStructureMethod "setArray" o = StructureSetArrayMethodInfo
    ResolveStructureMethod "setList" o = StructureSetListMethodInfo
    ResolveStructureMethod "setName" o = StructureSetNameMethodInfo
    ResolveStructureMethod "setParentRefcount" o = StructureSetParentRefcountMethodInfo
    ResolveStructureMethod "setValue" o = StructureSetValueMethodInfo
    ResolveStructureMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveStructureMethod t Structure, O.MethodInfo info Structure p) => OL.IsLabel t (Structure -> 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