{-# LINE 1 "Data/GI/Base/GQuark.hsc" #-}
-- | Basic support for `GQuark`s.
module Data.GI.Base.GQuark
  ( GQuark(..)
  , gQuarkFromString
  ) where

import Data.Text (Text)
import Data.Word
import Foreign.C (CString)

import Data.GI.Base.BasicConversions (withTextCString)



-- | A `GQuark`, which is simply an integer.
newtype GQuark a = GQuark (Word32)
{-# LINE 17 "Data/GI/Base/GQuark.hsc" #-}

foreign import ccall g_quark_from_string :: CString -> IO (GQuark a)

-- | Construct a GQuark from the given string.
gQuarkFromString :: Text -> IO (GQuark a)
gQuarkFromString :: forall a. Text -> IO (GQuark a)
gQuarkFromString Text
text = Text -> (CString -> IO (GQuark a)) -> IO (GQuark a)
forall a. Text -> (CString -> IO a) -> IO a
withTextCString Text
text CString -> IO (GQuark a)
forall a. CString -> IO (GQuark a)
g_quark_from_string