{-# LANGUAGE CApiFFI #-} module OpenCascade.StlAPI.Reader ( Reader , new , read ) where import Prelude hiding (read) import OpenCascade.StlAPI.Types (Reader) import OpenCascade.StlAPI.Internal.Destructors (deleteReader) import qualified OpenCascade.TopoDS as TopoDS import Foreign.C import Foreign.Ptr import Data.Acquire import OpenCascade.Internal.Bool (cBoolToBool) foreign import capi unsafe "hs_StlAPI_Reader.h hs_new_StlAPI_Reader" rawNew :: IO (Ptr Reader) new :: Acquire (Ptr Reader) new :: Acquire (Ptr Reader) new = IO (Ptr Reader) -> (Ptr Reader -> IO ()) -> Acquire (Ptr Reader) forall a. IO a -> (a -> IO ()) -> Acquire a mkAcquire IO (Ptr Reader) rawNew Ptr Reader -> IO () deleteReader foreign import capi unsafe "hs_StlAPI_Reader.h hs_StlAPI_Reader_read" rawRead :: Ptr Reader -> Ptr TopoDS.Shape -> CString -> IO (CBool) read :: Ptr Reader -> Ptr TopoDS.Shape -> String -> IO (Bool) read :: Ptr Reader -> Ptr Shape -> String -> IO Bool read Ptr Reader reader Ptr Shape shape String filename = CBool -> Bool cBoolToBool (CBool -> Bool) -> IO CBool -> IO Bool forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> String -> (CString -> IO CBool) -> IO CBool forall a. String -> (CString -> IO a) -> IO a withCString String filename (Ptr Reader -> Ptr Shape -> CString -> IO CBool rawRead Ptr Reader reader Ptr Shape shape)