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

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

System.Glib.UTFString

Description

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

Synopsis

Documentation

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

Like withCString but using the UTF-8 encoding.

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

Like withCStringLen but using the UTF-8 encoding.

newUTFString :: String -> IO CStringSource

Like newCString but using the UTF-8 encoding.

newUTFStringLen :: String -> IO CStringLenSource

Like Define newUTFStringLen to emit UTF-8.

peekUTFString :: CString -> IO StringSource

Like peekCString but using the UTF-8 encoding.

peekUTFStringLen :: CStringLen -> IO StringSource

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 StringSource

Like like peekUTFString but then frees the string using g_free

readCString :: CString -> IO StringSource

Like peekCString but then frees the string using g_free.

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

Temporarily allocate a list of UTF-8 CStrings.

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

Temporarily allocate an array of UTF-8 encoded CStrings.

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

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 -> UTFCorrectionSource

Create a list of offset corrections.