{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.WebKit2WebExtension.Objects.DOMFileList
    ( 

-- * Exported types
    DOMFileList(..)                         ,
    IsDOMFileList                           ,
    toDOMFileList                           ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveDOMFileListMethod                ,
#endif


-- ** getLength #method:getLength#

#if defined(ENABLE_OVERLOADING)
    DOMFileListGetLengthMethodInfo          ,
#endif
    dOMFileListGetLength                    ,


-- ** item #method:item#

#if defined(ENABLE_OVERLOADING)
    DOMFileListItemMethodInfo               ,
#endif
    dOMFileListItem                         ,




 -- * Properties
-- ** length #attr:length#
-- | /No description available in the introspection data./

#if defined(ENABLE_OVERLOADING)
    DOMFileListLengthPropertyInfo           ,
#endif
#if defined(ENABLE_OVERLOADING)
    dOMFileListLength                       ,
#endif
    getDOMFileListLength                    ,




    ) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
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 GHC.OverloadedLabels as OL

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

-- | Memory-managed wrapper type.
newtype DOMFileList = DOMFileList (SP.ManagedPtr DOMFileList)
    deriving (DOMFileList -> DOMFileList -> Bool
(DOMFileList -> DOMFileList -> Bool)
-> (DOMFileList -> DOMFileList -> Bool) -> Eq DOMFileList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DOMFileList -> DOMFileList -> Bool
$c/= :: DOMFileList -> DOMFileList -> Bool
== :: DOMFileList -> DOMFileList -> Bool
$c== :: DOMFileList -> DOMFileList -> Bool
Eq)

instance SP.ManagedPtrNewtype DOMFileList where
    toManagedPtr :: DOMFileList -> ManagedPtr DOMFileList
toManagedPtr (DOMFileList ManagedPtr DOMFileList
p) = ManagedPtr DOMFileList
p

foreign import ccall "webkit_dom_file_list_get_type"
    c_webkit_dom_file_list_get_type :: IO B.Types.GType

instance B.Types.TypedObject DOMFileList where
    glibType :: IO GType
glibType = IO GType
c_webkit_dom_file_list_get_type

instance B.Types.GObject DOMFileList

-- | Convert 'DOMFileList' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue DOMFileList where
    toGValue :: DOMFileList -> IO GValue
toGValue DOMFileList
o = do
        GType
gtype <- IO GType
c_webkit_dom_file_list_get_type
        DOMFileList -> (Ptr DOMFileList -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr DOMFileList
o (GType
-> (GValue -> Ptr DOMFileList -> IO ())
-> Ptr DOMFileList
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr DOMFileList -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO DOMFileList
fromGValue GValue
gv = do
        Ptr DOMFileList
ptr <- GValue -> IO (Ptr DOMFileList)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr DOMFileList)
        (ManagedPtr DOMFileList -> DOMFileList)
-> Ptr DOMFileList -> IO DOMFileList
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr DOMFileList -> DOMFileList
DOMFileList Ptr DOMFileList
ptr
        
    

-- | Type class for types which can be safely cast to `DOMFileList`, for instance with `toDOMFileList`.
class (SP.GObject o, O.IsDescendantOf DOMFileList o) => IsDOMFileList o
instance (SP.GObject o, O.IsDescendantOf DOMFileList o) => IsDOMFileList o

instance O.HasParentTypes DOMFileList
type instance O.ParentTypes DOMFileList = '[WebKit2WebExtension.DOMObject.DOMObject, GObject.Object.Object]

-- | Cast to `DOMFileList`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toDOMFileList :: (MonadIO m, IsDOMFileList o) => o -> m DOMFileList
toDOMFileList :: o -> m DOMFileList
toDOMFileList = IO DOMFileList -> m DOMFileList
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DOMFileList -> m DOMFileList)
-> (o -> IO DOMFileList) -> o -> m DOMFileList
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr DOMFileList -> DOMFileList) -> o -> IO DOMFileList
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr DOMFileList -> DOMFileList
DOMFileList

#if defined(ENABLE_OVERLOADING)
type family ResolveDOMFileListMethod (t :: Symbol) (o :: *) :: * where
    ResolveDOMFileListMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDOMFileListMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDOMFileListMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDOMFileListMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDOMFileListMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveDOMFileListMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDOMFileListMethod "item" o = DOMFileListItemMethodInfo
    ResolveDOMFileListMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDOMFileListMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDOMFileListMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDOMFileListMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDOMFileListMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDOMFileListMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDOMFileListMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDOMFileListMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDOMFileListMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDOMFileListMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDOMFileListMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDOMFileListMethod "getLength" o = DOMFileListGetLengthMethodInfo
    ResolveDOMFileListMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDOMFileListMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDOMFileListMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDOMFileListMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveDOMFileListMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDOMFileListMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveDOMFileListMethod t DOMFileList, O.MethodInfo info DOMFileList p) => OL.IsLabel t (DOMFileList -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif

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

-- | Get the value of the “@length@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' dOMFileList #length
-- @
getDOMFileListLength :: (MonadIO m, IsDOMFileList o) => o -> m CULong
getDOMFileListLength :: o -> m CULong
getDOMFileListLength o
obj = IO CULong -> m CULong
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CULong -> m CULong) -> IO CULong -> m CULong
forall a b. (a -> b) -> a -> b
$ o -> String -> IO CULong
forall a. GObject a => a -> String -> IO CULong
B.Properties.getObjectPropertyULong o
obj String
"length"

