{- |
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.DOMDOMTokenList
    ( 

-- * Exported types
    DOMDOMTokenList(..)                     ,
    IsDOMDOMTokenList                       ,
    toDOMDOMTokenList                       ,
    noDOMDOMTokenList                       ,


 -- * Methods
-- ** add #method:add#
    DOMDOMTokenListAddMethodInfo            ,
    dOMDOMTokenListAdd                      ,


-- ** contains #method:contains#
    DOMDOMTokenListContainsMethodInfo       ,
    dOMDOMTokenListContains                 ,


-- ** getLength #method:getLength#
    DOMDOMTokenListGetLengthMethodInfo      ,
    dOMDOMTokenListGetLength                ,


-- ** item #method:item#
    DOMDOMTokenListItemMethodInfo           ,
    dOMDOMTokenListItem                     ,


-- ** remove #method:remove#
    DOMDOMTokenListRemoveMethodInfo         ,
    dOMDOMTokenListRemove                   ,


-- ** toggle #method:toggle#
    DOMDOMTokenListToggleMethodInfo         ,
    dOMDOMTokenListToggle                   ,




 -- * Properties
-- ** length #attr:length#
    DOMDOMTokenListLengthPropertyInfo       ,
    dOMDOMTokenListLength                   ,
    getDOMDOMTokenListLength                ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.WebKit.Objects.DOMObject as WebKit.DOMObject

newtype DOMDOMTokenList = DOMDOMTokenList (ManagedPtr DOMDOMTokenList)
foreign import ccall "webkit_dom_dom_token_list_get_type"
    c_webkit_dom_dom_token_list_get_type :: IO GType

instance GObject DOMDOMTokenList where
    gobjectType _ = c_webkit_dom_dom_token_list_get_type
    

class GObject o => IsDOMDOMTokenList o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError DOMDOMTokenList a) =>
    IsDOMDOMTokenList a
#endif
instance IsDOMDOMTokenList DOMDOMTokenList
instance WebKit.DOMObject.IsDOMObject DOMDOMTokenList
instance GObject.Object.IsObject DOMDOMTokenList

toDOMDOMTokenList :: IsDOMDOMTokenList o => o -> IO DOMDOMTokenList
toDOMDOMTokenList = unsafeCastTo DOMDOMTokenList

noDOMDOMTokenList :: Maybe DOMDOMTokenList
noDOMDOMTokenList = Nothing

type family ResolveDOMDOMTokenListMethod (t :: Symbol) (o :: *) :: * where
    ResolveDOMDOMTokenListMethod "add" o = DOMDOMTokenListAddMethodInfo
    ResolveDOMDOMTokenListMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDOMDOMTokenListMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDOMDOMTokenListMethod "contains" o = DOMDOMTokenListContainsMethodInfo
    ResolveDOMDOMTokenListMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDOMDOMTokenListMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDOMDOMTokenListMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDOMDOMTokenListMethod "item" o = DOMDOMTokenListItemMethodInfo
    ResolveDOMDOMTokenListMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDOMDOMTokenListMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDOMDOMTokenListMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDOMDOMTokenListMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDOMDOMTokenListMethod "remove" o = DOMDOMTokenListRemoveMethodInfo
    ResolveDOMDOMTokenListMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveDOMDOMTokenListMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveDOMDOMTokenListMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDOMDOMTokenListMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDOMDOMTokenListMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDOMDOMTokenListMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDOMDOMTokenListMethod "toggle" o = DOMDOMTokenListToggleMethodInfo
    ResolveDOMDOMTokenListMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDOMDOMTokenListMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDOMDOMTokenListMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDOMDOMTokenListMethod "getLength" o = DOMDOMTokenListGetLengthMethodInfo
    ResolveDOMDOMTokenListMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDOMDOMTokenListMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDOMDOMTokenListMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDOMDOMTokenListMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDOMDOMTokenListMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveDOMDOMTokenListMethod t DOMDOMTokenList, O.MethodInfo info DOMDOMTokenList p) => O.IsLabelProxy t (DOMDOMTokenList -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveDOMDOMTokenListMethod t DOMDOMTokenList, O.MethodInfo info DOMDOMTokenList p) => O.IsLabel t (DOMDOMTokenList -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

-- VVV Prop "length"
   -- Type: TBasicType TULong
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

getDOMDOMTokenListLength :: (MonadIO m, IsDOMDOMTokenList o) => o -> m CULong
getDOMDOMTokenListLength obj = liftIO $ getObjectPropertyULong obj "length"

data DOMDOMTokenListLengthPropertyInfo
instance AttrInfo DOMDOMTokenListLengthPropertyInfo where
    type AttrAllowedOps DOMDOMTokenListLengthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMDOMTokenListLengthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMDOMTokenListLengthPropertyInfo = IsDOMDOMTokenList
    type AttrGetType DOMDOMTokenListLengthPropertyInfo = CULong
    type AttrLabel DOMDOMTokenListLengthPropertyInfo = "length"
    type AttrOrigin DOMDOMTokenListLengthPropertyInfo = DOMDOMTokenList
    attrGet _ = getDOMDOMTokenListLength
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

instance O.HasAttributeList DOMDOMTokenList
type instance O.AttributeList DOMDOMTokenList = DOMDOMTokenListAttributeList
type DOMDOMTokenListAttributeList = ('[ '("coreObject", WebKit.DOMObject.DOMObjectCoreObjectPropertyInfo), '("length", DOMDOMTokenListLengthPropertyInfo)] :: [(Symbol, *)])

dOMDOMTokenListLength :: AttrLabelProxy "length"
dOMDOMTokenListLength = AttrLabelProxy

type instance O.SignalList DOMDOMTokenList = DOMDOMTokenListSignalList
type DOMDOMTokenListSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method DOMDOMTokenList::add
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit", name = "DOMDOMTokenList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMDOMTokenList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tokens", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #gchar", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : True
-- Skip return : False

foreign import ccall "webkit_dom_dom_token_list_add" webkit_dom_dom_token_list_add :: 
    Ptr DOMDOMTokenList ->                  -- self : TInterface (Name {namespace = "WebKit", name = "DOMDOMTokenList"})
    CString ->                              -- tokens : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO ()

{- |
/No description available in the introspection data./
-}
dOMDOMTokenListAdd ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMDOMTokenList a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMDOMTokenList.DOMDOMTokenList' -}
    -> T.Text
    {- ^ /@tokens@/: A @/gchar/@ -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
dOMDOMTokenListAdd self tokens = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    tokens' <- textToCString tokens
    onException (do
        propagateGError $ webkit_dom_dom_token_list_add self' tokens'
        touchManagedPtr self
        freeMem tokens'
        return ()
     ) (do
        freeMem tokens'
     )

data DOMDOMTokenListAddMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsDOMDOMTokenList a) => O.MethodInfo DOMDOMTokenListAddMethodInfo a signature where
    overloadedMethod _ = dOMDOMTokenListAdd

-- method DOMDOMTokenList::contains
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit", name = "DOMDOMTokenList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMDOMTokenList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "token", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #gchar", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "webkit_dom_dom_token_list_contains" webkit_dom_dom_token_list_contains :: 
    Ptr DOMDOMTokenList ->                  -- self : TInterface (Name {namespace = "WebKit", name = "DOMDOMTokenList"})
    CString ->                              -- token : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
/No description available in the introspection data./
-}
dOMDOMTokenListContains ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMDOMTokenList a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMDOMTokenList.DOMDOMTokenList' -}
    -> T.Text
    {- ^ /@token@/: A @/gchar/@ -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
dOMDOMTokenListContains self token = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    token' <- textToCString token
    onException (do
        _ <- propagateGError $ webkit_dom_dom_token_list_contains self' token'
        touchManagedPtr self
        freeMem token'
        return ()
     ) (do
        freeMem token'
     )

data DOMDOMTokenListContainsMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsDOMDOMTokenList a) => O.MethodInfo DOMDOMTokenListContainsMethodInfo a signature where
    overloadedMethod _ = dOMDOMTokenListContains

-- method DOMDOMTokenList::get_length
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit", name = "DOMDOMTokenList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMDOMTokenList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TULong)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_dom_token_list_get_length" webkit_dom_dom_token_list_get_length :: 
    Ptr DOMDOMTokenList ->                  -- self : TInterface (Name {namespace = "WebKit", name = "DOMDOMTokenList"})
    IO CULong

