-- 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/XPathResult.chs" #-}
module Graphics.UI.Gtk.WebKit.DOM.XPathResult(
iterateNext,
snapshotItem,
pattern ANY_TYPE,
pattern NUMBER_TYPE,
pattern STRING_TYPE,
pattern BOOLEAN_TYPE,
pattern UNORDERED_NODE_ITERATOR_TYPE,
pattern ORDERED_NODE_ITERATOR_TYPE,
pattern UNORDERED_NODE_SNAPSHOT_TYPE,
pattern ORDERED_NODE_SNAPSHOT_TYPE,
pattern ANY_UNORDERED_NODE_TYPE,
pattern FIRST_ORDERED_NODE_TYPE,
getResultType,
getNumberValue,
getStringValue,
getBooleanValue,
getSingleNodeValue,
getInvalidIteratorState,
getSnapshotLength,
XPathResult,
castToXPathResult,
gTypeXPathResult,
XPathResultClass,
toXPathResult,
) 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 38 "./Graphics/UI/Gtk/WebKit/DOM/XPathResult.chs" #-}
import Graphics.UI.Gtk.WebKit.DOM.Enums

 
iterateNext ::
            (MonadIO m, XPathResultClass self) => self -> m (Maybe Node)
iterateNext self
  = liftIO
      (maybeNull (makeNewGObject mkNode)
         (propagateGError $
            \ errorPtr_ ->
              (\(XPathResult arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_xpath_result_iterate_next argPtr1 arg2)
{-# LINE 49 "./Graphics/UI/Gtk/WebKit/DOM/XPathResult.chs" #-}
                (toXPathResult self)
                errorPtr_))
 
snapshotItem ::
             (MonadIO m, XPathResultClass self) =>
               self -> Word -> m (Maybe Node)
snapshotItem self index
  = liftIO
      (maybeNull (makeNewGObject mkNode)
         (propagateGError $
            \ errorPtr_ ->
              (\(XPathResult arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_xpath_result_snapshot_item argPtr1 arg2 arg3)
{-# LINE 61 "./Graphics/UI/Gtk/WebKit/DOM/XPathResult.chs" #-}
                (toXPathResult self)
                (fromIntegral index)
                errorPtr_))
pattern ANY_TYPE = 0
pattern NUMBER_TYPE = 1
pattern STRING_TYPE = 2
pattern BOOLEAN_TYPE = 3
pattern UNORDERED_NODE_ITERATOR_TYPE = 4
pattern ORDERED_NODE_ITERATOR_TYPE = 5
pattern UNORDERED_NODE_SNAPSHOT_TYPE = 6
pattern ORDERED_NODE_SNAPSHOT_TYPE = 7
pattern ANY_UNORDERED_NODE_TYPE = 8
pattern FIRST_ORDERED_NODE_TYPE = 9
 
getResultType ::
              (MonadIO m, XPathResultClass self) => self -> m Word
getResultType self
  = liftIO
      (fromIntegral <$>
         ((\(XPathResult arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_xpath_result_get_result_type argPtr1)
{-# LINE 81 "./Graphics/UI/Gtk/WebKit/DOM/XPathResult.chs" #-}
            (toXPathResult self)))
 
getNumberValue ::
               (MonadIO m, XPathResultClass self) => self -> m Double
getNumberValue self
  = liftIO
      (realToFrac <$>
         (propagateGError $
            \ errorPtr_ ->
              (\(XPathResult arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_xpath_result_get_number_value argPtr1 arg2)
{-# LINE 91 "./Graphics/UI/Gtk/WebKit/DOM/XPathResult.chs" #-}
                (toXPathResult self)
                errorPtr_))
 
getStringValue ::
               (MonadIO m, XPathResultClass self, GlibString string) =>
                 self -> m string
getStringValue self
  = liftIO
      ((propagateGError $
          \ errorPtr_ ->
            (\(XPathResult arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_xpath_result_get_string_value argPtr1 arg2)
{-# LINE 102 "./Graphics/UI/Gtk/WebKit/DOM/XPathResult.chs" #-}
              (toXPathResult self)
              errorPtr_)
         >>=
         readUTFString)
 
getBooleanValue ::
                (MonadIO m, XPathResultClass self) => self -> m Bool
getBooleanValue self
  = liftIO
      (toBool <$>
         (propagateGError $
            \ errorPtr_ ->
              (\(XPathResult arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_xpath_result_get_boolean_value argPtr1 arg2)
{-# LINE 115 "./Graphics/UI/Gtk/WebKit/DOM/XPathResult.chs" #-}
                (toXPathResult self)
                errorPtr_))
 
getSingleNodeValue ::
                   (MonadIO m, XPathResultClass self) => self -> m (Maybe Node)
getSingleNodeValue self
  = liftIO
      (maybeNull (makeNewGObject mkNode)
         (propagateGError $
            \ errorPtr_ ->
              (\(XPathResult arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_xpath_result_get_single_node_value argPtr1 arg2)
{-# LINE 126 "./Graphics/UI/Gtk/WebKit/DOM/XPathResult.chs" #-}
                (toXPathResult self)
                errorPtr_))
 
getInvalidIteratorState ::
                        (MonadIO m, XPathResultClass self) => self -> m Bool
getInvalidIteratorState self
  = liftIO
      (toBool <$>
         ((\(XPathResult arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_xpath_result_get_invalid_iterator_state argPtr1)
{-# LINE 135 "./Graphics/UI/Gtk/WebKit/DOM/XPathResult.chs" #-}
            (toXPathResult self)))
 
getSnapshotLength ::
                  (MonadIO m, XPathResultClass self) => self -> m Word
getSnapshotLength self
  = liftIO
      (fromIntegral <$>
         (propagateGError $
            \ errorPtr_ ->
              (\(XPathResult arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_xpath_result_get_snapshot_length argPtr1 arg2)
{-# LINE 145 "./Graphics/UI/Gtk/WebKit/DOM/XPathResult.chs" #-}
                (toXPathResult self)
                errorPtr_))

foreign import ccall safe "webkit_dom_xpath_result_iterate_next"
  webkit_dom_xpath_result_iterate_next :: ((Ptr XPathResult) -> ((Ptr (Ptr ())) -> (IO (Ptr Node))))

foreign import ccall safe "webkit_dom_xpath_result_snapshot_item"
  webkit_dom_xpath_result_snapshot_item :: ((Ptr XPathResult) -> (CULong -> ((Ptr (Ptr ())) -> (IO (Ptr Node)))))

foreign import ccall safe "webkit_dom_xpath_result_get_result_type"
  webkit_dom_xpath_result_get_result_type :: ((Ptr XPathResult) -> (IO CUShort))

foreign import ccall safe "webkit_dom_xpath_result_get_number_value"
  webkit_dom_xpath_result_get_number_value :: ((Ptr XPathResult) -> ((Ptr (Ptr ())) -> (IO CDouble)))

foreign import ccall safe "webkit_dom_xpath_result_get_string_value"
  webkit_dom_xpath_result_get_string_value :: ((Ptr XPathResult) -> ((Ptr (Ptr ())) -> (IO (Ptr CChar))))

foreign import ccall safe "webkit_dom_xpath_result_get_boolean_value"
  webkit_dom_xpath_result_get_boolean_value :: ((Ptr XPathResult) -> ((Ptr (Ptr ())) -> (IO CInt)))

foreign import ccall safe "webkit_dom_xpath_result_get_single_node_value"
  webkit_dom_xpath_result_get_single_node_value :: ((Ptr XPathResult) -> ((Ptr (Ptr ())) -> (IO (Ptr Node))))

foreign import ccall safe "webkit_dom_xpath_result_get_invalid_iterator_state"
  webkit_dom_xpath_result_get_invalid_iterator_state :: ((Ptr XPathResult) -> (IO CInt))

foreign import ccall safe "webkit_dom_xpath_result_get_snapshot_length"
  webkit_dom_xpath_result_get_snapshot_length :: ((Ptr XPathResult) -> ((Ptr (Ptr ())) -> (IO CULong)))