{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A fundamental type that describes a @/gint64/@ range

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

module GI.Gst.Objects.Int64Range
    ( 

-- * Exported types
    Int64Range(..)                          ,
    IsInt64Range                            ,
    toInt64Range                            ,


 -- * Methods

#if defined(ENABLE_OVERLOADING)
    ResolveInt64RangeMethod                 ,
#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.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 Int64Range = Int64Range (SP.ManagedPtr Int64Range)
    deriving (Int64Range -> Int64Range -> Bool
(Int64Range -> Int64Range -> Bool)
-> (Int64Range -> Int64Range -> Bool) -> Eq Int64Range
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Int64Range -> Int64Range -> Bool
$c/= :: Int64Range -> Int64Range -> Bool
== :: Int64Range -> Int64Range -> Bool
$c== :: Int64Range -> Int64Range -> Bool
Eq)

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

foreign import ccall "gst_int64_range_get_type"
    c_gst_int64_range_get_type :: IO B.Types.GType

instance B.Types.TypedObject Int64Range where
    glibType :: IO GType
glibType = IO GType
c_gst_int64_range_get_type

-- | Type class for types which can be safely cast to `Int64Range`, for instance with `toInt64Range`.
class (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf Int64Range o) => IsInt64Range o
instance (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf Int64Range o) => IsInt64Range o

instance O.HasParentTypes Int64Range
type instance O.ParentTypes Int64Range = '[]

-- | Cast to `Int64Range`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toInt64Range :: (MIO.MonadIO m, IsInt64Range o) => o -> m Int64Range
toInt64Range :: forall (m :: * -> *) o.
(MonadIO m, IsInt64Range o) =>
o -> m Int64Range
toInt64Range = IO Int64Range -> m Int64Range
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Int64Range -> m Int64Range)
-> (o -> IO Int64Range) -> o -> m Int64Range
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Int64Range -> Int64Range) -> o -> IO Int64Range
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Int64Range -> Int64Range
Int64Range

--- XXX Missing getter and/or setter, so no GValue instance could be generated.
#if defined(ENABLE_OVERLOADING)
type family ResolveInt64RangeMethod (t :: Symbol) (o :: *) :: * where
    ResolveInt64RangeMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveInt64RangeMethod t Int64Range, O.OverloadedMethod info Int64Range p) => OL.IsLabel t (Int64Range -> 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 ~ ResolveInt64RangeMethod t Int64Range, O.OverloadedMethod info Int64Range p, R.HasField t Int64Range p) => R.HasField t Int64Range p where
    getField = O.overloadedMethod @info

#endif

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

#endif

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