-- GENERATED by C->Haskell Compiler, version 0.13.12 (gtk2hs branch) "Bin IO", 27 May 2012 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "./Graphics/UI/Gtk/WebKit/DOM/Storage.chs" #-}
module Graphics.UI.Gtk.WebKit.DOM.Storage
       (storageKey, storageGetItem, storageSetItem, storageRemoveItem,
        storageClear, storageGetLength, Storage, StorageClass,
        castToStorage, gTypeStorage, toStorage)
       where
import System.Glib.FFI
import System.Glib.UTFString
import Control.Applicative
import Graphics.UI.Gtk.WebKit.Types
{-# LINE 9 "./Graphics/UI/Gtk/WebKit/DOM/Storage.chs" #-}
import System.Glib.GError
import Graphics.UI.Gtk.WebKit.DOM.EventM


storageKey ::
           (StorageClass self, GlibString string) => self -> Word -> IO string
storageKey self index = propagateGError $ \errorPtr ->
    ((\(Storage arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_storage_key argPtr1 arg2 arg3) (toStorage self) (fromIntegral index) errorPtr >>= readUTFString)


storageGetItem ::
               (StorageClass self, GlibString string) =>
                 self -> string -> IO string
storageGetItem self key = propagateGError $ \errorPtr -> (
  (withUTFString key $ \keyPtr ->
    (\(Storage arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_storage_get_item argPtr1 arg2 arg3) (toStorage self) keyPtr errorPtr)
  >>= readUTFString)


storageSetItem :: (StorageClass self, GlibString string) => self -> string -> string -> IO ()
storageSetItem self key data'
  = propagateGError $
      \ errorPtr_ ->
        withUTFString data' $
          \ dataPtr ->
            withUTFString key $
              \ keyPtr ->
                (\(Storage arg1) arg2 arg3 arg4 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_storage_set_item argPtr1 arg2 arg3 arg4) (toStorage self) keyPtr
              dataPtr
          errorPtr_


storageRemoveItem ::
                  (StorageClass self, GlibString string) => self -> string -> IO ()
storageRemoveItem self key = propagateGError $ \errorPtr -> (
  withUTFString key $ \keyPtr ->
    (\(Storage arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_storage_remove_item argPtr1 arg2 arg3) (toStorage self) keyPtr errorPtr)


storageClear :: (StorageClass self) => self -> IO ()
storageClear self = propagateGError $ (\(Storage arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_storage_clear argPtr1 arg2) (toStorage self)


storageGetLength :: (StorageClass self) => self -> IO Word
storageGetLength self = fromIntegral <$> propagateGError ((\(Storage arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_storage_get_length argPtr1 arg2) (toStorage self))

foreign import ccall safe "dist/build/Graphics/UI/Gtk/WebKit/DOM/Storage.h webkit_dom_storage_key"
  webkit_dom_storage_key :: ((Ptr Storage) -> (CULong -> ((Ptr (Ptr ())) -> (IO (Ptr CChar)))))

foreign import ccall safe "dist/build/Graphics/UI/Gtk/WebKit/DOM/Storage.h webkit_dom_storage_get_item"
  webkit_dom_storage_get_item :: ((Ptr Storage) -> ((Ptr CChar) -> ((Ptr (Ptr ())) -> (IO (Ptr CChar)))))

foreign import ccall safe "dist/build/Graphics/UI/Gtk/WebKit/DOM/Storage.h webkit_dom_storage_set_item"
  webkit_dom_storage_set_item :: ((Ptr Storage) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr (Ptr ())) -> (IO ())))))

foreign import ccall safe "dist/build/Graphics/UI/Gtk/WebKit/DOM/Storage.h webkit_dom_storage_remove_item"
  webkit_dom_storage_remove_item :: ((Ptr Storage) -> ((Ptr CChar) -> ((Ptr (Ptr ())) -> (IO ()))))

foreign import ccall safe "dist/build/Graphics/UI/Gtk/WebKit/DOM/Storage.h webkit_dom_storage_clear"
  webkit_dom_storage_clear :: ((Ptr Storage) -> ((Ptr (Ptr ())) -> (IO ())))

foreign import ccall safe "dist/build/Graphics/UI/Gtk/WebKit/DOM/Storage.h webkit_dom_storage_get_length"
  webkit_dom_storage_get_length :: ((Ptr Storage) -> ((Ptr (Ptr ())) -> (IO CULong)))