{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.WebKit2WebExtension.Interfaces.DOMXPathNSResolver
    ( 

-- * Exported types
    DOMXPathNSResolver(..)                  ,
    noDOMXPathNSResolver                    ,
    DOMXPathNSResolverK                     ,
    toDOMXPathNSResolver                    ,


 -- * Methods
-- ** dOMXPathNSResolverLookupNamespaceUri
    dOMXPathNSResolverLookupNamespaceUri    ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.WebKit2WebExtension.Types
import GI.WebKit2WebExtension.Callbacks
import qualified GI.GObject as GObject

-- interface DOMXPathNSResolver 

newtype DOMXPathNSResolver = DOMXPathNSResolver (ForeignPtr DOMXPathNSResolver)
noDOMXPathNSResolver :: Maybe DOMXPathNSResolver
noDOMXPathNSResolver = Nothing

type instance AttributeList DOMXPathNSResolver = DOMXPathNSResolverAttributeList
type DOMXPathNSResolverAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList DOMXPathNSResolver = DOMXPathNSResolverSignalList
type DOMXPathNSResolverSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

foreign import ccall "webkit_dom_xpath_ns_resolver_get_type"
    c_webkit_dom_xpath_ns_resolver_get_type :: IO GType

type instance ParentTypes DOMXPathNSResolver = DOMXPathNSResolverParentTypes
type DOMXPathNSResolverParentTypes = '[GObject.Object]

instance GObject DOMXPathNSResolver where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_dom_xpath_ns_resolver_get_type
    

class GObject o => DOMXPathNSResolverK o
instance (GObject o, IsDescendantOf DOMXPathNSResolver o) => DOMXPathNSResolverK o

toDOMXPathNSResolver :: DOMXPathNSResolverK o => o -> IO DOMXPathNSResolver
toDOMXPathNSResolver = unsafeCastTo DOMXPathNSResolver

-- method DOMXPathNSResolver::lookup_namespace_uri
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "DOMXPathNSResolver", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "prefix", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "DOMXPathNSResolver", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "prefix", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_xpath_ns_resolver_lookup_namespace_uri" webkit_dom_xpath_ns_resolver_lookup_namespace_uri :: 
    Ptr DOMXPathNSResolver ->               -- _obj : TInterface "WebKit2WebExtension" "DOMXPathNSResolver"
    CString ->                              -- prefix : TBasicType TUTF8
    IO CString


dOMXPathNSResolverLookupNamespaceUri ::
    (MonadIO m, DOMXPathNSResolverK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- prefix
    m T.Text
dOMXPathNSResolverLookupNamespaceUri _obj prefix = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    prefix' <- textToCString prefix
    result <- webkit_dom_xpath_ns_resolver_lookup_namespace_uri _obj' prefix'
    checkUnexpectedReturnNULL "webkit_dom_xpath_ns_resolver_lookup_namespace_uri" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    freeMem prefix'
    return result'