{-# 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.DOMBlob
    ( 

-- * Exported types
    DOMBlob(..)                             ,
    IsDOMBlob                               ,
    toDOMBlob                               ,


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

#if defined(ENABLE_OVERLOADING)
    ResolveDOMBlobMethod                    ,
#endif


-- ** getSize #method:getSize#

#if defined(ENABLE_OVERLOADING)
    DOMBlobGetSizeMethodInfo                ,
#endif
    dOMBlobGetSize                          ,




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

#if defined(ENABLE_OVERLOADING)
    DOMBlobSizePropertyInfo                 ,
#endif
#if defined(ENABLE_OVERLOADING)
    dOMBlobSize                             ,
#endif
    getDOMBlobSize                          ,




    ) 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.DOMObject as WebKit2WebExtension.DOMObject

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

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

foreign import ccall "webkit_dom_blob_get_type"
    c_webkit_dom_blob_get_type :: IO B.Types.GType

instance B.Types.TypedObject DOMBlob where
    glibType :: IO GType
glibType = IO GType
c_webkit_dom_blob_get_type

instance B.Types.GObject DOMBlob

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

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

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

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

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

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

#endif

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

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

#if defined(ENABLE_OVERLOADING)
data DOMBlobSizePropertyInfo
instance AttrInfo DOMBlobSizePropertyInfo where
    type AttrAllowedOps DOMBlobSizePropertyInfo = '[ 'AttrGet]
    type AttrBaseTypeConstraint DOMBlobSizePropertyInfo = IsDOMBlob
    type AttrSetTypeConstraint DOMBlobSizePropertyInfo = (~) ()
    type AttrTransferTypeConstraint DOMBlobSizePropertyInfo = (~) ()
    type AttrTransferType DOMBlobSizePropertyInfo = ()
    type AttrGetType DOMBlobSizePropertyInfo = Word64
    type AttrLabel DOMBlobSizePropertyInfo = "size"
    type AttrOrigin DOMBlobSizePropertyInfo = DOMBlob
    attrGet = getDOMBlobSize
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList DOMBlob
type instance O.AttributeList DOMBlob = DOMBlobAttributeList
type DOMBlobAttributeList = ('[ '("coreObject", WebKit2WebExtension.DOMObject.DOMObjectCoreObjectPropertyInfo), '("size", DOMBlobSizePropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
dOMBlobSize :: AttrLabelProxy "size"
dOMBlobSize = AttrLabelProxy

#endif

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

#endif

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

foreign import ccall "webkit_dom_blob_get_size" webkit_dom_blob_get_size :: 
    Ptr DOMBlob ->                          -- self : TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMBlob"})
    IO Word64

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

#if defined(ENABLE_OVERLOADING)
data DOMBlobGetSizeMethodInfo
instance (signature ~ (m Word64), MonadIO m, IsDOMBlob a) => O.MethodInfo DOMBlobGetSizeMethodInfo a signature where
    overloadedMethod = dOMBlobGetSize

#endif