{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-} module GDAL.OGREnvelope.Cast where import Foreign.Ptr import FFICXX.Runtime.Cast import System.IO.Unsafe import GDAL.OGREnvelope.RawType import GDAL.OGREnvelope.Interface instance (IOGREnvelope a, FPtr a) => Castable (a) (Ptr RawOGREnvelope) where cast :: forall r. a -> (Ptr RawOGREnvelope -> IO r) -> IO r cast a x Ptr RawOGREnvelope -> IO r f = Ptr RawOGREnvelope -> IO r f (Ptr (Raw a) -> Ptr RawOGREnvelope forall a b. Ptr a -> Ptr b castPtr (a -> Ptr (Raw a) forall a. FPtr a => a -> Ptr (Raw a) get_fptr a x)) uncast :: forall r. Ptr RawOGREnvelope -> (a -> IO r) -> IO r uncast Ptr RawOGREnvelope x a -> IO r f = a -> IO r f (Ptr (Raw a) -> a forall a. FPtr a => Ptr (Raw a) -> a cast_fptr_to_obj (Ptr RawOGREnvelope -> Ptr (Raw a) forall a b. Ptr a -> Ptr b castPtr Ptr RawOGREnvelope x)) instance () => Castable (OGREnvelope) (Ptr RawOGREnvelope) where cast :: forall r. OGREnvelope -> (Ptr RawOGREnvelope -> IO r) -> IO r cast OGREnvelope x Ptr RawOGREnvelope -> IO r f = Ptr RawOGREnvelope -> IO r f (Ptr RawOGREnvelope -> Ptr RawOGREnvelope forall a b. Ptr a -> Ptr b castPtr (OGREnvelope -> Ptr (Raw OGREnvelope) forall a. FPtr a => a -> Ptr (Raw a) get_fptr OGREnvelope x)) uncast :: forall r. Ptr RawOGREnvelope -> (OGREnvelope -> IO r) -> IO r uncast Ptr RawOGREnvelope x OGREnvelope -> IO r f = OGREnvelope -> IO r f (Ptr (Raw OGREnvelope) -> OGREnvelope forall a. FPtr a => Ptr (Raw a) -> a cast_fptr_to_obj (Ptr RawOGREnvelope -> Ptr RawOGREnvelope forall a b. Ptr a -> Ptr b castPtr Ptr RawOGREnvelope x))