{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- An opaque structure representing a test case.

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

module GI.GLib.Structs.TestCase
    ( 

-- * Exported types
    TestCase(..)                            ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [free]("GI.GLib.Structs.TestCase#g:method:free").
-- 
-- ==== Getters
-- /None/.
-- 
-- ==== Setters
-- /None/.

#if defined(ENABLE_OVERLOADING)
    ResolveTestCaseMethod                   ,
#endif

-- ** free #method:free#

#if defined(ENABLE_OVERLOADING)
    TestCaseFreeMethodInfo                  ,
#endif
    testCaseFree                            ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R


-- | Memory-managed wrapper type.
newtype TestCase = TestCase (SP.ManagedPtr TestCase)
    deriving (TestCase -> TestCase -> Bool
(TestCase -> TestCase -> Bool)
-> (TestCase -> TestCase -> Bool) -> Eq TestCase
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestCase -> TestCase -> Bool
$c/= :: TestCase -> TestCase -> Bool
== :: TestCase -> TestCase -> Bool
$c== :: TestCase -> TestCase -> Bool
Eq)

instance SP.ManagedPtrNewtype TestCase where
    toManagedPtr :: TestCase -> ManagedPtr TestCase
toManagedPtr (TestCase ManagedPtr TestCase
p) = ManagedPtr TestCase
p

-- XXX Wrapping a foreign struct/union with no known destructor or size, leak?
instance BoxedPtr TestCase where
    boxedPtrCopy :: TestCase -> IO TestCase
boxedPtrCopy = TestCase -> IO TestCase
forall (m :: * -> *) a. Monad m => a -> m a
return
    boxedPtrFree :: TestCase -> IO ()
boxedPtrFree = \TestCase
_x -> () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


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

-- method TestCase::free
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "test_case"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "TestCase" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GTestCase" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_test_case_free" g_test_case_free :: 
    Ptr TestCase ->                         -- test_case : TInterface (Name {namespace = "GLib", name = "TestCase"})
    IO ()

-- | Free the /@testCase@/.
-- 
-- /Since: 2.70/
testCaseFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TestCase
    -- ^ /@testCase@/: a t'GI.GLib.Structs.TestCase.TestCase'
    -> m ()
testCaseFree :: forall (m :: * -> *). (HasCallStack, MonadIO m) => TestCase -> m ()
testCaseFree TestCase
testCase = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr TestCase
testCase' <- TestCase -> IO (Ptr TestCase)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TestCase
testCase
    Ptr TestCase -> IO ()
g_test_case_free Ptr TestCase
testCase'
    TestCase -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TestCase
testCase
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data TestCaseFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod TestCaseFreeMethodInfo TestCase signature where
    overloadedMethod = testCaseFree

instance O.OverloadedMethodInfo TestCaseFreeMethodInfo TestCase where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GLib.Structs.TestCase.testCaseFree",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-TestCase.html#v:testCaseFree"
        })


#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveTestCaseMethod (t :: Symbol) (o :: *) :: * where
    ResolveTestCaseMethod "free" o = TestCaseFreeMethodInfo
    ResolveTestCaseMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveTestCaseMethod t TestCase, O.OverloadedMethod info TestCase p) => OL.IsLabel t (TestCase -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveTestCaseMethod t TestCase, O.OverloadedMethod info TestCase p, R.HasField t TestCase p) => R.HasField t TestCase p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveTestCaseMethod t TestCase, O.OverloadedMethodInfo info TestCase) => OL.IsLabel t (O.MethodProxy info TestCase) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif