{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-} module GDAL.OGRSurface.Cast where import Foreign.Ptr import FFICXX.Runtime.Cast import System.IO.Unsafe import GDAL.OGRSurface.RawType import GDAL.OGRSurface.Interface instance (IOGRSurface a, FPtr a) => Castable (a) (Ptr RawOGRSurface) where cast :: forall r. a -> (Ptr RawOGRSurface -> IO r) -> IO r cast a x Ptr RawOGRSurface -> IO r f = Ptr RawOGRSurface -> IO r f (Ptr (Raw a) -> Ptr RawOGRSurface 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 RawOGRSurface -> (a -> IO r) -> IO r uncast Ptr RawOGRSurface 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 RawOGRSurface -> Ptr (Raw a) forall a b. Ptr a -> Ptr b castPtr Ptr RawOGRSurface x)) instance () => Castable (OGRSurface) (Ptr RawOGRSurface) where cast :: forall r. OGRSurface -> (Ptr RawOGRSurface -> IO r) -> IO r cast OGRSurface x Ptr RawOGRSurface -> IO r f = Ptr RawOGRSurface -> IO r f (Ptr RawOGRSurface -> Ptr RawOGRSurface forall a b. Ptr a -> Ptr b castPtr (OGRSurface -> Ptr (Raw OGRSurface) forall a. FPtr a => a -> Ptr (Raw a) get_fptr OGRSurface x)) uncast :: forall r. Ptr RawOGRSurface -> (OGRSurface -> IO r) -> IO r uncast Ptr RawOGRSurface x OGRSurface -> IO r f = OGRSurface -> IO r f (Ptr (Raw OGRSurface) -> OGRSurface forall a. FPtr a => Ptr (Raw a) -> a cast_fptr_to_obj (Ptr RawOGRSurface -> Ptr RawOGRSurface forall a b. Ptr a -> Ptr b castPtr Ptr RawOGRSurface x))