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

Determines if a string matches a file attribute.
-}

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

module GI.Gio.Structs.FileAttributeMatcher
    (

-- * Exported types
    FileAttributeMatcher(..)                ,
    noFileAttributeMatcher                  ,


 -- * Methods
-- ** enumerateNamespace #method:enumerateNamespace#

#if ENABLE_OVERLOADING
    FileAttributeMatcherEnumerateNamespaceMethodInfo,
#endif
    fileAttributeMatcherEnumerateNamespace  ,


-- ** enumerateNext #method:enumerateNext#

#if ENABLE_OVERLOADING
    FileAttributeMatcherEnumerateNextMethodInfo,
#endif
    fileAttributeMatcherEnumerateNext       ,


-- ** matches #method:matches#

#if ENABLE_OVERLOADING
    FileAttributeMatcherMatchesMethodInfo   ,
#endif
    fileAttributeMatcherMatches             ,


-- ** matchesOnly #method:matchesOnly#

#if ENABLE_OVERLOADING
    FileAttributeMatcherMatchesOnlyMethodInfo,
#endif
    fileAttributeMatcherMatchesOnly         ,


-- ** new #method:new#

    fileAttributeMatcherNew                 ,


-- ** ref #method:ref#

#if ENABLE_OVERLOADING
    FileAttributeMatcherRefMethodInfo       ,
#endif
    fileAttributeMatcherRef                 ,


-- ** subtract #method:subtract#

#if ENABLE_OVERLOADING
    FileAttributeMatcherSubtractMethodInfo  ,
#endif
    fileAttributeMatcherSubtract            ,


-- ** toString #method:toString#

#if ENABLE_OVERLOADING
    FileAttributeMatcherToStringMethodInfo  ,
#endif
    fileAttributeMatcherToString            ,


-- ** unref #method:unref#

#if ENABLE_OVERLOADING
    FileAttributeMatcherUnrefMethodInfo     ,
#endif
    fileAttributeMatcherUnref               ,




    ) 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


-- | Memory-managed wrapper type.
newtype FileAttributeMatcher = FileAttributeMatcher (ManagedPtr FileAttributeMatcher)
foreign import ccall "g_file_attribute_matcher_get_type" c_g_file_attribute_matcher_get_type ::
    IO GType

instance BoxedObject FileAttributeMatcher where
    boxedType _ = c_g_file_attribute_matcher_get_type

-- | A convenience alias for `Nothing` :: `Maybe` `FileAttributeMatcher`.
noFileAttributeMatcher :: Maybe FileAttributeMatcher
noFileAttributeMatcher = Nothing


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

