{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

/No description available in the introspection data./
-}

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

module GI.WebKit2WebExtension.Objects.DOMFile
    (

-- * Exported types
    DOMFile(..)                             ,
    IsDOMFile                               ,
    toDOMFile                               ,
    noDOMFile                               ,


 -- * Methods
-- ** getName #method:getName#

#if ENABLE_OVERLOADING
    DOMFileGetNameMethodInfo                ,
#endif
    dOMFileGetName                          ,




 -- * Properties
-- ** name #attr:name#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    DOMFileNamePropertyInfo                 ,
#endif
#if ENABLE_OVERLOADING
    dOMFileName                             ,
#endif
    getDOMFileName                          ,




    ) 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.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.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.DOMBlob as WebKit2WebExtension.DOMBlob
import {-# SOURCE #-} qualified GI.WebKit2WebExtension.Objects.DOMObject as WebKit2WebExtension.DOMObject

-- | Memory-managed wrapper type.
newtype DOMFile = DOMFile (ManagedPtr DOMFile)
foreign import ccall "webkit_dom_file_get_type"
    c_webkit_dom_file_get_type :: IO GType

instance GObject DOMFile where
    gobjectType = c_webkit_dom_file_get_type


-- | Type class for types which can be safely cast to `DOMFile`, for instance with `toDOMFile`.
class (GObject o, O.IsDescendantOf DOMFile o) => IsDOMFile o
instance (GObject o, O.IsDescendantOf DOMFile o) => IsDOMFile o

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

-- | Cast to `DOMFile`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toDOMFile :: (MonadIO m, IsDOMFile o) => o -> m DOMFile
toDOMFile = liftIO . unsafeCastTo DOMFile

-- | A convenience alias for `Nothing` :: `Maybe` `DOMFile`.
noDOMFile :: Maybe DOMFile
noDOMFile = Nothing

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

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

#endif

-- VVV Prop "name"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@name@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dOMFile #name
@
-}
getDOMFileName :: (MonadIO m, IsDOMFile o) => o -> m (Maybe T.Text)
getDOMFileName obj = liftIO $ B.Properties.getObjectPropertyString obj "name"

#if ENABLE_OVERLOADING
data DOMFileNamePropertyInfo
instance AttrInfo DOMFileNamePropertyInfo where
    type AttrAllowedOps DOMFileNamePropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DOMFileNamePropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMFileNamePropertyInfo = IsDOMFile
    type AttrGetType DOMFileNamePropertyInfo = (Maybe T.Text)
    type AttrLabel DOMFileNamePropertyInfo = "name"
    type AttrOrigin DOMFileNamePropertyInfo = DOMFile
    attrGet _ = getDOMFileName
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

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

#if ENABLE_OVERLOADING
dOMFileName :: AttrLabelProxy "name"
dOMFileName = AttrLabelProxy

#endif

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

#endif

-- method DOMFile::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMFile", 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_file_get_name" webkit_dom_file_get_name ::
    Ptr DOMFile ->                          -- self : TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMFile"})
    IO CString

{-# DEPRECATED dOMFileGetName ["(Since version 2.22)","Use JavaScriptCore API instead"] #-}
{- |
/No description available in the introspection data./
-}
dOMFileGetName ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMFile a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit2WebExtension.Objects.DOMFile.DOMFile' -}
    -> m T.Text
    {- ^ __Returns:__ A @/gchar/@ -}
dOMFileGetName self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_file_get_name self'
    checkUnexpectedReturnNULL "dOMFileGetName" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr self
    return result'

#if ENABLE_OVERLOADING
data DOMFileGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsDOMFile a) => O.MethodInfo DOMFileGetNameMethodInfo a signature where
    overloadedMethod _ = dOMFileGetName

#endif