{- |
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.WebKit.Objects.DOMDOMStringList
    ( 

-- * Exported types
    DOMDOMStringList(..)                    ,
    DOMDOMStringListK                       ,
    toDOMDOMStringList                      ,
    noDOMDOMStringList                      ,


 -- * Methods
-- ** dOMDOMStringListContains
    dOMDOMStringListContains                ,


-- ** dOMDOMStringListGetLength
    dOMDOMStringListGetLength               ,


-- ** dOMDOMStringListItem
    dOMDOMStringListItem                    ,




 -- * Properties
-- ** Length
    DOMDOMStringListLengthPropertyInfo      ,
    getDOMDOMStringListLength               ,




    ) 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.WebKit.Types
import GI.WebKit.Callbacks
import qualified GI.GObject as GObject

newtype DOMDOMStringList = DOMDOMStringList (ForeignPtr DOMDOMStringList)
foreign import ccall "webkit_dom_dom_string_list_get_type"
    c_webkit_dom_dom_string_list_get_type :: IO GType

type instance ParentTypes DOMDOMStringList = DOMDOMStringListParentTypes
type DOMDOMStringListParentTypes = '[DOMObject, GObject.Object]

instance GObject DOMDOMStringList where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_dom_dom_string_list_get_type
    

class GObject o => DOMDOMStringListK o
instance (GObject o, IsDescendantOf DOMDOMStringList o) => DOMDOMStringListK o

toDOMDOMStringList :: DOMDOMStringListK o => o -> IO DOMDOMStringList
toDOMDOMStringList = unsafeCastTo DOMDOMStringList

noDOMDOMStringList :: Maybe DOMDOMStringList
noDOMDOMStringList = Nothing

-- VVV Prop "length"
   -- Type: TBasicType TUInt64
   -- Flags: [PropertyReadable]

getDOMDOMStringListLength :: (MonadIO m, DOMDOMStringListK o) => o -> m Word64
getDOMDOMStringListLength obj = liftIO $ getObjectPropertyUInt64 obj "length"

data DOMDOMStringListLengthPropertyInfo
instance AttrInfo DOMDOMStringListLengthPropertyInfo where
    type AttrAllowedOps DOMDOMStringListLengthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMDOMStringListLengthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMDOMStringListLengthPropertyInfo = DOMDOMStringListK
    type AttrGetType DOMDOMStringListLengthPropertyInfo = Word64
    type AttrLabel DOMDOMStringListLengthPropertyInfo = "DOMDOMStringList::length"
    attrGet _ = getDOMDOMStringListLength
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList DOMDOMStringList = DOMDOMStringListAttributeList
type DOMDOMStringListAttributeList = ('[ '("core-object", DOMObjectCoreObjectPropertyInfo), '("length", DOMDOMStringListLengthPropertyInfo)] :: [(Symbol, *)])

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

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

foreign import ccall "webkit_dom_dom_string_list_contains" webkit_dom_dom_string_list_contains :: 
    Ptr DOMDOMStringList ->                 -- _obj : TInterface "WebKit" "DOMDOMStringList"
    CString ->                              -- string : TBasicType TUTF8
    IO CInt


dOMDOMStringListContains ::
    (MonadIO m, DOMDOMStringListK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- string
    m Bool
dOMDOMStringListContains _obj string = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    string' <- textToCString string
    result <- webkit_dom_dom_string_list_contains _obj' string'
    let result' = (/= 0) result
    touchManagedPtr _obj
    freeMem string'
    return result'

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

foreign import ccall "webkit_dom_dom_string_list_get_length" webkit_dom_dom_string_list_get_length :: 
    Ptr DOMDOMStringList ->                 -- _obj : TInterface "WebKit" "DOMDOMStringList"
    IO Word64


dOMDOMStringListGetLength ::
    (MonadIO m, DOMDOMStringListK a) =>
    a ->                                    -- _obj
    m Word64
dOMDOMStringListGetLength _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_dom_string_list_get_length _obj'
    touchManagedPtr _obj
    return result

-- method DOMDOMStringList::item
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMDOMStringList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMDOMStringList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index", argType = TBasicType TUInt64, 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_dom_string_list_item" webkit_dom_dom_string_list_item :: 
    Ptr DOMDOMStringList ->                 -- _obj : TInterface "WebKit" "DOMDOMStringList"
    Word64 ->                               -- index : TBasicType TUInt64
    IO CString


dOMDOMStringListItem ::
    (MonadIO m, DOMDOMStringListK a) =>
    a ->                                    -- _obj
    Word64 ->                               -- index
    m T.Text
dOMDOMStringListItem _obj index = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_dom_string_list_item _obj' index
    checkUnexpectedReturnNULL "webkit_dom_dom_string_list_item" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'