{-# 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.GHashTable as B.GHT
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.Coerce as Coerce
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 GHC.Records as R
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
$c== :: FontInfo -> FontInfo -> Bool
== :: FontInfo -> FontInfo -> Bool
$c/= :: FontInfo -> FontInfo -> Bool
/= :: 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
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 :: (MIO.MonadIO m, IsFontInfo o) => o -> m FontInfo
toFontInfo :: forall (m :: * -> *) o.
(MonadIO m, IsFontInfo o) =>
o -> m FontInfo
toFontInfo = IO FontInfo -> m FontInfo
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.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'
B.ManagedPtr.unsafeCastTo ManagedPtr FontInfo -> FontInfo
FontInfo
instance B.GValue.IsGValue (Maybe FontInfo) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_poppler_font_info_get_type
gvalueSet_ :: Ptr GValue -> Maybe FontInfo -> IO ()
gvalueSet_ Ptr GValue
gv Maybe FontInfo
P.Nothing = Ptr GValue -> Ptr FontInfo -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr FontInfo
forall a. Ptr a
FP.nullPtr :: FP.Ptr FontInfo)
gvalueSet_ Ptr GValue
gv (P.Just FontInfo
obj) = FontInfo -> (Ptr FontInfo -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr FontInfo
obj (Ptr GValue -> Ptr FontInfo -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe FontInfo)
gvalueGet_ Ptr GValue
gv = do
Ptr FontInfo
ptr <- Ptr GValue -> IO (Ptr FontInfo)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr FontInfo)
if Ptr FontInfo
ptr Ptr FontInfo -> Ptr FontInfo -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr FontInfo
forall a. Ptr a
FP.nullPtr
then FontInfo -> Maybe FontInfo
forall a. a -> Maybe a
P.Just (FontInfo -> Maybe FontInfo) -> IO FontInfo -> IO (Maybe FontInfo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (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
else Maybe FontInfo -> IO (Maybe FontInfo)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe FontInfo
forall a. Maybe a
P.Nothing
#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.OverloadedMethod 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
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveFontInfoMethod t FontInfo, O.OverloadedMethod info FontInfo p, R.HasField t FontInfo p) => R.HasField t FontInfo p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveFontInfoMethod t FontInfo, O.OverloadedMethodInfo info FontInfo) => OL.IsLabel t (O.MethodProxy info FontInfo) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#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 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDocument a) =>
a -> m FontInfo
fontInfoNew a
document = IO FontInfo -> m FontInfo
forall a. IO a -> m a
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 a. a -> IO a
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 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFontInfo a) =>
a -> m ()
fontInfoFree a
fontInfo = IO () -> m ()
forall a. IO a -> m a
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 a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FontInfoFreeMethodInfo
instance (signature ~ (m ()), MonadIO m, IsFontInfo a) => O.OverloadedMethod FontInfoFreeMethodInfo a signature where
overloadedMethod = fontInfoFree
instance O.OverloadedMethodInfo FontInfoFreeMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Poppler.Objects.FontInfo.fontInfoFree",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Objects-FontInfo.html#v: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 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFontInfo a) =>
a -> Int32 -> m (Bool, FontsIter)
fontInfoScan a
fontInfo Int32
nPages = IO (Bool, FontsIter) -> m (Bool, FontsIter)
forall a. IO a -> m a
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 a. a -> IO a
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.OverloadedMethod FontInfoScanMethodInfo a signature where
overloadedMethod = fontInfoScan
instance O.OverloadedMethodInfo FontInfoScanMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Poppler.Objects.FontInfo.fontInfoScan",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Objects-FontInfo.html#v:fontInfoScan"
})
#endif