gi-glib-0.2.44.12: GI/GLib/Structs/StringChunk.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)
An opaque data structure representing String Chunks.
It should only be accessed by using the following functions.
-}
module GI.GLib.Structs.StringChunk
(
-- * Exported types
StringChunk(..) ,
noStringChunk ,
-- * Methods
-- ** stringChunkClear
stringChunkClear ,
-- ** stringChunkFree
stringChunkFree ,
-- ** stringChunkInsert
stringChunkInsert ,
-- ** stringChunkInsertConst
stringChunkInsertConst ,
-- ** stringChunkInsertLen
stringChunkInsertLen ,
) 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.GLib.Types
import GI.GLib.Callbacks
newtype StringChunk = StringChunk (ForeignPtr StringChunk)
noStringChunk :: Maybe StringChunk
noStringChunk = Nothing
-- method StringChunk::clear
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "StringChunk", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "StringChunk", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_string_chunk_clear" g_string_chunk_clear ::
Ptr StringChunk -> -- _obj : TInterface "GLib" "StringChunk"
IO ()
stringChunkClear ::
(MonadIO m) =>
StringChunk -> -- _obj
m ()
stringChunkClear _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_string_chunk_clear _obj'
touchManagedPtr _obj
return ()
-- method StringChunk::free
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "StringChunk", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "StringChunk", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_string_chunk_free" g_string_chunk_free ::
Ptr StringChunk -> -- _obj : TInterface "GLib" "StringChunk"
IO ()
stringChunkFree ::
(MonadIO m) =>
StringChunk -> -- _obj
m ()
stringChunkFree _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_string_chunk_free _obj'
touchManagedPtr _obj
return ()
-- method StringChunk::insert
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "StringChunk", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "StringChunk", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False
foreign import ccall "g_string_chunk_insert" g_string_chunk_insert ::
Ptr StringChunk -> -- _obj : TInterface "GLib" "StringChunk"
CString -> -- string : TBasicType TUTF8
IO CString
stringChunkInsert ::
(MonadIO m) =>
StringChunk -> -- _obj
T.Text -> -- string
m T.Text
stringChunkInsert _obj string = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
string' <- textToCString string
result <- g_string_chunk_insert _obj' string'
checkUnexpectedReturnNULL "g_string_chunk_insert" result
result' <- cstringToText result
freeMem result
touchManagedPtr _obj
freeMem string'
return result'
-- method StringChunk::insert_const
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "StringChunk", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "StringChunk", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False
foreign import ccall "g_string_chunk_insert_const" g_string_chunk_insert_const ::
Ptr StringChunk -> -- _obj : TInterface "GLib" "StringChunk"
CString -> -- string : TBasicType TUTF8
IO CString
stringChunkInsertConst ::
(MonadIO m) =>
StringChunk -> -- _obj
T.Text -> -- string
m T.Text
stringChunkInsertConst _obj string = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
string' <- textToCString string
result <- g_string_chunk_insert_const _obj' string'
checkUnexpectedReturnNULL "g_string_chunk_insert_const" result
result' <- cstringToText result
freeMem result
touchManagedPtr _obj
freeMem string'
return result'
-- method StringChunk::insert_len
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "StringChunk", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "StringChunk", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False
foreign import ccall "g_string_chunk_insert_len" g_string_chunk_insert_len ::
Ptr StringChunk -> -- _obj : TInterface "GLib" "StringChunk"
CString -> -- string : TBasicType TUTF8
Int64 -> -- len : TBasicType TInt64
IO CString
stringChunkInsertLen ::
(MonadIO m) =>
StringChunk -> -- _obj
T.Text -> -- string
Int64 -> -- len
m T.Text
stringChunkInsertLen _obj string len = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
string' <- textToCString string
result <- g_string_chunk_insert_len _obj' string' len
checkUnexpectedReturnNULL "g_string_chunk_insert_len" result
result' <- cstringToText result
freeMem result
touchManagedPtr _obj
freeMem string'
return result'