{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Poppler.Objects.FontInfo
(
FontInfo(..) ,
IsFontInfo ,
toFontInfo ,
#if defined(ENABLE_OVERLOADING)
ResolveFontInfoMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
FontInfoFreeMethodInfo ,
#endif
fontInfoFree ,
fontInfoNew ,
#if defined(ENABLE_OVERLOADING)
FontInfoScanMethodInfo ,
#endif
fontInfoScan ,
) 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.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 GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Poppler.Objects.Document as Poppler.Document
import {-# SOURCE #-} qualified GI.Poppler.Structs.FontsIter as Poppler.FontsIter
newtype FontInfo = FontInfo (SP.ManagedPtr FontInfo)
deriving (FontInfo -> FontInfo -> Bool
(FontInfo -> FontInfo -> Bool)
-> (FontInfo -> FontInfo -> Bool) -> Eq FontInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FontInfo -> FontInfo -> Bool
$c/= :: FontInfo -> FontInfo -> Bool
== :: FontInfo -> FontInfo -> Bool
$c== :: FontInfo -> FontInfo -> Bool
Eq)
instance SP.ManagedPtrNewtype FontInfo where
toManagedPtr :: FontInfo -> ManagedPtr FontInfo
toManagedPtr (FontInfo ManagedPtr FontInfo
p) = ManagedPtr FontInfo
p
foreign import ccall "poppler_font_info_get_type"
c_poppler_font_info_get_type :: IO B.Types.GType
instance B.Types.TypedObject FontInfo where
glibType :: IO GType
glibType = IO GType
c_poppler_font_info_get_type
instance B.Types.GObject FontInfo
instance B.GValue.IsGValue FontInfo where
toGValue :: FontInfo -> IO GValue
toGValue FontInfo
o = do
GType
gtype <- IO GType
c_poppler_font_info_get_type
FontInfo -> (Ptr FontInfo -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr FontInfo
o (GType
-> (GValue -> Ptr FontInfo -> IO ()) -> Ptr FontInfo -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr FontInfo -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO FontInfo
fromGValue GValue
gv = do
Ptr FontInfo
ptr <- GValue -> IO (Ptr FontInfo)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr FontInfo)
(ManagedPtr FontInfo -> FontInfo) -> Ptr FontInfo -> IO FontInfo
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr FontInfo -> FontInfo
FontInfo Ptr FontInfo
ptr
class (SP.GObject o, O.IsDescendantOf FontInfo o) => IsFontInfo o
instance (SP.GObject o, O.IsDescendantOf FontInfo o) => IsFontInfo o
instance O.HasParentTypes FontInfo
type instance O.ParentTypes FontInfo = '[GObject.Object.Object]
toFontInfo :: (MonadIO m, IsFontInfo o) => o -> m FontInfo
toFontInfo :: o -> m FontInfo
toFontInfo = IO FontInfo -> m FontInfo
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FontInfo -> m FontInfo)
-> (o -> IO FontInfo) -> o -> m FontInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr FontInfo -> FontInfo) -> o -> IO FontInfo
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr FontInfo -> FontInfo
FontInfo
#if defined(ENABLE_OVERLOADING)
type family ResolveFontInfoMethod (t :: Symbol) (o :: *) :: * where
ResolveFontInfoMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveFontInfoMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveFontInfoMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveFontInfoMethod "free" o = FontInfoFreeMethodInfo
ResolveFontInfoMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveFontInfoMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveFontInfoMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveFontInfoMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveFontInfoMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveFontInfoMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveFontInfoMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveFontInfoMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveFontInfoMethod "scan" o = FontInfoScanMethodInfo
ResolveFontInfoMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveFontInfoMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveFontInfoMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveFontInfoMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveFontInfoMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveFontInfoMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveFontInfoMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveFontInfoMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveFontInfoMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveFontInfoMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveFontInfoMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveFontInfoMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFontInfoMethod t FontInfo, O.MethodInfo info FontInfo p) => OL.IsLabel t (FontInfo -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList FontInfo
type instance O.AttributeList FontInfo = FontInfoAttributeList
type FontInfoAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList FontInfo = FontInfoSignalList
type FontInfoSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "poppler_font_info_new" poppler_font_info_new ::
Ptr Poppler.Document.Document ->
IO (Ptr FontInfo)
fontInfoNew ::
(B.CallStack.HasCallStack, MonadIO m, Poppler.Document.IsDocument a) =>
a
-> m FontInfo
fontInfoNew :: a -> m FontInfo
fontInfoNew a
document = IO FontInfo -> m FontInfo
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FontInfo -> m FontInfo) -> IO FontInfo -> m FontInfo
forall a b. (a -> b) -> a -> b
$ do
Ptr Document
document' <- a -> IO (Ptr Document)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
document
Ptr FontInfo
result <- Ptr Document -> IO (Ptr FontInfo)
poppler_font_info_new Ptr Document
document'
Text -> Ptr FontInfo -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"fontInfoNew" Ptr FontInfo
result
FontInfo
result' <- ((ManagedPtr FontInfo -> FontInfo) -> Ptr FontInfo -> IO FontInfo
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FontInfo -> FontInfo
FontInfo) Ptr FontInfo
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
document
FontInfo -> IO FontInfo
forall (m :: * -> *) a. Monad m => a -> m a
return FontInfo
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "poppler_font_info_free" poppler_font_info_free ::
Ptr FontInfo ->
IO ()
fontInfoFree ::
(B.CallStack.HasCallStack, MonadIO m, IsFontInfo a) =>
a
-> m ()
fontInfoFree :: a -> m ()
fontInfoFree a
fontInfo = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr FontInfo
fontInfo' <- a -> IO (Ptr FontInfo)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
fontInfo
Ptr FontInfo -> IO ()
poppler_font_info_free Ptr FontInfo
fontInfo'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
fontInfo
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FontInfoFreeMethodInfo
instance (signature ~ (m ()), MonadIO m, IsFontInfo a) => O.MethodInfo FontInfoFreeMethodInfo a signature where
overloadedMethod = fontInfoFree
#endif
foreign import ccall "poppler_font_info_scan" poppler_font_info_scan ::
Ptr FontInfo ->
Int32 ->
Ptr (Ptr Poppler.FontsIter.FontsIter) ->
IO CInt
fontInfoScan ::
(B.CallStack.HasCallStack, MonadIO m, IsFontInfo a) =>
a
-> Int32
-> m ((Bool, Poppler.FontsIter.FontsIter))
fontInfoScan :: a -> Int32 -> m (Bool, FontsIter)
fontInfoScan a
fontInfo Int32
nPages = IO (Bool, FontsIter) -> m (Bool, FontsIter)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, FontsIter) -> m (Bool, FontsIter))
-> IO (Bool, FontsIter) -> m (Bool, FontsIter)
forall a b. (a -> b) -> a -> b
$ do
Ptr FontInfo
fontInfo' <- a -> IO (Ptr FontInfo)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
fontInfo
Ptr (Ptr FontsIter)
iter <- IO (Ptr (Ptr FontsIter))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Poppler.FontsIter.FontsIter))
CInt
result <- Ptr FontInfo -> Int32 -> Ptr (Ptr FontsIter) -> IO CInt
poppler_font_info_scan Ptr FontInfo
fontInfo' Int32
nPages Ptr (Ptr FontsIter)
iter
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
Ptr FontsIter
iter' <- Ptr (Ptr FontsIter) -> IO (Ptr FontsIter)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr FontsIter)
iter
FontsIter
iter'' <- ((ManagedPtr FontsIter -> FontsIter)
-> Ptr FontsIter -> IO FontsIter
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr FontsIter -> FontsIter
Poppler.FontsIter.FontsIter) Ptr FontsIter
iter'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
fontInfo
Ptr (Ptr FontsIter) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr FontsIter)
iter
(Bool, FontsIter) -> IO (Bool, FontsIter)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', FontsIter
iter'')
#if defined(ENABLE_OVERLOADING)
data FontInfoScanMethodInfo
instance (signature ~ (Int32 -> m ((Bool, Poppler.FontsIter.FontsIter))), MonadIO m, IsFontInfo a) => O.MethodInfo FontInfoScanMethodInfo a signature where
overloadedMethod = fontInfoScan
#endif