{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.WebKit2WebExtension.Objects.DOMNodeList
(
DOMNodeList(..) ,
IsDOMNodeList ,
toDOMNodeList ,
#if defined(ENABLE_OVERLOADING)
ResolveDOMNodeListMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
DOMNodeListGetLengthMethodInfo ,
#endif
dOMNodeListGetLength ,
#if defined(ENABLE_OVERLOADING)
DOMNodeListItemMethodInfo ,
#endif
dOMNodeListItem ,
#if defined(ENABLE_OVERLOADING)
DOMNodeListLengthPropertyInfo ,
#endif
#if defined(ENABLE_OVERLOADING)
dOMNodeListLength ,
#endif
getDOMNodeListLength ,
) 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.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 GHC.Records as R
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.WebKit2WebExtension.Objects.DOMNode as WebKit2WebExtension.DOMNode
import {-# SOURCE #-} qualified GI.WebKit2WebExtension.Objects.DOMObject as WebKit2WebExtension.DOMObject
newtype DOMNodeList = DOMNodeList (SP.ManagedPtr DOMNodeList)
deriving (DOMNodeList -> DOMNodeList -> Bool
(DOMNodeList -> DOMNodeList -> Bool)
-> (DOMNodeList -> DOMNodeList -> Bool) -> Eq DOMNodeList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DOMNodeList -> DOMNodeList -> Bool
== :: DOMNodeList -> DOMNodeList -> Bool
$c/= :: DOMNodeList -> DOMNodeList -> Bool
/= :: DOMNodeList -> DOMNodeList -> Bool
Eq)
instance SP.ManagedPtrNewtype DOMNodeList where
toManagedPtr :: DOMNodeList -> ManagedPtr DOMNodeList
toManagedPtr (DOMNodeList ManagedPtr DOMNodeList
p) = ManagedPtr DOMNodeList
p
foreign import ccall "webkit_dom_node_list_get_type"
c_webkit_dom_node_list_get_type :: IO B.Types.GType
instance B.Types.TypedObject DOMNodeList where
glibType :: IO GType
glibType = IO GType
c_webkit_dom_node_list_get_type
instance B.Types.GObject DOMNodeList
class (SP.GObject o, O.IsDescendantOf DOMNodeList o) => IsDOMNodeList o
instance (SP.GObject o, O.IsDescendantOf DOMNodeList o) => IsDOMNodeList o
instance O.HasParentTypes DOMNodeList
type instance O.ParentTypes DOMNodeList = '[WebKit2WebExtension.DOMObject.DOMObject, GObject.Object.Object]
toDOMNodeList :: (MIO.MonadIO m, IsDOMNodeList o) => o -> m DOMNodeList
toDOMNodeList :: forall (m :: * -> *) o.
(MonadIO m, IsDOMNodeList o) =>
o -> m DOMNodeList
toDOMNodeList = IO DOMNodeList -> m DOMNodeList
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO DOMNodeList -> m DOMNodeList)
-> (o -> IO DOMNodeList) -> o -> m DOMNodeList
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr DOMNodeList -> DOMNodeList) -> o -> IO DOMNodeList
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr DOMNodeList -> DOMNodeList
DOMNodeList
instance B.GValue.IsGValue (Maybe DOMNodeList) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_webkit_dom_node_list_get_type
gvalueSet_ :: Ptr GValue -> Maybe DOMNodeList -> IO ()
gvalueSet_ Ptr GValue
gv Maybe DOMNodeList
P.Nothing = Ptr GValue -> Ptr DOMNodeList -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr DOMNodeList
forall a. Ptr a
FP.nullPtr :: FP.Ptr DOMNodeList)
gvalueSet_ Ptr GValue
gv (P.Just DOMNodeList
obj) = DOMNodeList -> (Ptr DOMNodeList -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr DOMNodeList
obj (Ptr GValue -> Ptr DOMNodeList -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe DOMNodeList)
gvalueGet_ Ptr GValue
gv = do
Ptr DOMNodeList
ptr <- Ptr GValue -> IO (Ptr DOMNodeList)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr DOMNodeList)
if Ptr DOMNodeList
ptr Ptr DOMNodeList -> Ptr DOMNodeList -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr DOMNodeList
forall a. Ptr a
FP.nullPtr
then DOMNodeList -> Maybe DOMNodeList
forall a. a -> Maybe a
P.Just (DOMNodeList -> Maybe DOMNodeList)
-> IO DOMNodeList -> IO (Maybe DOMNodeList)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr DOMNodeList -> DOMNodeList)
-> Ptr DOMNodeList -> IO DOMNodeList
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr DOMNodeList -> DOMNodeList
DOMNodeList Ptr DOMNodeList
ptr
else Maybe DOMNodeList -> IO (Maybe DOMNodeList)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe DOMNodeList
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveDOMNodeListMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveDOMNodeListMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveDOMNodeListMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveDOMNodeListMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveDOMNodeListMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveDOMNodeListMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveDOMNodeListMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveDOMNodeListMethod "item" o = DOMNodeListItemMethodInfo
ResolveDOMNodeListMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveDOMNodeListMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveDOMNodeListMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveDOMNodeListMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveDOMNodeListMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveDOMNodeListMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveDOMNodeListMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveDOMNodeListMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveDOMNodeListMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveDOMNodeListMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveDOMNodeListMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveDOMNodeListMethod "getLength" o = DOMNodeListGetLengthMethodInfo
ResolveDOMNodeListMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveDOMNodeListMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveDOMNodeListMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveDOMNodeListMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveDOMNodeListMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveDOMNodeListMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveDOMNodeListMethod t DOMNodeList, O.OverloadedMethod info DOMNodeList p) => OL.IsLabel t (DOMNodeList -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveDOMNodeListMethod t DOMNodeList, O.OverloadedMethod info DOMNodeList p, R.HasField t DOMNodeList p) => R.HasField t DOMNodeList p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveDOMNodeListMethod t DOMNodeList, O.OverloadedMethodInfo info DOMNodeList) => OL.IsLabel t (O.MethodProxy info DOMNodeList) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
getDOMNodeListLength :: (MonadIO m, IsDOMNodeList o) => o -> m CULong
getDOMNodeListLength :: forall (m :: * -> *) o.
(MonadIO m, IsDOMNodeList o) =>
o -> m CULong
getDOMNodeListLength o
obj = IO CULong -> m CULong
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.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 DOMNodeListLengthPropertyInfo
instance AttrInfo DOMNodeListLengthPropertyInfo where
type AttrAllowedOps DOMNodeListLengthPropertyInfo = '[ 'AttrGet]
type AttrBaseTypeConstraint DOMNodeListLengthPropertyInfo = IsDOMNodeList
type AttrSetTypeConstraint DOMNodeListLengthPropertyInfo = (~) ()
type AttrTransferTypeConstraint DOMNodeListLengthPropertyInfo = (~) ()
type AttrTransferType DOMNodeListLengthPropertyInfo = ()
type AttrGetType DOMNodeListLengthPropertyInfo = CULong
type AttrLabel DOMNodeListLengthPropertyInfo = "length"
type AttrOrigin DOMNodeListLengthPropertyInfo = DOMNodeList
attrGet = getDOMNodeListLength
attrSet = undefined
attrTransfer _ = undefined
attrConstruct = undefined
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.WebKit2WebExtension.Objects.DOMNodeList.length"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2webextension-4.0.30/docs/GI-WebKit2WebExtension-Objects-DOMNodeList.html#g:attr:length"
})
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList DOMNodeList
type instance O.AttributeList DOMNodeList = DOMNodeListAttributeList
type DOMNodeListAttributeList = ('[ '("coreObject", WebKit2WebExtension.DOMObject.DOMObjectCoreObjectPropertyInfo), '("length", DOMNodeListLengthPropertyInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
dOMNodeListLength :: AttrLabelProxy "length"
dOMNodeListLength = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList DOMNodeList = DOMNodeListSignalList
type DOMNodeListSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "webkit_dom_node_list_get_length" webkit_dom_node_list_get_length ::
Ptr DOMNodeList ->
IO CULong
{-# DEPRECATED dOMNodeListGetLength ["(Since version 2.22)","Use JavaScriptCore API instead"] #-}
dOMNodeListGetLength ::
(B.CallStack.HasCallStack, MonadIO m, IsDOMNodeList a) =>
a
-> m CULong
dOMNodeListGetLength :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDOMNodeList a) =>
a -> m CULong
dOMNodeListGetLength a
self = IO CULong -> m CULong
forall a. IO a -> m a
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 DOMNodeList
self' <- a -> IO (Ptr DOMNodeList)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
CULong
result <- Ptr DOMNodeList -> IO CULong
webkit_dom_node_list_get_length Ptr DOMNodeList
self'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
CULong -> IO CULong
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CULong
result
#if defined(ENABLE_OVERLOADING)
data DOMNodeListGetLengthMethodInfo
instance (signature ~ (m CULong), MonadIO m, IsDOMNodeList a) => O.OverloadedMethod DOMNodeListGetLengthMethodInfo a signature where
overloadedMethod = dOMNodeListGetLength
instance O.OverloadedMethodInfo DOMNodeListGetLengthMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.WebKit2WebExtension.Objects.DOMNodeList.dOMNodeListGetLength",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2webextension-4.0.30/docs/GI-WebKit2WebExtension-Objects-DOMNodeList.html#v:dOMNodeListGetLength"
})
#endif
foreign import ccall "webkit_dom_node_list_item" webkit_dom_node_list_item ::
Ptr DOMNodeList ->
CULong ->
IO (Ptr WebKit2WebExtension.DOMNode.DOMNode)
{-# DEPRECATED dOMNodeListItem ["(Since version 2.22)","Use JavaScriptCore API instead"] #-}
dOMNodeListItem ::
(B.CallStack.HasCallStack, MonadIO m, IsDOMNodeList a) =>
a
-> CULong
-> m (Maybe WebKit2WebExtension.DOMNode.DOMNode)
dOMNodeListItem :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDOMNodeList a) =>
a -> CULong -> m (Maybe DOMNode)
dOMNodeListItem a
self CULong
index = IO (Maybe DOMNode) -> m (Maybe DOMNode)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe DOMNode) -> m (Maybe DOMNode))
-> IO (Maybe DOMNode) -> m (Maybe DOMNode)
forall a b. (a -> b) -> a -> b
$ do
Ptr DOMNodeList
self' <- a -> IO (Ptr DOMNodeList)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
Ptr DOMNode
result <- Ptr DOMNodeList -> CULong -> IO (Ptr DOMNode)
webkit_dom_node_list_item Ptr DOMNodeList
self' CULong
index
Maybe DOMNode
maybeResult <- Ptr DOMNode -> (Ptr DOMNode -> IO DOMNode) -> IO (Maybe DOMNode)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr DOMNode
result ((Ptr DOMNode -> IO DOMNode) -> IO (Maybe DOMNode))
-> (Ptr DOMNode -> IO DOMNode) -> IO (Maybe DOMNode)
forall a b. (a -> b) -> a -> b
$ \Ptr DOMNode
result' -> do
DOMNode
result'' <- ((ManagedPtr DOMNode -> DOMNode) -> Ptr DOMNode -> IO DOMNode
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DOMNode -> DOMNode
WebKit2WebExtension.DOMNode.DOMNode) Ptr DOMNode
result'
DOMNode -> IO DOMNode
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return DOMNode
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
Maybe DOMNode -> IO (Maybe DOMNode)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe DOMNode
maybeResult
#if defined(ENABLE_OVERLOADING)
data DOMNodeListItemMethodInfo
instance (signature ~ (CULong -> m (Maybe WebKit2WebExtension.DOMNode.DOMNode)), MonadIO m, IsDOMNodeList a) => O.OverloadedMethod DOMNodeListItemMethodInfo a signature where
overloadedMethod = dOMNodeListItem
instance O.OverloadedMethodInfo DOMNodeListItemMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.WebKit2WebExtension.Objects.DOMNodeList.dOMNodeListItem",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2webextension-4.0.30/docs/GI-WebKit2WebExtension-Objects-DOMNodeList.html#v:dOMNodeListItem"
})
#endif