{- |
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.
-}

module GI.Gio.Structs.FileAttributeMatcher
    ( 

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


 -- * Methods
-- ** fileAttributeMatcherEnumerateNamespace
    fileAttributeMatcherEnumerateNamespace  ,


-- ** fileAttributeMatcherEnumerateNext
    fileAttributeMatcherEnumerateNext       ,


-- ** fileAttributeMatcherMatches
    fileAttributeMatcherMatches             ,


-- ** fileAttributeMatcherMatchesOnly
    fileAttributeMatcherMatchesOnly         ,


-- ** fileAttributeMatcherNew
    fileAttributeMatcherNew                 ,


-- ** fileAttributeMatcherRef
    fileAttributeMatcherRef                 ,


-- ** fileAttributeMatcherSubtract
    fileAttributeMatcherSubtract            ,


-- ** fileAttributeMatcherToString
    fileAttributeMatcherToString            ,


-- ** fileAttributeMatcherUnref
    fileAttributeMatcherUnref               ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.Gio.Types
import GI.Gio.Callbacks

newtype FileAttributeMatcher = FileAttributeMatcher (ForeignPtr 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

noFileAttributeMatcher :: Maybe FileAttributeMatcher
noFileAttributeMatcher = Nothing

-- method FileAttributeMatcher::new
-- method type : Constructor
-- Args : [Arg {argName = "attributes", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "attributes", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "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)


fileAttributeMatcherNew ::
    (MonadIO m) =>
    T.Text ->                               -- attributes
    m FileAttributeMatcher
fileAttributeMatcherNew attributes = liftIO $ do
    attributes' <- textToCString attributes
    result <- g_file_attribute_matcher_new attributes'
    checkUnexpectedReturnNULL "g_file_attribute_matcher_new" result
    result' <- (wrapBoxed FileAttributeMatcher) result
    freeMem attributes'
    return result'

-- method FileAttributeMatcher::enumerate_namespace
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "ns", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "ns", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_file_attribute_matcher_enumerate_namespace" g_file_attribute_matcher_enumerate_namespace :: 
    Ptr FileAttributeMatcher ->             -- _obj : TInterface "Gio" "FileAttributeMatcher"
    CString ->                              -- ns : TBasicType TUTF8
    IO CInt


fileAttributeMatcherEnumerateNamespace ::
    (MonadIO m) =>
    FileAttributeMatcher ->                 -- _obj
    T.Text ->                               -- ns
    m Bool
fileAttributeMatcherEnumerateNamespace _obj ns = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    ns' <- textToCString ns
    result <- g_file_attribute_matcher_enumerate_namespace _obj' ns'
    let result' = (/= 0) result
    touchManagedPtr _obj
    freeMem ns'
    return result'

-- method FileAttributeMatcher::enumerate_next
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "g_file_attribute_matcher_enumerate_next" g_file_attribute_matcher_enumerate_next :: 
    Ptr FileAttributeMatcher ->             -- _obj : TInterface "Gio" "FileAttributeMatcher"
    IO CString


fileAttributeMatcherEnumerateNext ::
    (MonadIO m) =>
    FileAttributeMatcher ->                 -- _obj
    m T.Text
fileAttributeMatcherEnumerateNext _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_file_attribute_matcher_enumerate_next _obj'
    checkUnexpectedReturnNULL "g_file_attribute_matcher_enumerate_next" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

-- method FileAttributeMatcher::matches
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "attribute", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "attribute", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_file_attribute_matcher_matches" g_file_attribute_matcher_matches :: 
    Ptr FileAttributeMatcher ->             -- _obj : TInterface "Gio" "FileAttributeMatcher"
    CString ->                              -- attribute : TBasicType TUTF8
    IO CInt


fileAttributeMatcherMatches ::
    (MonadIO m) =>
    FileAttributeMatcher ->                 -- _obj
    T.Text ->                               -- attribute
    m Bool
fileAttributeMatcherMatches _obj attribute = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    attribute' <- textToCString attribute
    result <- g_file_attribute_matcher_matches _obj' attribute'
    let result' = (/= 0) result
    touchManagedPtr _obj
    freeMem attribute'
    return result'

-- method FileAttributeMatcher::matches_only
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "attribute", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "attribute", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_file_attribute_matcher_matches_only" g_file_attribute_matcher_matches_only :: 
    Ptr FileAttributeMatcher ->             -- _obj : TInterface "Gio" "FileAttributeMatcher"
    CString ->                              -- attribute : TBasicType TUTF8
    IO CInt


fileAttributeMatcherMatchesOnly ::
    (MonadIO m) =>
    FileAttributeMatcher ->                 -- _obj
    T.Text ->                               -- attribute
    m Bool
fileAttributeMatcherMatchesOnly _obj attribute = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    attribute' <- textToCString attribute
    result <- g_file_attribute_matcher_matches_only _obj' attribute'
    let result' = (/= 0) result
    touchManagedPtr _obj
    freeMem attribute'
    return result'

-- method FileAttributeMatcher::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "FileAttributeMatcher"
-- throws : False
-- Skip return : False

foreign import ccall "g_file_attribute_matcher_ref" g_file_attribute_matcher_ref :: 
    Ptr FileAttributeMatcher ->             -- _obj : TInterface "Gio" "FileAttributeMatcher"
    IO (Ptr FileAttributeMatcher)


fileAttributeMatcherRef ::
    (MonadIO m) =>
    FileAttributeMatcher ->                 -- _obj
    m FileAttributeMatcher
fileAttributeMatcherRef _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_file_attribute_matcher_ref _obj'
    checkUnexpectedReturnNULL "g_file_attribute_matcher_ref" result
    result' <- (wrapBoxed FileAttributeMatcher) result
    touchManagedPtr _obj
    return result'

-- method FileAttributeMatcher::subtract
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "subtract", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "subtract", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "FileAttributeMatcher"
-- throws : False
-- Skip return : False

foreign import ccall "g_file_attribute_matcher_subtract" g_file_attribute_matcher_subtract :: 
    Ptr FileAttributeMatcher ->             -- _obj : TInterface "Gio" "FileAttributeMatcher"
    Ptr FileAttributeMatcher ->             -- subtract : TInterface "Gio" "FileAttributeMatcher"
    IO (Ptr FileAttributeMatcher)


fileAttributeMatcherSubtract ::
    (MonadIO m) =>
    FileAttributeMatcher ->                 -- _obj
    FileAttributeMatcher ->                 -- subtract
    m FileAttributeMatcher
fileAttributeMatcherSubtract _obj subtract = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    let subtract' = unsafeManagedPtrGetPtr subtract
    result <- g_file_attribute_matcher_subtract _obj' subtract'
    checkUnexpectedReturnNULL "g_file_attribute_matcher_subtract" result
    result' <- (wrapBoxed FileAttributeMatcher) result
    touchManagedPtr _obj
    touchManagedPtr subtract
    return result'

-- method FileAttributeMatcher::to_string
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "g_file_attribute_matcher_to_string" g_file_attribute_matcher_to_string :: 
    Ptr FileAttributeMatcher ->             -- _obj : TInterface "Gio" "FileAttributeMatcher"
    IO CString


fileAttributeMatcherToString ::
    (MonadIO m) =>
    FileAttributeMatcher ->                 -- _obj
    m T.Text
fileAttributeMatcherToString _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_file_attribute_matcher_to_string _obj'
    checkUnexpectedReturnNULL "g_file_attribute_matcher_to_string" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'

-- method FileAttributeMatcher::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeMatcher", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_file_attribute_matcher_unref" g_file_attribute_matcher_unref :: 
    Ptr FileAttributeMatcher ->             -- _obj : TInterface "Gio" "FileAttributeMatcher"
    IO ()


fileAttributeMatcherUnref ::
    (MonadIO m) =>
    FileAttributeMatcher ->                 -- _obj
    m ()
fileAttributeMatcherUnref _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_file_attribute_matcher_unref _obj'
    touchManagedPtr _obj
    return ()