{- |
/No description available in the introspection data./
-}
dOMDOMTokenListGetLength ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMDOMTokenList a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMDOMTokenList.DOMDOMTokenList' -}
    -> m CULong
    {- ^ __Returns:__ A @/gulong/@ -}
dOMDOMTokenListGetLength self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_dom_token_list_get_length self'
    touchManagedPtr self
    return result

data DOMDOMTokenListGetLengthMethodInfo
instance (signature ~ (m CULong), MonadIO m, IsDOMDOMTokenList a) => O.MethodInfo DOMDOMTokenListGetLengthMethodInfo a signature where
    overloadedMethod _ = dOMDOMTokenListGetLength

-- method DOMDOMTokenList::item
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit", name = "DOMDOMTokenList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMDOMTokenList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index", argType = TBasicType TULong, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #gulong", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_dom_token_list_item" webkit_dom_dom_token_list_item :: 
    Ptr DOMDOMTokenList ->                  -- self : TInterface (Name {namespace = "WebKit", name = "DOMDOMTokenList"})
    CULong ->                               -- index : TBasicType TULong
    IO CString

{- |
/No description available in the introspection data./
-}
dOMDOMTokenListItem ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMDOMTokenList a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMDOMTokenList.DOMDOMTokenList' -}
    -> CULong
    {- ^ /@index@/: A @/gulong/@ -}
    -> m T.Text
    {- ^ __Returns:__ A @/gchar/@ -}
