{-# LANGUAGE CApiFFI #-} module OpenCascade.ShapeFix.Solid ( Solid , new , fromSolid , solidFromShell , perform , solid , status ) where import OpenCascade.ShapeFix.Types (Solid) import OpenCascade.ShapeFix.Internal.Destructors (deleteSolid) import OpenCascade.TopoDS.Internal.Destructors (deleteShape) import qualified OpenCascade.TopoDS.Types as TopoDS import qualified OpenCascade.Message.Types as Message import Data.Acquire (Acquire, mkAcquire) import Foreign.Ptr (Ptr) import Foreign.C (CInt (..), CBool (..)) import OpenCascade.Internal.Bool (cBoolToBool) import OpenCascade.ShapeExtend.Status (Status) import OpenCascade.Inheritance (upcast) foreign import capi unsafe "hs_ShapeFix_Solid.h hs_new_ShapeFix_Solid" rawNew :: IO (Ptr Solid) new :: Acquire (Ptr Solid) new :: Acquire (Ptr Solid) new = IO (Ptr Solid) -> (Ptr Solid -> IO ()) -> Acquire (Ptr Solid) forall a. IO a -> (a -> IO ()) -> Acquire a mkAcquire IO (Ptr Solid) rawNew Ptr Solid -> IO () deleteSolid foreign import capi unsafe "hs_ShapeFix_Solid.h hs_new_ShapeFix_Solid_fromSolid" rawFromSolid :: Ptr TopoDS.Solid -> IO (Ptr Solid) fromSolid :: Ptr TopoDS.Solid -> Acquire (Ptr Solid) fromSolid :: Ptr Solid -> Acquire (Ptr Solid) fromSolid Ptr Solid s = IO (Ptr Solid) -> (Ptr Solid -> IO ()) -> Acquire (Ptr Solid) forall a. IO a -> (a -> IO ()) -> Acquire a mkAcquire (Ptr Solid -> IO (Ptr Solid) rawFromSolid Ptr Solid s) Ptr Solid -> IO () deleteSolid foreign import capi unsafe "hs_ShapeFix_Solid.h hs_ShapeFix_Solid_perform" rawPerform :: Ptr Solid -> Ptr Message.ProgressRange -> IO (CBool) perform :: Ptr Solid -> Ptr Message.ProgressRange-> IO Bool perform :: Ptr Solid -> Ptr ProgressRange -> IO Bool perform = ((CBool -> Bool) -> IO CBool -> IO Bool forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CBool -> Bool cBoolToBool (IO CBool -> IO Bool) -> (Ptr ProgressRange -> IO CBool) -> Ptr ProgressRange -> IO Bool forall b c a. (b -> c) -> (a -> b) -> a -> c .) ((Ptr ProgressRange -> IO CBool) -> Ptr ProgressRange -> IO Bool) -> (Ptr Solid -> Ptr ProgressRange -> IO CBool) -> Ptr Solid -> Ptr ProgressRange -> IO Bool forall b c a. (b -> c) -> (a -> b) -> a -> c . Ptr Solid -> Ptr ProgressRange -> IO CBool rawPerform foreign import capi unsafe "hs_ShapeFix_Solid.h hs_ShapeFix_Solid_solid" rawSolid :: Ptr Solid -> IO (Ptr TopoDS.Shape) solid :: Ptr Solid -> Acquire (Ptr TopoDS.Shape) solid :: Ptr Solid -> Acquire (Ptr Shape) solid Ptr Solid s = IO (Ptr Shape) -> (Ptr Shape -> IO ()) -> Acquire (Ptr Shape) forall a. IO a -> (a -> IO ()) -> Acquire a mkAcquire (Ptr Solid -> IO (Ptr Shape) rawSolid Ptr Solid s) Ptr Shape -> IO () deleteShape foreign import capi unsafe "hs_ShapeFix_Solid.h hs_ShapeFix_Solid_solidFromShell" rawSolidFromShell :: Ptr Solid -> Ptr TopoDS.Shell -> IO (Ptr TopoDS.Solid) solidFromShell :: Ptr Solid -> Ptr TopoDS.Shell -> Acquire (Ptr TopoDS.Solid) solidFromShell :: Ptr Solid -> Ptr Shell -> Acquire (Ptr Solid) solidFromShell Ptr Solid s Ptr Shell shell = IO (Ptr Solid) -> (Ptr Solid -> IO ()) -> Acquire (Ptr Solid) forall a. IO a -> (a -> IO ()) -> Acquire a mkAcquire (Ptr Solid -> Ptr Shell -> IO (Ptr Solid) rawSolidFromShell Ptr Solid s Ptr Shell shell) (Ptr Shape -> IO () deleteShape (Ptr Shape -> IO ()) -> (Ptr Solid -> Ptr Shape) -> Ptr Solid -> IO () forall b c a. (b -> c) -> (a -> b) -> a -> c . Ptr Solid -> Ptr Shape forall a b. SubTypeOf a b => Ptr b -> Ptr a upcast) foreign import capi unsafe "hs_ShapeFix_Solid.h hs_ShapeFix_Solid_status" rawStatus :: Ptr Solid -> CInt -> IO CBool status :: Ptr Solid -> Status -> IO Bool status :: Ptr Solid -> Status -> IO Bool status Ptr Solid s Status toCheck = CBool -> Bool cBoolToBool (CBool -> Bool) -> IO CBool -> IO Bool forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Ptr Solid -> CInt -> IO CBool rawStatus Ptr Solid s (Int -> CInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CInt) -> (Status -> Int) -> Status -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Status -> Int forall a. Enum a => a -> Int fromEnum (Status -> CInt) -> Status -> CInt forall a b. (a -> b) -> a -> b $ Status toCheck)