{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Pango.Structs.Item
(
Item(..) ,
newZeroItem ,
#if defined(ENABLE_OVERLOADING)
ResolveItemMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
ItemApplyAttrsMethodInfo ,
#endif
itemApplyAttrs ,
#if defined(ENABLE_OVERLOADING)
ItemCopyMethodInfo ,
#endif
itemCopy ,
#if defined(ENABLE_OVERLOADING)
ItemFreeMethodInfo ,
#endif
itemFree ,
itemNew ,
#if defined(ENABLE_OVERLOADING)
ItemSplitMethodInfo ,
#endif
itemSplit ,
getItemAnalysis ,
#if defined(ENABLE_OVERLOADING)
item_analysis ,
#endif
getItemLength ,
#if defined(ENABLE_OVERLOADING)
item_length ,
#endif
setItemLength ,
getItemNumChars ,
#if defined(ENABLE_OVERLOADING)
item_numChars ,
#endif
setItemNumChars ,
getItemOffset ,
#if defined(ENABLE_OVERLOADING)
item_offset ,
#endif
setItemOffset ,
) 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.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 {-# SOURCE #-} qualified GI.Pango.Structs.Analysis as Pango.Analysis
import {-# SOURCE #-} qualified GI.Pango.Structs.AttrIterator as Pango.AttrIterator
newtype Item = Item (SP.ManagedPtr Item)
deriving (Item -> Item -> Bool
(Item -> Item -> Bool) -> (Item -> Item -> Bool) -> Eq Item
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Item -> Item -> Bool
$c/= :: Item -> Item -> Bool
== :: Item -> Item -> Bool
$c== :: Item -> Item -> Bool
Eq)
instance SP.ManagedPtrNewtype Item where
toManagedPtr :: Item -> ManagedPtr Item
toManagedPtr (Item ManagedPtr Item
p) = ManagedPtr Item
p
foreign import ccall "pango_item_get_type" c_pango_item_get_type ::
IO GType
type instance O.ParentTypes Item = '[]
instance O.HasParentTypes Item
instance B.Types.TypedObject Item where
glibType :: IO GType
glibType = IO GType
c_pango_item_get_type
instance B.Types.GBoxed Item
instance B.GValue.IsGValue (Maybe Item) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_pango_item_get_type
gvalueSet_ :: Ptr GValue -> Maybe Item -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Item
P.Nothing = Ptr GValue -> Ptr Item -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr Item
forall a. Ptr a
FP.nullPtr :: FP.Ptr Item)
gvalueSet_ Ptr GValue
gv (P.Just Item
obj) = Item -> (Ptr Item -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Item
obj (Ptr GValue -> Ptr Item -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Item)
gvalueGet_ Ptr GValue
gv = do
Ptr Item
ptr <- Ptr GValue -> IO (Ptr Item)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr Item)
if Ptr Item
ptr Ptr Item -> Ptr Item -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Item
forall a. Ptr a
FP.nullPtr
then Item -> Maybe Item
forall a. a -> Maybe a
P.Just (Item -> Maybe Item) -> IO Item -> IO (Maybe Item)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Item -> Item) -> Ptr Item -> IO Item
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Item -> Item
Item Ptr Item
ptr
else Maybe Item -> IO (Maybe Item)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Item
forall a. Maybe a
P.Nothing
newZeroItem :: MonadIO m => m Item
newZeroItem :: forall (m :: * -> *). MonadIO m => m Item
newZeroItem = IO Item -> m Item
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Item -> m Item) -> IO Item -> m Item
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr Item)
forall a. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
64 IO (Ptr Item) -> (Ptr Item -> IO Item) -> IO Item
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr Item -> Item) -> Ptr Item -> IO Item
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Item -> Item
Item
instance tag ~ 'AttrSet => Constructible Item tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr Item -> Item) -> [AttrOp Item tag] -> m Item
new ManagedPtr Item -> Item
_ [AttrOp Item tag]
attrs = do
Item
o <- m Item
forall (m :: * -> *). MonadIO m => m Item
newZeroItem
Item -> [AttrOp Item 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set Item
o [AttrOp Item tag]
[AttrOp Item 'AttrSet]
attrs
Item -> m Item
forall (m :: * -> *) a. Monad m => a -> m a
return Item
o
getItemOffset :: MonadIO m => Item -> m Int32
getItemOffset :: forall (m :: * -> *). MonadIO m => Item -> m Int32
getItemOffset Item
s = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ Item -> (Ptr Item -> IO Int32) -> IO Int32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Item
s ((Ptr Item -> IO Int32) -> IO Int32)
-> (Ptr Item -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \Ptr Item
ptr -> do
Int32
val <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek (Ptr Item
ptr Ptr Item -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO Int32
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
val
setItemOffset :: MonadIO m => Item -> Int32 -> m ()
setItemOffset :: forall (m :: * -> *). MonadIO m => Item -> Int32 -> m ()
setItemOffset Item
s Int32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Item -> (Ptr Item -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Item
s ((Ptr Item -> IO ()) -> IO ()) -> (Ptr Item -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Item
ptr -> do
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Item
ptr Ptr Item -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (Int32
val :: Int32)
#if defined(ENABLE_OVERLOADING)
data ItemOffsetFieldInfo
instance AttrInfo ItemOffsetFieldInfo where
type AttrBaseTypeConstraint ItemOffsetFieldInfo = (~) Item
type AttrAllowedOps ItemOffsetFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint ItemOffsetFieldInfo = (~) Int32
type AttrTransferTypeConstraint ItemOffsetFieldInfo = (~)Int32
type AttrTransferType ItemOffsetFieldInfo = Int32
type AttrGetType ItemOffsetFieldInfo = Int32
type AttrLabel ItemOffsetFieldInfo = "offset"
type AttrOrigin ItemOffsetFieldInfo = Item
attrGet = getItemOffset
attrSet = setItemOffset
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.Item.offset"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.25/docs/GI-Pango-Structs-Item.html#g:attr:offset"
})
item_offset :: AttrLabelProxy "offset"
item_offset = AttrLabelProxy
#endif
getItemLength :: MonadIO m => Item -> m Int32
getItemLength :: forall (m :: * -> *). MonadIO m => Item -> m Int32
getItemLength Item
s = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ Item -> (Ptr Item -> IO Int32) -> IO Int32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Item
s ((Ptr Item -> IO Int32) -> IO Int32)
-> (Ptr Item -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \Ptr Item
ptr -> do
Int32
val <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek (Ptr Item
ptr Ptr Item -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) :: IO Int32
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
val
setItemLength :: MonadIO m => Item -> Int32 -> m ()
setItemLength :: forall (m :: * -> *). MonadIO m => Item -> Int32 -> m ()
setItemLength Item
s Int32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Item -> (Ptr Item -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Item
s ((Ptr Item -> IO ()) -> IO ()) -> (Ptr Item -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Item
ptr -> do
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Item
ptr Ptr Item -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) (Int32
val :: Int32)
#if defined(ENABLE_OVERLOADING)
data ItemLengthFieldInfo
instance AttrInfo ItemLengthFieldInfo where
type AttrBaseTypeConstraint ItemLengthFieldInfo = (~) Item
type AttrAllowedOps ItemLengthFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint ItemLengthFieldInfo = (~) Int32
type AttrTransferTypeConstraint ItemLengthFieldInfo = (~)Int32
type AttrTransferType ItemLengthFieldInfo = Int32
type AttrGetType ItemLengthFieldInfo = Int32
type AttrLabel ItemLengthFieldInfo = "length"
type AttrOrigin ItemLengthFieldInfo = Item
attrGet = getItemLength
attrSet = setItemLength
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.Item.length"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.25/docs/GI-Pango-Structs-Item.html#g:attr:length"
})
item_length :: AttrLabelProxy "length"
item_length = AttrLabelProxy
#endif
getItemNumChars :: MonadIO m => Item -> m Int32
getItemNumChars :: forall (m :: * -> *). MonadIO m => Item -> m Int32
getItemNumChars Item
s = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ Item -> (Ptr Item -> IO Int32) -> IO Int32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Item
s ((Ptr Item -> IO Int32) -> IO Int32)
-> (Ptr Item -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \Ptr Item
ptr -> do
Int32
val <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek (Ptr Item
ptr Ptr Item -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) :: IO Int32
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
val
setItemNumChars :: MonadIO m => Item -> Int32 -> m ()
setItemNumChars :: forall (m :: * -> *). MonadIO m => Item -> Int32 -> m ()
setItemNumChars Item
s Int32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Item -> (Ptr Item -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Item
s ((Ptr Item -> IO ()) -> IO ()) -> (Ptr Item -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Item
ptr -> do
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Item
ptr Ptr Item -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (Int32
val :: Int32)
#if defined(ENABLE_OVERLOADING)
data ItemNumCharsFieldInfo
instance AttrInfo ItemNumCharsFieldInfo where
type AttrBaseTypeConstraint ItemNumCharsFieldInfo = (~) Item
type AttrAllowedOps ItemNumCharsFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint ItemNumCharsFieldInfo = (~) Int32
type AttrTransferTypeConstraint ItemNumCharsFieldInfo = (~)Int32
type AttrTransferType ItemNumCharsFieldInfo = Int32
type AttrGetType ItemNumCharsFieldInfo = Int32
type AttrLabel ItemNumCharsFieldInfo = "num_chars"
type AttrOrigin ItemNumCharsFieldInfo = Item
attrGet = getItemNumChars
attrSet = setItemNumChars
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.Item.numChars"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.25/docs/GI-Pango-Structs-Item.html#g:attr:numChars"
})
item_numChars :: AttrLabelProxy "numChars"
item_numChars = AttrLabelProxy
#endif
getItemAnalysis :: MonadIO m => Item -> m Pango.Analysis.Analysis
getItemAnalysis :: forall (m :: * -> *). MonadIO m => Item -> m Analysis
getItemAnalysis Item
s = IO Analysis -> m Analysis
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Analysis -> m Analysis) -> IO Analysis -> m Analysis
forall a b. (a -> b) -> a -> b
$ Item -> (Ptr Item -> IO Analysis) -> IO Analysis
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Item
s ((Ptr Item -> IO Analysis) -> IO Analysis)
-> (Ptr Item -> IO Analysis) -> IO Analysis
forall a b. (a -> b) -> a -> b
$ \Ptr Item
ptr -> do
let val :: Ptr Analysis
val = Ptr Item
ptr Ptr Item -> Int -> Ptr Analysis
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: (Ptr Pango.Analysis.Analysis)
Analysis
val' <- ((ManagedPtr Analysis -> Analysis) -> Ptr Analysis -> IO Analysis
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr Analysis -> Analysis
Pango.Analysis.Analysis) Ptr Analysis
val
Analysis -> IO Analysis
forall (m :: * -> *) a. Monad m => a -> m a
return Analysis
val'
#if defined(ENABLE_OVERLOADING)
data ItemAnalysisFieldInfo
instance AttrInfo ItemAnalysisFieldInfo where
type AttrBaseTypeConstraint ItemAnalysisFieldInfo = (~) Item
type AttrAllowedOps ItemAnalysisFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint ItemAnalysisFieldInfo = (~) (Ptr Pango.Analysis.Analysis)
type AttrTransferTypeConstraint ItemAnalysisFieldInfo = (~)(Ptr Pango.Analysis.Analysis)
type AttrTransferType ItemAnalysisFieldInfo = (Ptr Pango.Analysis.Analysis)
type AttrGetType ItemAnalysisFieldInfo = Pango.Analysis.Analysis
type AttrLabel ItemAnalysisFieldInfo = "analysis"
type AttrOrigin ItemAnalysisFieldInfo = Item
attrGet = getItemAnalysis
attrSet = undefined
attrConstruct = undefined
attrClear = undefined
attrTransfer = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.Item.analysis"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.25/docs/GI-Pango-Structs-Item.html#g:attr:analysis"
})
item_analysis :: AttrLabelProxy "analysis"
item_analysis = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Item
type instance O.AttributeList Item = ItemAttributeList
type ItemAttributeList = ('[ '("offset", ItemOffsetFieldInfo), '("length", ItemLengthFieldInfo), '("numChars", ItemNumCharsFieldInfo), '("analysis", ItemAnalysisFieldInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "pango_item_new" pango_item_new ::
IO (Ptr Item)
itemNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Item
itemNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Item
itemNew = IO Item -> m Item
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Item -> m Item) -> IO Item -> m Item
forall a b. (a -> b) -> a -> b
$ do
Ptr Item
result <- IO (Ptr Item)
pango_item_new
Text -> Ptr Item -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"itemNew" Ptr Item
result
Item
result' <- ((ManagedPtr Item -> Item) -> Ptr Item -> IO Item
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Item -> Item
Item) Ptr Item
result
Item -> IO Item
forall (m :: * -> *) a. Monad m => a -> m a
return Item
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "pango_item_apply_attrs" pango_item_apply_attrs ::
Ptr Item ->
Ptr Pango.AttrIterator.AttrIterator ->
IO ()
itemApplyAttrs ::
(B.CallStack.HasCallStack, MonadIO m) =>
Item
-> Pango.AttrIterator.AttrIterator
-> m ()
itemApplyAttrs :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Item -> AttrIterator -> m ()
itemApplyAttrs Item
item AttrIterator
iter = 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 Item
item' <- Item -> IO (Ptr Item)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Item
item
Ptr AttrIterator
iter' <- AttrIterator -> IO (Ptr AttrIterator)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr AttrIterator
iter
Ptr Item -> Ptr AttrIterator -> IO ()
pango_item_apply_attrs Ptr Item
item' Ptr AttrIterator
iter'
Item -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Item
item
AttrIterator -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr AttrIterator
iter
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data ItemApplyAttrsMethodInfo
instance (signature ~ (Pango.AttrIterator.AttrIterator -> m ()), MonadIO m) => O.OverloadedMethod ItemApplyAttrsMethodInfo Item signature where
overloadedMethod = itemApplyAttrs
instance O.OverloadedMethodInfo ItemApplyAttrsMethodInfo Item where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.Item.itemApplyAttrs",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.25/docs/GI-Pango-Structs-Item.html#v:itemApplyAttrs"
})
#endif
foreign import ccall "pango_item_copy" pango_item_copy ::
Ptr Item ->
IO (Ptr Item)
itemCopy ::
(B.CallStack.HasCallStack, MonadIO m) =>
Item
-> m (Maybe Item)
itemCopy :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Item -> m (Maybe Item)
itemCopy Item
item = IO (Maybe Item) -> m (Maybe Item)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Item) -> m (Maybe Item))
-> IO (Maybe Item) -> m (Maybe Item)
forall a b. (a -> b) -> a -> b
$ do
Ptr Item
item' <- Item -> IO (Ptr Item)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Item
item
Ptr Item
result <- Ptr Item -> IO (Ptr Item)
pango_item_copy Ptr Item
item'
Maybe Item
maybeResult <- Ptr Item -> (Ptr Item -> IO Item) -> IO (Maybe Item)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Item
result ((Ptr Item -> IO Item) -> IO (Maybe Item))
-> (Ptr Item -> IO Item) -> IO (Maybe Item)
forall a b. (a -> b) -> a -> b
$ \Ptr Item
result' -> do
Item
result'' <- ((ManagedPtr Item -> Item) -> Ptr Item -> IO Item
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Item -> Item
Item) Ptr Item
result'
Item -> IO Item
forall (m :: * -> *) a. Monad m => a -> m a
return Item
result''
Item -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Item
item
Maybe Item -> IO (Maybe Item)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Item
maybeResult
#if defined(ENABLE_OVERLOADING)
data ItemCopyMethodInfo
instance (signature ~ (m (Maybe Item)), MonadIO m) => O.OverloadedMethod ItemCopyMethodInfo Item signature where
overloadedMethod = itemCopy
instance O.OverloadedMethodInfo ItemCopyMethodInfo Item where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.Item.itemCopy",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.25/docs/GI-Pango-Structs-Item.html#v:itemCopy"
})
#endif
foreign import ccall "pango_item_free" pango_item_free ::
Ptr Item ->
IO ()
itemFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
Item
-> m ()
itemFree :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Item -> m ()
itemFree Item
item = 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 Item
item' <- Item -> IO (Ptr Item)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Item
item
Ptr Item -> IO ()
pango_item_free Ptr Item
item'
Item -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Item
item
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data ItemFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod ItemFreeMethodInfo Item signature where
overloadedMethod = itemFree
instance O.OverloadedMethodInfo ItemFreeMethodInfo Item where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.Item.itemFree",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.25/docs/GI-Pango-Structs-Item.html#v:itemFree"
})
#endif
foreign import ccall "pango_item_split" pango_item_split ::
Ptr Item ->
Int32 ->
Int32 ->
IO (Ptr Item)
itemSplit ::
(B.CallStack.HasCallStack, MonadIO m) =>
Item
-> Int32
-> Int32
-> m Item
itemSplit :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Item -> Int32 -> Int32 -> m Item
itemSplit Item
orig Int32
splitIndex Int32
splitOffset = IO Item -> m Item
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Item -> m Item) -> IO Item -> m Item
forall a b. (a -> b) -> a -> b
$ do
Ptr Item
orig' <- Item -> IO (Ptr Item)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Item
orig
Ptr Item
result <- Ptr Item -> Int32 -> Int32 -> IO (Ptr Item)
pango_item_split Ptr Item
orig' Int32
splitIndex Int32
splitOffset
Text -> Ptr Item -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"itemSplit" Ptr Item
result
Item
result' <- ((ManagedPtr Item -> Item) -> Ptr Item -> IO Item
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Item -> Item
Item) Ptr Item
result
Item -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Item
orig
Item -> IO Item
forall (m :: * -> *) a. Monad m => a -> m a
return Item
result'
#if defined(ENABLE_OVERLOADING)
data ItemSplitMethodInfo
instance (signature ~ (Int32 -> Int32 -> m Item), MonadIO m) => O.OverloadedMethod ItemSplitMethodInfo Item signature where
overloadedMethod = itemSplit
instance O.OverloadedMethodInfo ItemSplitMethodInfo Item where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.Item.itemSplit",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.25/docs/GI-Pango-Structs-Item.html#v:itemSplit"
})
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveItemMethod (t :: Symbol) (o :: *) :: * where
ResolveItemMethod "applyAttrs" o = ItemApplyAttrsMethodInfo
ResolveItemMethod "copy" o = ItemCopyMethodInfo
ResolveItemMethod "free" o = ItemFreeMethodInfo
ResolveItemMethod "split" o = ItemSplitMethodInfo
ResolveItemMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveItemMethod t Item, O.OverloadedMethod info Item p) => OL.IsLabel t (Item -> 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 ~ ResolveItemMethod t Item, O.OverloadedMethod info Item p, R.HasField t Item p) => R.HasField t Item p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveItemMethod t Item, O.OverloadedMethodInfo info Item) => OL.IsLabel t (O.MethodProxy info Item) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif