glib-0.12.5.0: Binding to the GLIB library for Gtk2Hs.

Maintainergtk2hs-users@lists.sourceforge.net
Stabilityprovisional
Portabilityportable (depends on GHC)
Safe HaskellNone
LanguageHaskell98

System.Glib.UTFString

Description

This module adds CString-like functions that handle UTF8 strings.

Synopsis

Documentation

withUTFString :: String -> (CString -> IO a) -> IO a Source

Like withCString but using the UTF-8 encoding.

withUTFStringLen :: String -> (CStringLen -> IO a) -> IO a Source

Like withCStringLen but using the UTF-8 encoding.

newUTFString :: String -> IO CString Source

Like newCString but using the UTF-8 encoding.

newUTFStringLen :: String -> IO CStringLen Source

Like Define newUTFStringLen to emit UTF-8.

peekUTFString :: CString -> IO String Source

Like peekCString but using the UTF-8 encoding.

peekUTFStringLen :: CStringLen -> IO String Source

Like peekCStringLen but using the UTF-8 encoding.

maybePeekUTFString :: CString -> IO (Maybe String) Source

Like maybePeek peekCString but using the UTF-8 encoding to retrieve UTF-8 from a CString which may be the nullPtr.

readUTFString :: CString -> IO String Source

Like like peekUTFString but then frees the string using g_free

readCString :: CString -> IO String Source

Like peekCString but then frees the string using g_free.

withUTFStrings :: [String] -> ([CString] -> IO a) -> IO a Source

Temporarily allocate a list of UTF-8 CStrings.

withUTFStringArray :: [String] -> (Ptr CString -> IO a) -> IO a Source

Temporarily allocate an array of UTF-8 encoded CStrings.

withUTFStringArray0 :: [String] -> (Ptr CString -> IO a) -> IO a Source

Temporarily allocate a null-terminated array of UTF-8 encoded CStrings.

peekUTFStringArray :: Int -> Ptr CString -> IO [String] Source

Convert an array (of the given length) of UTF-8 encoded CStrings to a list of Haskell Strings.

peekUTFStringArray0 :: Ptr CString -> IO [String] Source

Convert a null-terminated array of UTF-8 encoded CStrings to a list of Haskell Strings.

readUTFStringArray0 :: Ptr CString -> IO [String] Source

Like peekUTFStringArray0 but then free the string array including all strings.

To be used when functions indicate that their return value should be freed with g_strfreev.

data UTFCorrection Source

Offset correction for String to UTF8 mapping.

Instances

genUTFOfs :: String -> UTFCorrection Source

Create a list of offset corrections.