dOMDOMTokenListItem self index = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_dom_token_list_item self' index
    checkUnexpectedReturnNULL "dOMDOMTokenListItem" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr self
    return result'

data DOMDOMTokenListItemMethodInfo
instance (signature ~ (CULong -> m T.Text), MonadIO m, IsDOMDOMTokenList a) => O.MethodInfo DOMDOMTokenListItemMethodInfo a signature where
    overloadedMethod _ = dOMDOMTokenListItem

-- method DOMDOMTokenList::remove
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit", name = "DOMDOMTokenList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMDOMTokenList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tokens", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #gchar", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : True
-- Skip return : False

foreign import ccall "webkit_dom_dom_token_list_remove" webkit_dom_dom_token_list_remove :: 
    Ptr DOMDOMTokenList ->                  -- self : TInterface (Name {namespace = "WebKit", name = "DOMDOMTokenList"})
    CString ->                              -- tokens : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO ()

{- |
/No description available in the introspection data./
-}
dOMDOMTokenListRemove ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMDOMTokenList a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMDOMTokenList.DOMDOMTokenList' -}
    -> T.Text
    {- ^ /@tokens@/: A @/gchar/@ -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
dOMDOMTokenListRemove self tokens = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    tokens' <- textToCString tokens
    onException (do
        propagateGError $ webkit_dom_dom_token_list_remove self' tokens'
        touchManagedPtr self
        freeMem tokens'
        return ()
     ) (do
        freeMem tokens'
     )

data DOMDOMTokenListRemoveMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsDOMDOMTokenList a) => O.MethodInfo DOMDOMTokenListRemoveMethodInfo a signature where
    overloadedMethod _ = dOMDOMTokenListRemove

-- method DOMDOMTokenList::toggle
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit", name = "DOMDOMTokenList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMDOMTokenList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "token", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #gchar", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "force", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #gboolean", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "webkit_dom_dom_token_list_toggle" webkit_dom_dom_token_list_toggle :: 
    Ptr DOMDOMTokenList ->                  -- self : TInterface (Name {namespace = "WebKit", name = "DOMDOMTokenList"})
    CString ->                              -- token : TBasicType TUTF8
    CInt ->                                 -- force : TBasicType TBoolean
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
/No description available in the introspection data./
-}
dOMDOMTokenListToggle ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMDOMTokenList a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMDOMTokenList.DOMDOMTokenList' -}
    -> T.Text
    {- ^ /@token@/: A @/gchar/@ -}
    -> Bool
    {- ^ /@force@/: A 'Bool' -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
dOMDOMTokenListToggle self token force = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    token' <- textToCString token
    let force' = (fromIntegral . fromEnum) force
    onException (do
        _ <- propagateGError $ webkit_dom_dom_token_list_toggle self' token' force'
        touchManagedPtr self
        freeMem token'
        return ()
     ) (do
        freeMem token'
     )

data DOMDOMTokenListToggleMethodInfo
instance (signature ~ (T.Text -> Bool -> m ()), MonadIO m, IsDOMDOMTokenList a) => O.MethodInfo DOMDOMTokenListToggleMethodInfo a signature where
    overloadedMethod _ = dOMDOMTokenListToggle