#if defined(ENABLE_OVERLOADING)
data DOMFileListLengthPropertyInfo
instance AttrInfo DOMFileListLengthPropertyInfo where
    type AttrAllowedOps DOMFileListLengthPropertyInfo = '[ 'AttrGet]
    type AttrBaseTypeConstraint DOMFileListLengthPropertyInfo = IsDOMFileList
    type AttrSetTypeConstraint DOMFileListLengthPropertyInfo = (~) ()
    type AttrTransferTypeConstraint DOMFileListLengthPropertyInfo = (~) ()
    type AttrTransferType DOMFileListLengthPropertyInfo = ()
    type AttrGetType DOMFileListLengthPropertyInfo = CULong
    type AttrLabel DOMFileListLengthPropertyInfo = "length"
    type AttrOrigin DOMFileListLengthPropertyInfo = DOMFileList
    attrGet = getDOMFileListLength
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList DOMFileList
type instance O.AttributeList DOMFileList = DOMFileListAttributeList
type DOMFileListAttributeList = ('[ '("coreObject", WebKit2WebExtension.DOMObject.DOMObjectCoreObjectPropertyInfo), '("length", DOMFileListLengthPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
dOMFileListLength :: AttrLabelProxy "length"
dOMFileListLength = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList DOMFileList = DOMFileListSignalList
type DOMFileListSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method DOMFileList::get_length
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface
--                 Name { namespace = "WebKit2WebExtension" , name = "DOMFileList" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #WebKitDOMFileList"
--                 , 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_file_list_get_length" webkit_dom_file_list_get_length :: 
    Ptr DOMFileList ->                      -- self : TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMFileList"})
    IO CULong

{-# DEPRECATED dOMFileListGetLength ["(Since version 2.22)","Use JavaScriptCore API instead"] #-}
-- | /No description available in the introspection data./
dOMFileListGetLength ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMFileList a) =>
    a
    -- ^ /@self@/: A t'GI.WebKit2WebExtension.Objects.DOMFileList.DOMFileList'
    -> m CULong
    -- ^ __Returns:__ A @/gulong/@
dOMFileListGetLength :: a -> m CULong
dOMFileListGetLength a
self = IO CULong -> m CULong
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CULong -> m CULong) -> IO CULong -> m CULong
forall a b. (a -> b) -> a -> b
$ do
    Ptr DOMFileList
self' <- a -> IO (Ptr DOMFileList)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    CULong
result <- Ptr DOMFileList -> IO CULong
webkit_dom_file_list_get_length Ptr DOMFileList
self'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
    CULong -> IO CULong
forall (m :: * -> *) a. Monad m => a -> m a
return CULong
result

#if defined(ENABLE_OVERLOADING)
data DOMFileListGetLengthMethodInfo
instance (signature ~ (m CULong), MonadIO m, IsDOMFileList a) => O.MethodInfo DOMFileListGetLengthMethodInfo a signature where
    overloadedMethod = dOMFileListGetLength

#endif

-- method DOMFileList::item
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface
--                 Name { namespace = "WebKit2WebExtension" , name = "DOMFileList" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #WebKitDOMFileList"
--                 , 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
--               (TInterface
--                  Name { namespace = "WebKit2WebExtension" , name = "DOMFile" })
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_file_list_item" webkit_dom_file_list_item :: 
    Ptr DOMFileList ->                      -- self : TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMFileList"})
    CULong ->                               -- index : TBasicType TULong
    IO (Ptr WebKit2WebExtension.DOMFile.DOMFile)

{-# DEPRECATED dOMFileListItem ["(Since version 2.22)","Use JavaScriptCore API instead"] #-}
-- | /No description available in the introspection data./
dOMFileListItem ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMFileList a) =>
    a
    -- ^ /@self@/: A t'GI.WebKit2WebExtension.Objects.DOMFileList.DOMFileList'
    -> CULong
    -- ^ /@index@/: A @/gulong/@
    -> m WebKit2WebExtension.DOMFile.DOMFile
    -- ^ __Returns:__ A t'GI.WebKit2WebExtension.Objects.DOMFile.DOMFile'
dOMFileListItem :: a -> CULong -> m DOMFile
dOMFileListItem a
self CULong
index = IO DOMFile -> m DOMFile
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DOMFile -> m DOMFile) -> IO DOMFile -> m DOMFile
forall a b. (a -> b) -> a -> b
$ do
    Ptr DOMFileList
self' <- a -> IO (Ptr DOMFileList)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr DOMFile
result <- Ptr DOMFileList -> CULong -> IO (Ptr DOMFile)
webkit_dom_file_list_item Ptr DOMFileList
self' CULong
index
    Text -> Ptr DOMFile -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"dOMFileListItem" Ptr DOMFile
result
    DOMFile
result' <- ((ManagedPtr DOMFile -> DOMFile) -> Ptr DOMFile -> IO DOMFile
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr DOMFile -> DOMFile
WebKit2WebExtension.DOMFile.DOMFile) Ptr DOMFile
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
    DOMFile -> IO DOMFile
forall (m :: * -> *) a. Monad m => a -> m a
return DOMFile
result'

#if defined(ENABLE_OVERLOADING)
data DOMFileListItemMethodInfo
instance (signature ~ (CULong -> m WebKit2WebExtension.DOMFile.DOMFile), MonadIO m, IsDOMFileList a) => O.MethodInfo DOMFileListItemMethodInfo a signature where
    overloadedMethod = dOMFileListItem

#endif