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


{-# LINE 1 "./Graphics/UI/Gtk/WebKit/DOM/CharacterData.chs" #-}
module Graphics.UI.Gtk.WebKit.DOM.CharacterData(
substringData,
appendData,
insertData,
deleteData,
replaceData,
setData,
getData,
getLength,
CharacterData,
castToCharacterData,
gTypeCharacterData,
CharacterDataClass,
toCharacterData,
) where
import Prelude hiding (drop, error, print)
import Data.Typeable (Typeable)
import Foreign.Marshal (maybePeek, maybeWith)
import System.Glib.FFI (maybeNull, withForeignPtr, nullForeignPtr, Ptr, nullPtr, castPtr, Word, Int64, Word64, CChar(..), CInt(..), CUInt(..), CLong(..), CULong(..), CLLong(..), CULLong(..), CShort(..), CUShort(..), CFloat(..), CDouble(..), toBool, fromBool)
import System.Glib.UTFString (GlibString(..), readUTFString)
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Monad.IO.Class (MonadIO(..))
import System.Glib.GError
import Graphics.UI.Gtk.WebKit.DOM.EventTargetClosures
import Graphics.UI.Gtk.WebKit.DOM.EventM
import Graphics.UI.Gtk.WebKit.Types
{-# LINE 27 "./Graphics/UI/Gtk/WebKit/DOM/CharacterData.chs" #-}
import Graphics.UI.Gtk.WebKit.DOM.Enums

 
substringData ::
              (MonadIO m, CharacterDataClass self, GlibString string) =>
                self -> Word -> Word -> m (Maybe string)
substringData self offset length
  = liftIO
      ((propagateGError $
          \ errorPtr_ ->
            (\(CharacterData arg1) arg2 arg3 arg4 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_character_data_substring_data argPtr1 arg2 arg3 arg4)
{-# LINE 38 "./Graphics/UI/Gtk/WebKit/DOM/CharacterData.chs" #-}
              (toCharacterData self)
              (fromIntegral offset)
              (fromIntegral length)
              errorPtr_)
         >>=
         maybePeek readUTFString)
 
appendData ::
           (MonadIO m, CharacterDataClass self, GlibString string) =>
             self -> string -> m ()
appendData self data'
  = liftIO
      (propagateGError $
         \ errorPtr_ ->
           withUTFString data' $
             \ dataPtr ->
               (\(CharacterData arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_character_data_append_data argPtr1 arg2 arg3)
{-# LINE 55 "./Graphics/UI/Gtk/WebKit/DOM/CharacterData.chs" #-}
                 (toCharacterData self)
                 dataPtr
             errorPtr_)
 
insertData ::
           (MonadIO m, CharacterDataClass self, GlibString string) =>
             self -> Word -> string -> m ()
insertData self offset data'
  = liftIO
      (propagateGError $
         \ errorPtr_ ->
           withUTFString data' $
             \ dataPtr ->
               (\(CharacterData arg1) arg2 arg3 arg4 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_character_data_insert_data argPtr1 arg2 arg3 arg4)
{-# LINE 69 "./Graphics/UI/Gtk/WebKit/DOM/CharacterData.chs" #-}
                 (toCharacterData self)
                 (fromIntegral offset)
                 dataPtr
             errorPtr_)
 
deleteData ::
           (MonadIO m, CharacterDataClass self) =>
             self -> Word -> Word -> m ()
deleteData self offset length
  = liftIO
      (propagateGError $
         \ errorPtr_ ->
           (\(CharacterData arg1) arg2 arg3 arg4 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_character_data_delete_data argPtr1 arg2 arg3 arg4)
{-# LINE 82 "./Graphics/UI/Gtk/WebKit/DOM/CharacterData.chs" #-}
             (toCharacterData self)
             (fromIntegral offset)
             (fromIntegral length)
             errorPtr_)
 
replaceData ::
            (MonadIO m, CharacterDataClass self, GlibString string) =>
              self -> Word -> Word -> string -> m ()
replaceData self offset length data'
  = liftIO
      (propagateGError $
         \ errorPtr_ ->
           withUTFString data' $
             \ dataPtr ->
               (\(CharacterData arg1) arg2 arg3 arg4 arg5 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_character_data_replace_data argPtr1 arg2 arg3 arg4 arg5)
{-# LINE 97 "./Graphics/UI/Gtk/WebKit/DOM/CharacterData.chs" #-}
                 (toCharacterData self)
                 (fromIntegral offset)
                 (fromIntegral length)
                 dataPtr
             errorPtr_)
 
setData ::
        (MonadIO m, CharacterDataClass self, GlibString string) =>
          self -> (Maybe string) -> m ()
setData self val
  = liftIO
      (propagateGError $
         \ errorPtr_ ->
           maybeWith withUTFString val $
             \ valPtr ->
               (\(CharacterData arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_character_data_set_data argPtr1 arg2 arg3)
{-# LINE 113 "./Graphics/UI/Gtk/WebKit/DOM/CharacterData.chs" #-}
                 (toCharacterData self)
                 valPtr
             errorPtr_)
 
getData ::
        (MonadIO m, CharacterDataClass self, GlibString string) =>
          self -> m (Maybe string)
getData self
  = liftIO
      (((\(CharacterData arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_character_data_get_data argPtr1)
{-# LINE 123 "./Graphics/UI/Gtk/WebKit/DOM/CharacterData.chs" #-}
          (toCharacterData self))
         >>=
         maybePeek readUTFString)
 
getLength :: (MonadIO m, CharacterDataClass self) => self -> m Word
getLength self
  = liftIO
      (fromIntegral <$>
         ((\(CharacterData arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_character_data_get_length argPtr1)
{-# LINE 132 "./Graphics/UI/Gtk/WebKit/DOM/CharacterData.chs" #-}
            (toCharacterData self)))

foreign import ccall safe "webkit_dom_character_data_substring_data"
  webkit_dom_character_data_substring_data :: ((Ptr CharacterData) -> (CULong -> (CULong -> ((Ptr (Ptr ())) -> (IO (Ptr CChar))))))

foreign import ccall safe "webkit_dom_character_data_append_data"
  webkit_dom_character_data_append_data :: ((Ptr CharacterData) -> ((Ptr CChar) -> ((Ptr (Ptr ())) -> (IO ()))))

foreign import ccall safe "webkit_dom_character_data_insert_data"
  webkit_dom_character_data_insert_data :: ((Ptr CharacterData) -> (CULong -> ((Ptr CChar) -> ((Ptr (Ptr ())) -> (IO ())))))

foreign import ccall safe "webkit_dom_character_data_delete_data"
  webkit_dom_character_data_delete_data :: ((Ptr CharacterData) -> (CULong -> (CULong -> ((Ptr (Ptr ())) -> (IO ())))))

foreign import ccall safe "webkit_dom_character_data_replace_data"
  webkit_dom_character_data_replace_data :: ((Ptr CharacterData) -> (CULong -> (CULong -> ((Ptr CChar) -> ((Ptr (Ptr ())) -> (IO ()))))))

foreign import ccall safe "webkit_dom_character_data_set_data"
  webkit_dom_character_data_set_data :: ((Ptr CharacterData) -> ((Ptr CChar) -> ((Ptr (Ptr ())) -> (IO ()))))

foreign import ccall safe "webkit_dom_character_data_get_data"
  webkit_dom_character_data_get_data :: ((Ptr CharacterData) -> (IO (Ptr CChar)))

foreign import ccall safe "webkit_dom_character_data_get_length"
  webkit_dom_character_data_get_length :: ((Ptr CharacterData) -> (IO CULong))