gi-pango-0.1.36.12: GI/Pango/Structs/ScriptIter.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
A #PangoScriptIter is used to iterate through a string
and identify ranges in different scripts.
-}
module GI.Pango.Structs.ScriptIter
(
-- * Exported types
ScriptIter(..) ,
noScriptIter ,
-- * Methods
-- ** scriptIterFree
scriptIterFree ,
-- ** scriptIterGetRange
scriptIterGetRange ,
-- ** scriptIterNext
scriptIterNext ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Pango.Types
import GI.Pango.Callbacks
newtype ScriptIter = ScriptIter (ForeignPtr ScriptIter)
noScriptIter :: Maybe ScriptIter
noScriptIter = Nothing
-- method ScriptIter::free
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "ScriptIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "ScriptIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "pango_script_iter_free" pango_script_iter_free ::
Ptr ScriptIter -> -- _obj : TInterface "Pango" "ScriptIter"
IO ()
scriptIterFree ::
(MonadIO m) =>
ScriptIter -> -- _obj
m ()
scriptIterFree _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
pango_script_iter_free _obj'
touchManagedPtr _obj
return ()
-- method ScriptIter::get_range
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "ScriptIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "start", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "end", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "script", argType = TInterface "Pango" "Script", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "ScriptIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "pango_script_iter_get_range" pango_script_iter_get_range ::
Ptr ScriptIter -> -- _obj : TInterface "Pango" "ScriptIter"
Ptr CString -> -- start : TBasicType TUTF8
Ptr CString -> -- end : TBasicType TUTF8
Ptr CUInt -> -- script : TInterface "Pango" "Script"
IO ()
scriptIterGetRange ::
(MonadIO m) =>
ScriptIter -> -- _obj
m (T.Text,T.Text,Script)
scriptIterGetRange _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
start <- allocMem :: IO (Ptr CString)
end <- allocMem :: IO (Ptr CString)
script <- allocMem :: IO (Ptr CUInt)
pango_script_iter_get_range _obj' start end script
start' <- peek start
start'' <- cstringToText start'
freeMem start'
end' <- peek end
end'' <- cstringToText end'
freeMem end'
script' <- peek script
let script'' = (toEnum . fromIntegral) script'
touchManagedPtr _obj
freeMem start
freeMem end
freeMem script
return (start'', end'', script'')
-- method ScriptIter::next
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "ScriptIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "ScriptIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "pango_script_iter_next" pango_script_iter_next ::
Ptr ScriptIter -> -- _obj : TInterface "Pango" "ScriptIter"
IO CInt
scriptIterNext ::
(MonadIO m) =>
ScriptIter -> -- _obj
m Bool
scriptIterNext _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- pango_script_iter_next _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'