Portability | portable (depends on GHC) |
---|---|
Stability | provisional |
Maintainer | gtk2hs-users@lists.sourceforge.net |
Safe Haskell | None |
This module adds CString-like functions that handle UTF8 strings.
- withUTFString :: String -> (CString -> IO a) -> IO a
- withUTFStringLen :: String -> (CStringLen -> IO a) -> IO a
- newUTFString :: String -> IO CString
- newUTFStringLen :: String -> IO CStringLen
- peekUTFString :: CString -> IO String
- peekUTFStringLen :: CStringLen -> IO String
- maybePeekUTFString :: CString -> IO (Maybe String)
- readUTFString :: CString -> IO String
- readCString :: CString -> IO String
- withUTFStrings :: [String] -> ([CString] -> IO a) -> IO a
- withUTFStringArray :: [String] -> (Ptr CString -> IO a) -> IO a
- withUTFStringArray0 :: [String] -> (Ptr CString -> IO a) -> IO a
- peekUTFStringArray :: Int -> Ptr CString -> IO [String]
- peekUTFStringArray0 :: Ptr CString -> IO [String]
- readUTFStringArray0 :: Ptr CString -> IO [String]
- data UTFCorrection
- genUTFOfs :: String -> UTFCorrection
- ofsToUTF :: Int -> UTFCorrection -> Int
- ofsFromUTF :: Int -> UTFCorrection -> Int
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 CString
s.
withUTFStringArray :: [String] -> (Ptr CString -> IO a) -> IO aSource
Temporarily allocate an array of UTF-8 encoded CString
s.
withUTFStringArray0 :: [String] -> (Ptr CString -> IO a) -> IO aSource
Temporarily allocate a null-terminated array of UTF-8 encoded CString
s.
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
.
genUTFOfs :: String -> UTFCorrectionSource
Create a list of offset corrections.
ofsToUTF :: Int -> UTFCorrection -> IntSource
ofsFromUTF :: Int -> UTFCorrection -> IntSource