-- method FileAttributeMatcher::new
-- method type : Constructor
-- Args : [Arg {argCName = "attributes", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an attribute string to match.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_file_attribute_matcher_new" g_file_attribute_matcher_new ::
    CString ->                              -- attributes : TBasicType TUTF8
    IO (Ptr FileAttributeMatcher)

{- |
Creates a new file attribute matcher, which matches attributes
against a given string. @/GFileAttributeMatchers/@ are reference
counted structures, and are created with a reference count of 1. If
the number of references falls to 0, the 'GI.Gio.Structs.FileAttributeMatcher.FileAttributeMatcher' is
automatically destroyed.

The /@attribute@/ string should be formatted with specific keys separated
from namespaces with a double colon. Several \"namespace::key\" strings may be
concatenated with a single comma (e.g. \"standard::type,standard::is-hidden\").
The wildcard \"*\" may be used to match all keys and namespaces, or
\"namespace::*\" will match all keys in a given namespace.

== Examples of file attribute matcher strings and results


* @\"*\"@: matches all attributes.
* @\"standard::is-hidden\"@: matches only the key is-hidden in the
standard namespace.
* @\"standard::type,unix::*\"@: matches the type key in the standard
namespace and all keys in the unix namespace.
-}
fileAttributeMatcherNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@attributes@/: an attribute string to match. -}
    -> m FileAttributeMatcher
    {- ^ __Returns:__ a 'GI.Gio.Structs.FileAttributeMatcher.FileAttributeMatcher' -}
fileAttributeMatcherNew attributes = liftIO $ do
    attributes' <- textToCString attributes
    result <- g_file_attribute_matcher_new attributes'
    checkUnexpectedReturnNULL "fileAttributeMatcherNew" result
    result' <- (wrapBoxed FileAttributeMatcher) result
    freeMem attributes'
    return result'

#if ENABLE_OVERLOADING
#endif

-- method FileAttributeMatcher::enumerate_namespace
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "matcher", argType = TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GFileAttributeMatcher.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ns", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a string containing a file attribute namespace.", 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 "g_file_attribute_matcher_enumerate_namespace" g_file_attribute_matcher_enumerate_namespace ::
    Ptr FileAttributeMatcher ->             -- matcher : TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"})
    CString ->                              -- ns : TBasicType TUTF8
    IO CInt

{- |
Checks if the matcher will match all of the keys in a given namespace.
This will always return 'True' if a wildcard character is in use (e.g. if
matcher was created with \"standard::*\" and /@ns@/ is \"standard\", or if matcher was created
using \"*\" and namespace is anything.)

TODO: this is awkwardly worded.
-}
fileAttributeMatcherEnumerateNamespace ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FileAttributeMatcher
    {- ^ /@matcher@/: a 'GI.Gio.Structs.FileAttributeMatcher.FileAttributeMatcher'. -}
    -> T.Text
    {- ^ /@ns@/: a string containing a file attribute namespace. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the matcher matches all of the entries
in the given /@ns@/, 'False' otherwise. -}
fileAttributeMatcherEnumerateNamespace matcher ns = liftIO $ do
    matcher' <- unsafeManagedPtrGetPtr matcher
    ns' <- textToCString ns
    result <- g_file_attribute_matcher_enumerate_namespace matcher' ns'
    let result' = (/= 0) result
    touchManagedPtr matcher
    freeMem ns'
    return result'

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

#endif

-- method FileAttributeMatcher::enumerate_next
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "matcher", argType = TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GFileAttributeMatcher.", 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 "g_file_attribute_matcher_enumerate_next" g_file_attribute_matcher_enumerate_next ::
    Ptr FileAttributeMatcher ->             -- matcher : TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"})
    IO CString

{- |
Gets the next matched attribute from a 'GI.Gio.Structs.FileAttributeMatcher.FileAttributeMatcher'.
-}
fileAttributeMatcherEnumerateNext ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FileAttributeMatcher
    {- ^ /@matcher@/: a 'GI.Gio.Structs.FileAttributeMatcher.FileAttributeMatcher'. -}
    -> m T.Text
    {- ^ __Returns:__ a string containing the next attribute or 'Nothing' if
no more attribute exist. -}
fileAttributeMatcherEnumerateNext matcher = liftIO $ do
    matcher' <- unsafeManagedPtrGetPtr matcher
    result <- g_file_attribute_matcher_enumerate_next matcher'
    checkUnexpectedReturnNULL "fileAttributeMatcherEnumerateNext" result
    result' <- cstringToText result
    touchManagedPtr matcher
    return result'

#if ENABLE_OVERLOADING
data FileAttributeMatcherEnumerateNextMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo FileAttributeMatcherEnumerateNextMethodInfo FileAttributeMatcher signature where
    overloadedMethod _ = fileAttributeMatcherEnumerateNext

#endif

-- method FileAttributeMatcher::matches
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "matcher", argType = TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GFileAttributeMatcher.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attribute", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a file attribute key.", 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 "g_file_attribute_matcher_matches" g_file_attribute_matcher_matches ::
    Ptr FileAttributeMatcher ->             -- matcher : TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"})
    CString ->                              -- attribute : TBasicType TUTF8
    IO CInt

{- |
Checks if an attribute will be matched by an attribute matcher. If
the matcher was created with the \"*\" matching string, this function
will always return 'True'.
-}
fileAttributeMatcherMatches ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FileAttributeMatcher
    {- ^ /@matcher@/: a 'GI.Gio.Structs.FileAttributeMatcher.FileAttributeMatcher'. -}
    -> T.Text
    {- ^ /@attribute@/: a file attribute key. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@attribute@/ matches /@matcher@/. 'False' otherwise. -}
fileAttributeMatcherMatches matcher attribute = liftIO $ do
    matcher' <- unsafeManagedPtrGetPtr matcher
    attribute' <- textToCString attribute
    result <- g_file_attribute_matcher_matches matcher' attribute'
    let result' = (/= 0) result
    touchManagedPtr matcher
    freeMem attribute'
    return result'

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

#endif

-- method FileAttributeMatcher::matches_only
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "matcher", argType = TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GFileAttributeMatcher.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attribute", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a file attribute key.", 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 "g_file_attribute_matcher_matches_only" g_file_attribute_matcher_matches_only ::
    Ptr FileAttributeMatcher ->             -- matcher : TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"})
    CString ->                              -- attribute : TBasicType TUTF8
    IO CInt

{- |
Checks if a attribute matcher only matches a given attribute. Always
returns 'False' if \"*\" was used when creating the matcher.
-}
fileAttributeMatcherMatchesOnly ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FileAttributeMatcher
    {- ^ /@matcher@/: a 'GI.Gio.Structs.FileAttributeMatcher.FileAttributeMatcher'. -}
    -> T.Text
    {- ^ /@attribute@/: a file attribute key. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the matcher only matches /@attribute@/. 'False' otherwise. -}
fileAttributeMatcherMatchesOnly matcher attribute = liftIO $ do
    matcher' <- unsafeManagedPtrGetPtr matcher
    attribute' <- textToCString attribute
    result <- g_file_attribute_matcher_matches_only matcher' attribute'
    let result' = (/= 0) result
    touchManagedPtr matcher
    freeMem attribute'
    return result'

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

#endif

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

foreign import ccall "g_file_attribute_matcher_ref" g_file_attribute_matcher_ref ::
    Ptr FileAttributeMatcher ->             -- matcher : TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"})
    IO (Ptr FileAttributeMatcher)

{- |
References a file attribute matcher.
-}
fileAttributeMatcherRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FileAttributeMatcher
    {- ^ /@matcher@/: a 'GI.Gio.Structs.FileAttributeMatcher.FileAttributeMatcher'. -}
    -> m FileAttributeMatcher
    {- ^ __Returns:__ a 'GI.Gio.Structs.FileAttributeMatcher.FileAttributeMatcher'. -}
fileAttributeMatcherRef matcher = liftIO $ do
    matcher' <- unsafeManagedPtrGetPtr matcher
    result <- g_file_attribute_matcher_ref matcher'
    checkUnexpectedReturnNULL "fileAttributeMatcherRef" result
    result' <- (wrapBoxed FileAttributeMatcher) result
    touchManagedPtr matcher
    return result'

#if ENABLE_OVERLOADING
data FileAttributeMatcherRefMethodInfo
instance (signature ~ (m FileAttributeMatcher), MonadIO m) => O.MethodInfo FileAttributeMatcherRefMethodInfo FileAttributeMatcher signature where
    overloadedMethod _ = fileAttributeMatcherRef

#endif

-- method FileAttributeMatcher::subtract
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "matcher", argType = TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Matcher to subtract from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "subtract", argType = TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The matcher to subtract", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_file_attribute_matcher_subtract" g_file_attribute_matcher_subtract ::
    Ptr FileAttributeMatcher ->             -- matcher : TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"})
    Ptr FileAttributeMatcher ->             -- subtract : TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"})
    IO (Ptr FileAttributeMatcher)

{- |
Subtracts all attributes of /@subtract@/ from /@matcher@/ and returns
a matcher that supports those attributes.

Note that currently it is not possible to remove a single
attribute when the /@matcher@/ matches the whole namespace - or remove
a namespace or attribute when the matcher matches everything. This
is a limitation of the current implementation, but may be fixed
in the future.
-}
fileAttributeMatcherSubtract ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FileAttributeMatcher
    {- ^ /@matcher@/: Matcher to subtract from -}
    -> FileAttributeMatcher
    {- ^ /@subtract@/: The matcher to subtract -}
    -> m FileAttributeMatcher
    {- ^ __Returns:__ A file attribute matcher matching all attributes of
    /@matcher@/ that are not matched by /@subtract@/ -}
fileAttributeMatcherSubtract matcher subtract = liftIO $ do
    matcher' <- unsafeManagedPtrGetPtr matcher
    subtract' <- unsafeManagedPtrGetPtr subtract
    result <- g_file_attribute_matcher_subtract matcher' subtract'
    checkUnexpectedReturnNULL "fileAttributeMatcherSubtract" result
    result' <- (wrapBoxed FileAttributeMatcher) result
    touchManagedPtr matcher
    touchManagedPtr subtract
    return result'

#if ENABLE_OVERLOADING
data FileAttributeMatcherSubtractMethodInfo
instance (signature ~ (FileAttributeMatcher -> m FileAttributeMatcher), MonadIO m) => O.MethodInfo FileAttributeMatcherSubtractMethodInfo FileAttributeMatcher signature where
    overloadedMethod _ = fileAttributeMatcherSubtract

#endif

-- method FileAttributeMatcher::to_string
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "matcher", argType = TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GFileAttributeMatcher.", 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 "g_file_attribute_matcher_to_string" g_file_attribute_matcher_to_string ::
    Ptr FileAttributeMatcher ->             -- matcher : TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"})
    IO CString

{- |
Prints what the matcher is matching against. The format will be
equal to the format passed to 'GI.Gio.Structs.FileAttributeMatcher.fileAttributeMatcherNew'.
The output however, might not be identical, as the matcher may
decide to use a different order or omit needless parts.

/Since: 2.32/
-}
fileAttributeMatcherToString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FileAttributeMatcher
    {- ^ /@matcher@/: a 'GI.Gio.Structs.FileAttributeMatcher.FileAttributeMatcher'. -}
    -> m T.Text
    {- ^ __Returns:__ a string describing the attributes the matcher matches
  against or 'Nothing' if /@matcher@/ was 'Nothing'. -}
fileAttributeMatcherToString matcher = liftIO $ do
    matcher' <- unsafeManagedPtrGetPtr matcher
    result <- g_file_attribute_matcher_to_string matcher'
    checkUnexpectedReturnNULL "fileAttributeMatcherToString" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr matcher
    return result'

#if ENABLE_OVERLOADING
data FileAttributeMatcherToStringMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo FileAttributeMatcherToStringMethodInfo FileAttributeMatcher signature where
    overloadedMethod _ = fileAttributeMatcherToString

#endif

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

foreign import ccall "g_file_attribute_matcher_unref" g_file_attribute_matcher_unref ::
    Ptr FileAttributeMatcher ->             -- matcher : TInterface (Name {namespace = "Gio", name = "FileAttributeMatcher"})
    IO ()

{- |
Unreferences /@matcher@/. If the reference count falls below 1,
the /@matcher@/ is automatically freed.
-}
fileAttributeMatcherUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FileAttributeMatcher
    {- ^ /@matcher@/: a 'GI.Gio.Structs.FileAttributeMatcher.FileAttributeMatcher'. -}
    -> m ()
fileAttributeMatcherUnref matcher = liftIO $ do
    matcher' <- unsafeManagedPtrGetPtr matcher
    g_file_attribute_matcher_unref matcher'
    touchManagedPtr matcher
    return ()

#if ENABLE_OVERLOADING
data FileAttributeMatcherUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo FileAttributeMatcherUnrefMethodInfo FileAttributeMatcher signature where
    overloadedMethod _ = fileAttributeMatcherUnref

#endif

#if ENABLE_OVERLOADING
type family ResolveFileAttributeMatcherMethod (t :: Symbol) (o :: *) :: * where
    ResolveFileAttributeMatcherMethod "enumerateNamespace" o = FileAttributeMatcherEnumerateNamespaceMethodInfo
    ResolveFileAttributeMatcherMethod "enumerateNext" o = FileAttributeMatcherEnumerateNextMethodInfo
    ResolveFileAttributeMatcherMethod "matches" o = FileAttributeMatcherMatchesMethodInfo
    ResolveFileAttributeMatcherMethod "matchesOnly" o = FileAttributeMatcherMatchesOnlyMethodInfo
    ResolveFileAttributeMatcherMethod "ref" o = FileAttributeMatcherRefMethodInfo
    ResolveFileAttributeMatcherMethod "subtract" o = FileAttributeMatcherSubtractMethodInfo
    ResolveFileAttributeMatcherMethod "toString" o = FileAttributeMatcherToStringMethodInfo
    ResolveFileAttributeMatcherMethod "unref" o = FileAttributeMatcherUnrefMethodInfo
    ResolveFileAttributeMatcherMethod l o = O.MethodResolutionFailed l o

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

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