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

    The 'GI.Pango.Structs.AttrList.AttrList' structure represents a list of attributes
    that apply to a section of text. The attributes are, in general,
    allowed to overlap in an arbitrary fashion, however, if the
    attributes are manipulated only through 'GI.Pango.Structs.AttrList.attrListChange',
    the overlap between properties will meet stricter criteria.

    Since the 'GI.Pango.Structs.AttrList.AttrList' structure is stored as a linear list,
    it is not suitable for storing attributes for large amounts
    of text. In general, you should not use a single 'GI.Pango.Structs.AttrList.AttrList'
    for more than one paragraph of text.
    -}

    #define ENABLE_OVERLOADING \
           (!defined(__HADDOCK_VERSION__))

    module GI.Pango.Structs.AttrList
        (

    -- * Exported types
        AttrList(..)                            ,
        noAttrList                              ,

     -- * Methods
    -- ** change #method:change#

    #if ENABLE_OVERLOADING
        AttrListChangeMethodInfo                ,
    #endif
        attrListChange                          ,

    -- ** copy #method:copy#

    #if ENABLE_OVERLOADING
        AttrListCopyMethodInfo                  ,
    #endif
        attrListCopy                            ,

    -- ** filter #method:filter#

    #if ENABLE_OVERLOADING
        AttrListFilterMethodInfo                ,
    #endif
        attrListFilter                          ,

    -- ** insert #method:insert#

    #if ENABLE_OVERLOADING
        AttrListInsertMethodInfo                ,
    #endif
        attrListInsert                          ,

    -- ** insertBefore #method:insertBefore#

    #if ENABLE_OVERLOADING
        AttrListInsertBeforeMethodInfo          ,
    #endif
        attrListInsertBefore                    ,

    -- ** new #method:new#

        attrListNew                             ,

    -- ** ref #method:ref#

    #if ENABLE_OVERLOADING
        AttrListRefMethodInfo                   ,
    #endif
        attrListRef                             ,

    -- ** splice #method:splice#

    #if ENABLE_OVERLOADING
        AttrListSpliceMethodInfo                ,
    #endif
        attrListSplice                          ,

    -- ** unref #method:unref#

    #if ENABLE_OVERLOADING
        AttrListUnrefMethodInfo                 ,
    #endif
        attrListUnref                           ,

        ) 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.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.Text as T
    import qualified Data.ByteString.Char8 as B
    import qualified Data.Map as Map
    import qualified Foreign.Ptr as FP

    import qualified GI.Pango.Callbacks as Pango.Callbacks
    import {-# SOURCE #-} qualified GI.Pango.Structs.Attribute as Pango.Attribute

    -- | Memory-managed wrapper type.
    newtype AttrList = AttrList (ManagedPtr AttrList)
    foreign import ccall "pango_attr_list_get_type" c_pango_attr_list_get_type ::
        IO GType

    instance BoxedObject AttrList where
        boxedType _ = c_pango_attr_list_get_type

    -- | A convenience alias for `Nothing` :: `Maybe` `AttrList`.
    noAttrList :: Maybe AttrList
    noAttrList = Nothing

    #if ENABLE_OVERLOADING
    instance O.HasAttributeList AttrList
    type instance O.AttributeList AttrList = AttrListAttributeList
    type AttrListAttributeList = ('[ ] :: [(Symbol, *)])
    #endif

    -- method AttrList::new
    -- method type : Constructor
    -- Args : []
    -- Lengths : []
    -- returnType : Just (TInterface (Name {namespace = "Pango", name = "AttrList"}))
    -- throws : False
    -- Skip return : False

    foreign import ccall "pango_attr_list_new" pango_attr_list_new ::
        IO (Ptr AttrList)

    {- |
    Create a new empty attribute list with a reference count of one.
    -}
    attrListNew ::
        (B.CallStack.HasCallStack, MonadIO m) =>
        m AttrList
        {- ^ __Returns:__ the newly allocated 'GI.Pango.Structs.AttrList.AttrList',
                  which should be freed with 'GI.Pango.Structs.AttrList.attrListUnref'. -}
    attrListNew  = liftIO $ do
        result <- pango_attr_list_new
        checkUnexpectedReturnNULL "attrListNew" result
        result' <- (wrapBoxed AttrList) result
        return result'

    #if ENABLE_OVERLOADING
    #endif

    -- method AttrList::change
    -- method type : OrdinaryMethod
    -- Args : [Arg {argCName = "list", argType = TInterface (Name {namespace = "Pango", name = "AttrList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoAttrList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attr", argType = TInterface (Name {namespace = "Pango", name = "Attribute"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the attribute to insert. Ownership of this\n       value is assumed by the list.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
    -- Lengths : []
    -- returnType : Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "pango_attr_list_change" pango_attr_list_change ::
        Ptr AttrList ->                         -- list : TInterface (Name {namespace = "Pango", name = "AttrList"})
        Ptr Pango.Attribute.Attribute ->        -- attr : TInterface (Name {namespace = "Pango", name = "Attribute"})
        IO ()

    {- |
    Insert the given attribute into the 'GI.Pango.Structs.AttrList.AttrList'. It will
    replace any attributes of the same type on that segment
    and be merged with any adjoining attributes that are identical.

    This function is slower than 'GI.Pango.Structs.AttrList.attrListInsert' for
    creating a attribute list in order (potentially much slower
    for large lists). However, 'GI.Pango.Structs.AttrList.attrListInsert' is not
    suitable for continually changing a set of attributes
    since it never removes or combines existing attributes.
    -}
    attrListChange ::
        (B.CallStack.HasCallStack, MonadIO m) =>
        AttrList
        {- ^ /@list@/: a 'GI.Pango.Structs.AttrList.AttrList' -}
        -> Pango.Attribute.Attribute
        {- ^ /@attr@/: the attribute to insert. Ownership of this
           value is assumed by the list. -}
        -> m ()
    attrListChange list attr = liftIO $ do
        list' <- unsafeManagedPtrGetPtr list
        attr' <- unsafeManagedPtrGetPtr attr
        pango_attr_list_change list' attr'
        touchManagedPtr list
        touchManagedPtr attr
        return ()

    #if ENABLE_OVERLOADING
    data AttrListChangeMethodInfo
    instance (signature ~ (Pango.Attribute.Attribute -> m ()), MonadIO m) => O.MethodInfo AttrListChangeMethodInfo AttrList signature where
        overloadedMethod _ = attrListChange

    #endif

    -- method AttrList::copy
    -- method type : OrdinaryMethod
    -- Args : [Arg {argCName = "list", argType = TInterface (Name {namespace = "Pango", name = "AttrList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoAttrList, may be %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
    -- Lengths : []
    -- returnType : Just (TInterface (Name {namespace = "Pango", name = "AttrList"}))
    -- throws : False
    -- Skip return : False

    foreign import ccall "pango_attr_list_copy" pango_attr_list_copy ::
        Ptr AttrList ->                         -- list : TInterface (Name {namespace = "Pango", name = "AttrList"})
        IO (Ptr AttrList)

    {- |
    Copy /@list@/ and return an identical new list.
    -}
    attrListCopy ::
        (B.CallStack.HasCallStack, MonadIO m) =>
        AttrList
        {- ^ /@list@/: a 'GI.Pango.Structs.AttrList.AttrList', may be 'Nothing' -}
        -> m (Maybe AttrList)
        {- ^ __Returns:__ the newly allocated 'GI.Pango.Structs.AttrList.AttrList', with a
                  reference count of one, which should
                  be freed with 'GI.Pango.Structs.AttrList.attrListUnref'.
                  Returns 'Nothing' if /@list@/ was 'Nothing'. -}
    attrListCopy list = liftIO $ do
        list' <- unsafeManagedPtrGetPtr list
        result <- pango_attr_list_copy list'
        maybeResult <- convertIfNonNull result $ \result' -> do
            result'' <- (wrapBoxed AttrList) result'
            return result''
        touchManagedPtr list
        return maybeResult

    #if ENABLE_OVERLOADING
    data AttrListCopyMethodInfo
    instance (signature ~ (m (Maybe AttrList)), MonadIO m) => O.MethodInfo AttrListCopyMethodInfo AttrList signature where
        overloadedMethod _ = attrListCopy

    #endif

    -- method AttrList::filter
    -- method type : OrdinaryMethod
    -- Args : [Arg {argCName = "list", argType = TInterface (Name {namespace = "Pango", name = "AttrList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoAttrList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "func", argType = TInterface (Name {namespace = "Pango", name = "AttrFilterFunc"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "callback function; returns %TRUE\n       if an attribute should be filtered out.", sinceVersion = Nothing}, argScope = ScopeTypeCall, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Data to be passed to @func", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
    -- Lengths : []
    -- returnType : Just (TInterface (Name {namespace = "Pango", name = "AttrList"}))
    -- throws : False
    -- Skip return : False

    foreign import ccall "pango_attr_list_filter" pango_attr_list_filter ::
        Ptr AttrList ->                         -- list : TInterface (Name {namespace = "Pango", name = "AttrList"})
        FunPtr Pango.Callbacks.C_AttrFilterFunc -> -- func : TInterface (Name {namespace = "Pango", name = "AttrFilterFunc"})
        Ptr () ->                               -- data : TBasicType TPtr
        IO (Ptr AttrList)

    {- |
    Given a 'GI.Pango.Structs.AttrList.AttrList' and callback function, removes any elements
    of /@list@/ for which /@func@/ returns 'True' and inserts them into
    a new list.

    /Since: 1.2/
    -}
    attrListFilter ::
        (B.CallStack.HasCallStack, MonadIO m) =>
        AttrList
        {- ^ /@list@/: a 'GI.Pango.Structs.AttrList.AttrList' -}
        -> Pango.Callbacks.AttrFilterFunc
        {- ^ /@func@/: callback function; returns 'True'
           if an attribute should be filtered out. -}
        -> m (Maybe AttrList)
        {- ^ __Returns:__ the new 'GI.Pango.Structs.AttrList.AttrList' or
     'Nothing' if no attributes of the given types were found. -}
    attrListFilter list func = liftIO $ do
        list' <- unsafeManagedPtrGetPtr list
        func' <- Pango.Callbacks.mk_AttrFilterFunc (Pango.Callbacks.wrap_AttrFilterFunc Nothing (Pango.Callbacks.drop_closures_AttrFilterFunc func))
        let data_ = nullPtr
        result <- pango_attr_list_filter list' func' data_
        maybeResult <- convertIfNonNull result $ \result' -> do
            result'' <- (wrapBoxed AttrList) result'
            return result''
        safeFreeFunPtr $ castFunPtrToPtr func'
        touchManagedPtr list
        return maybeResult

    #if ENABLE_OVERLOADING
    data AttrListFilterMethodInfo
    instance (signature ~ (Pango.Callbacks.AttrFilterFunc -> m (Maybe AttrList)), MonadIO m) => O.MethodInfo AttrListFilterMethodInfo AttrList signature where
        overloadedMethod _ = attrListFilter

    #endif

    -- method AttrList::insert
    -- method type : OrdinaryMethod
    -- Args : [Arg {argCName = "list", argType = TInterface (Name {namespace = "Pango", name = "AttrList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoAttrList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attr", argType = TInterface (Name {namespace = "Pango", name = "Attribute"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the attribute to insert. Ownership of this\n       value is assumed by the list.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
    -- Lengths : []
    -- returnType : Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "pango_attr_list_insert" pango_attr_list_insert ::
        Ptr AttrList ->                         -- list : TInterface (Name {namespace = "Pango", name = "AttrList"})
        Ptr Pango.Attribute.Attribute ->        -- attr : TInterface (Name {namespace = "Pango", name = "Attribute"})
        IO ()

    {- |
    Insert the given attribute into the 'GI.Pango.Structs.AttrList.AttrList'. It will
    be inserted after all other attributes with a matching
    /@startIndex@/.
    -}
    attrListInsert ::
        (B.CallStack.HasCallStack, MonadIO m) =>
        AttrList
        {- ^ /@list@/: a 'GI.Pango.Structs.AttrList.AttrList' -}
        -> Pango.Attribute.Attribute
        {- ^ /@attr@/: the attribute to insert. Ownership of this
           value is assumed by the list. -}
        -> m ()
    attrListInsert list attr = liftIO $ do
        list' <- unsafeManagedPtrGetPtr list
        attr' <- unsafeManagedPtrGetPtr attr
        pango_attr_list_insert list' attr'
        touchManagedPtr list
        touchManagedPtr attr
        return ()

    #if ENABLE_OVERLOADING
    data AttrListInsertMethodInfo
    instance (signature ~ (Pango.Attribute.Attribute -> m ()), MonadIO m) => O.MethodInfo AttrListInsertMethodInfo AttrList signature where
        overloadedMethod _ = attrListInsert

    #endif

    -- method AttrList::insert_before
    -- method type : OrdinaryMethod
    -- Args : [Arg {argCName = "list", argType = TInterface (Name {namespace = "Pango", name = "AttrList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoAttrList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attr", argType = TInterface (Name {namespace = "Pango", name = "Attribute"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the attribute to insert. Ownership of this\n       value is assumed by the list.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
    -- Lengths : []
    -- returnType : Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "pango_attr_list_insert_before" pango_attr_list_insert_before ::
        Ptr AttrList ->                         -- list : TInterface (Name {namespace = "Pango", name = "AttrList"})
        Ptr Pango.Attribute.Attribute ->        -- attr : TInterface (Name {namespace = "Pango", name = "Attribute"})
        IO ()

    {- |
    Insert the given attribute into the 'GI.Pango.Structs.AttrList.AttrList'. It will
    be inserted before all other attributes with a matching
    /@startIndex@/.
    -}
    attrListInsertBefore ::
        (B.CallStack.HasCallStack, MonadIO m) =>
        AttrList
        {- ^ /@list@/: a 'GI.Pango.Structs.AttrList.AttrList' -}
        -> Pango.Attribute.Attribute
        {- ^ /@attr@/: the attribute to insert. Ownership of this
           value is assumed by the list. -}
        -> m ()
    attrListInsertBefore list attr = liftIO $ do
        list' <- unsafeManagedPtrGetPtr list
        attr' <- unsafeManagedPtrGetPtr attr
        pango_attr_list_insert_before list' attr'
        touchManagedPtr list
        touchManagedPtr attr
        return ()

    #if ENABLE_OVERLOADING
    data AttrListInsertBeforeMethodInfo
    instance (signature ~ (Pango.Attribute.Attribute -> m ()), MonadIO m) => O.MethodInfo AttrListInsertBeforeMethodInfo AttrList signature where
        overloadedMethod _ = attrListInsertBefore

    #endif

    -- method AttrList::ref
    -- method type : OrdinaryMethod
    -- Args : [Arg {argCName = "list", argType = TInterface (Name {namespace = "Pango", name = "AttrList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoAttrList, may be %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
    -- Lengths : []
    -- returnType : Just (TInterface (Name {namespace = "Pango", name = "AttrList"}))
    -- throws : False
    -- Skip return : False

    foreign import ccall "pango_attr_list_ref" pango_attr_list_ref ::
        Ptr AttrList ->                         -- list : TInterface (Name {namespace = "Pango", name = "AttrList"})
        IO (Ptr AttrList)

    {- |
    Increase the reference count of the given attribute list by one.

    /Since: 1.10/
    -}
    attrListRef ::
        (B.CallStack.HasCallStack, MonadIO m) =>
        AttrList
        {- ^ /@list@/: a 'GI.Pango.Structs.AttrList.AttrList', may be 'Nothing' -}
        -> m AttrList
        {- ^ __Returns:__ The attribute list passed in -}
    attrListRef list = liftIO $ do
        list' <- unsafeManagedPtrGetPtr list
        result <- pango_attr_list_ref list'
        checkUnexpectedReturnNULL "attrListRef" result
        result' <- (wrapBoxed AttrList) result
        touchManagedPtr list
        return result'

    #if ENABLE_OVERLOADING
    data AttrListRefMethodInfo
    instance (signature ~ (m AttrList), MonadIO m) => O.MethodInfo AttrListRefMethodInfo AttrList signature where
        overloadedMethod _ = attrListRef

    #endif

    -- method AttrList::splice
    -- method type : OrdinaryMethod
    -- Args : [Arg {argCName = "list", argType = TInterface (Name {namespace = "Pango", name = "AttrList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoAttrList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "other", argType = TInterface (Name {namespace = "Pango", name = "AttrList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "another #PangoAttrList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pos", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the position in @list at which to insert @other", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of the spliced segment. (Note that this\n      must be specified since the attributes in @other\n      may only be present at some subsection of this range)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
    -- Lengths : []
    -- returnType : Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "pango_attr_list_splice" pango_attr_list_splice ::
        Ptr AttrList ->                         -- list : TInterface (Name {namespace = "Pango", name = "AttrList"})
        Ptr AttrList ->                         -- other : TInterface (Name {namespace = "Pango", name = "AttrList"})
        Int32 ->                                -- pos : TBasicType TInt
        Int32 ->                                -- len : TBasicType TInt
        IO ()

    {- |
    This function opens up a hole in /@list@/, fills it in with attributes from
    the left, and then merges /@other@/ on top of the hole.

    This operation is equivalent to stretching every attribute
    that applies at position /@pos@/ in /@list@/ by an amount /@len@/,
    and then calling 'GI.Pango.Structs.AttrList.attrListChange' with a copy
    of each attribute in /@other@/ in sequence (offset in position by /@pos@/).

    This operation proves useful for, for instance, inserting
    a pre-edit string in the middle of an edit buffer.
    -}
    attrListSplice ::
        (B.CallStack.HasCallStack, MonadIO m) =>
        AttrList
        {- ^ /@list@/: a 'GI.Pango.Structs.AttrList.AttrList' -}
        -> AttrList
        {- ^ /@other@/: another 'GI.Pango.Structs.AttrList.AttrList' -}
        -> Int32
        {- ^ /@pos@/: the position in /@list@/ at which to insert /@other@/ -}
        -> Int32
        {- ^ /@len@/: the length of the spliced segment. (Note that this
          must be specified since the attributes in /@other@/
          may only be present at some subsection of this range) -}
        -> m ()
    attrListSplice list other pos len = liftIO $ do
        list' <- unsafeManagedPtrGetPtr list
        other' <- unsafeManagedPtrGetPtr other
        pango_attr_list_splice list' other' pos len
        touchManagedPtr list
        touchManagedPtr other
        return ()

    #if ENABLE_OVERLOADING
    data AttrListSpliceMethodInfo
    instance (signature ~ (AttrList -> Int32 -> Int32 -> m ()), MonadIO m) => O.MethodInfo AttrListSpliceMethodInfo AttrList signature where
        overloadedMethod _ = attrListSplice

    #endif

    -- method AttrList::unref
    -- method type : OrdinaryMethod
    -- Args : [Arg {argCName = "list", argType = TInterface (Name {namespace = "Pango", name = "AttrList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoAttrList, may be %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
    -- Lengths : []
    -- returnType : Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "pango_attr_list_unref" pango_attr_list_unref ::
        Ptr AttrList ->                         -- list : TInterface (Name {namespace = "Pango", name = "AttrList"})
        IO ()

    {- |
    Decrease the reference count of the given attribute list by one.
    If the result is zero, free the attribute list and the attributes
    it contains.
    -}
    attrListUnref ::
        (B.CallStack.HasCallStack, MonadIO m) =>
        AttrList
        {- ^ /@list@/: a 'GI.Pango.Structs.AttrList.AttrList', may be 'Nothing' -}
        -> m ()
    attrListUnref list = liftIO $ do
        list' <- unsafeManagedPtrGetPtr list
        pango_attr_list_unref list'
        touchManagedPtr list
        return ()

    #if ENABLE_OVERLOADING
    data AttrListUnrefMethodInfo
    instance (signature ~ (m ()), MonadIO m) => O.MethodInfo AttrListUnrefMethodInfo AttrList signature where
        overloadedMethod _ = attrListUnref

    #endif

    #if ENABLE_OVERLOADING
    type family ResolveAttrListMethod (t :: Symbol) (o :: *) :: * where
        ResolveAttrListMethod "change" o = AttrListChangeMethodInfo
        ResolveAttrListMethod "copy" o = AttrListCopyMethodInfo
        ResolveAttrListMethod "filter" o = AttrListFilterMethodInfo
        ResolveAttrListMethod "insert" o = AttrListInsertMethodInfo
        ResolveAttrListMethod "insertBefore" o = AttrListInsertBeforeMethodInfo
        ResolveAttrListMethod "ref" o = AttrListRefMethodInfo
        ResolveAttrListMethod "splice" o = AttrListSpliceMethodInfo
        ResolveAttrListMethod "unref" o = AttrListUnrefMethodInfo
        ResolveAttrListMethod l o = O.MethodResolutionFailed l o

    instance (info ~ ResolveAttrListMethod t AttrList, O.MethodInfo info AttrList p) => O.IsLabelProxy t (AttrList -> p) where
        fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

    #if MIN_VERSION_base(4,9,0)
    instance (info ~ ResolveAttrListMethod t AttrList, O.MethodInfo info AttrList p) => O.IsLabel t (AttrList -> 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

    #endif