{- |
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.WebKit2.Structs.ApplicationInfo
    (

-- * Exported types
    ApplicationInfo(..)                     ,
    noApplicationInfo                       ,


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

#if ENABLE_OVERLOADING
    ApplicationInfoGetNameMethodInfo        ,
#endif
    applicationInfoGetName                  ,


-- ** getVersion #method:getVersion#

#if ENABLE_OVERLOADING
    ApplicationInfoGetVersionMethodInfo     ,
#endif
    applicationInfoGetVersion               ,


-- ** new #method:new#

    applicationInfoNew                      ,


-- ** ref #method:ref#

#if ENABLE_OVERLOADING
    ApplicationInfoRefMethodInfo            ,
#endif
    applicationInfoRef                      ,


-- ** setName #method:setName#

#if ENABLE_OVERLOADING
    ApplicationInfoSetNameMethodInfo        ,
#endif
    applicationInfoSetName                  ,


-- ** setVersion #method:setVersion#

#if ENABLE_OVERLOADING
    ApplicationInfoSetVersionMethodInfo     ,
#endif
    applicationInfoSetVersion               ,


-- ** unref #method:unref#

#if ENABLE_OVERLOADING
    ApplicationInfoUnrefMethodInfo          ,
#endif
    applicationInfoUnref                    ,




    ) 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


-- | Memory-managed wrapper type.
newtype ApplicationInfo = ApplicationInfo (ManagedPtr ApplicationInfo)
foreign import ccall "webkit_application_info_get_type" c_webkit_application_info_get_type ::
    IO GType

instance BoxedObject ApplicationInfo where
    boxedType _ = c_webkit_application_info_get_type

-- | A convenience alias for `Nothing` :: `Maybe` `ApplicationInfo`.
noApplicationInfo :: Maybe ApplicationInfo
noApplicationInfo = Nothing


#if ENABLE_OVERLOADING
instance O.HasAttributeList ApplicationInfo
type instance O.AttributeList ApplicationInfo = ApplicationInfoAttributeList
type ApplicationInfoAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method ApplicationInfo::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "ApplicationInfo"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_application_info_new" webkit_application_info_new ::
    IO (Ptr ApplicationInfo)

{- |
Creates a new 'GI.WebKit2.Structs.ApplicationInfo.ApplicationInfo'

/Since: 2.18/
-}
applicationInfoNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ApplicationInfo
    {- ^ __Returns:__ the newly created 'GI.WebKit2.Structs.ApplicationInfo.ApplicationInfo'. -}
applicationInfoNew  = liftIO $ do
    result <- webkit_application_info_new
    checkUnexpectedReturnNULL "applicationInfoNew" result
    result' <- (wrapBoxed ApplicationInfo) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method ApplicationInfo::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "WebKit2", name = "ApplicationInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitApplicationInfo", 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_application_info_get_name" webkit_application_info_get_name ::
    Ptr ApplicationInfo ->                  -- info : TInterface (Name {namespace = "WebKit2", name = "ApplicationInfo"})
    IO CString

{- |
Get the name of the application. If 'GI.WebKit2.Structs.ApplicationInfo.applicationInfoSetName' hasn\'t been
called with a valid name, this returns 'GI.GLib.Functions.getPrgname'.

/Since: 2.18/
-}
applicationInfoGetName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ApplicationInfo
    {- ^ /@info@/: a 'GI.WebKit2.Structs.ApplicationInfo.ApplicationInfo' -}
    -> m T.Text
    {- ^ __Returns:__ the application name -}
applicationInfoGetName info = liftIO $ do
    info' <- unsafeManagedPtrGetPtr info
    result <- webkit_application_info_get_name info'
    checkUnexpectedReturnNULL "applicationInfoGetName" result
    result' <- cstringToText result
    touchManagedPtr info
    return result'

#if ENABLE_OVERLOADING
data ApplicationInfoGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo ApplicationInfoGetNameMethodInfo ApplicationInfo signature where
    overloadedMethod _ = applicationInfoGetName

#endif

-- method ApplicationInfo::get_version
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "WebKit2", name = "ApplicationInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitApplicationInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "major", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the major version number", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "minor", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the minor version number", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "micro", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the micro version number", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_application_info_get_version" webkit_application_info_get_version ::
    Ptr ApplicationInfo ->                  -- info : TInterface (Name {namespace = "WebKit2", name = "ApplicationInfo"})
    Ptr Word64 ->                           -- major : TBasicType TUInt64
    Ptr Word64 ->                           -- minor : TBasicType TUInt64
    Ptr Word64 ->                           -- micro : TBasicType TUInt64
    IO ()

{- |
Get the application version previously set with 'GI.WebKit2.Structs.ApplicationInfo.applicationInfoSetVersion'.

/Since: 2.18/
-}
applicationInfoGetVersion ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ApplicationInfo
    {- ^ /@info@/: a 'GI.WebKit2.Structs.ApplicationInfo.ApplicationInfo' -}
    -> m ((Word64, Word64, Word64))
applicationInfoGetVersion info = liftIO $ do
    info' <- unsafeManagedPtrGetPtr info
    major <- allocMem :: IO (Ptr Word64)
    minor <- allocMem :: IO (Ptr Word64)
    micro <- allocMem :: IO (Ptr Word64)
    webkit_application_info_get_version info' major minor micro
    major' <- peek major
    minor' <- peek minor
    micro' <- peek micro
    touchManagedPtr info
    freeMem major
    freeMem minor
    freeMem micro
    return (major', minor', micro')

#if ENABLE_OVERLOADING
data ApplicationInfoGetVersionMethodInfo
instance (signature ~ (m ((Word64, Word64, Word64))), MonadIO m) => O.MethodInfo ApplicationInfoGetVersionMethodInfo ApplicationInfo signature where
    overloadedMethod _ = applicationInfoGetVersion

#endif

-- method ApplicationInfo::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "WebKit2", name = "ApplicationInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitApplicationInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "ApplicationInfo"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_application_info_ref" webkit_application_info_ref ::
    Ptr ApplicationInfo ->                  -- info : TInterface (Name {namespace = "WebKit2", name = "ApplicationInfo"})
    IO (Ptr ApplicationInfo)

{- |
Atomically increments the reference count of /@info@/ by one. This
function is MT-safe and may be called from any thread.

/Since: 2.18/
-}
applicationInfoRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ApplicationInfo
    {- ^ /@info@/: a 'GI.WebKit2.Structs.ApplicationInfo.ApplicationInfo' -}
    -> m ApplicationInfo
    {- ^ __Returns:__ The passed in 'GI.WebKit2.Structs.ApplicationInfo.ApplicationInfo' -}
applicationInfoRef info = liftIO $ do
    info' <- unsafeManagedPtrGetPtr info
    result <- webkit_application_info_ref info'
    checkUnexpectedReturnNULL "applicationInfoRef" result
    result' <- (wrapBoxed ApplicationInfo) result
    touchManagedPtr info
    return result'

#if ENABLE_OVERLOADING
data ApplicationInfoRefMethodInfo
instance (signature ~ (m ApplicationInfo), MonadIO m) => O.MethodInfo ApplicationInfoRefMethodInfo ApplicationInfo signature where
    overloadedMethod _ = applicationInfoRef

#endif

-- method ApplicationInfo::set_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "WebKit2", name = "ApplicationInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitApplicationInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the application name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_application_info_set_name" webkit_application_info_set_name ::
    Ptr ApplicationInfo ->                  -- info : TInterface (Name {namespace = "WebKit2", name = "ApplicationInfo"})
    CString ->                              -- name : TBasicType TUTF8
    IO ()

{- |
Set the name of the application. If not provided, or 'Nothing' is passed,
'GI.GLib.Functions.getPrgname' will be used.

/Since: 2.18/
-}
applicationInfoSetName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ApplicationInfo
    {- ^ /@info@/: a 'GI.WebKit2.Structs.ApplicationInfo.ApplicationInfo' -}
    -> T.Text
    {- ^ /@name@/: the application name -}
    -> m ()
applicationInfoSetName info name = liftIO $ do
    info' <- unsafeManagedPtrGetPtr info
    name' <- textToCString name
    webkit_application_info_set_name info' name'
    touchManagedPtr info
    freeMem name'
    return ()

#if ENABLE_OVERLOADING
data ApplicationInfoSetNameMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo ApplicationInfoSetNameMethodInfo ApplicationInfo signature where
    overloadedMethod _ = applicationInfoSetName

#endif

-- method ApplicationInfo::set_version
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "WebKit2", name = "ApplicationInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitApplicationInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "major", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the major version number", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "minor", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the minor version number", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "micro", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the micro version number", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_application_info_set_version" webkit_application_info_set_version ::
    Ptr ApplicationInfo ->                  -- info : TInterface (Name {namespace = "WebKit2", name = "ApplicationInfo"})
    Word64 ->                               -- major : TBasicType TUInt64
    Word64 ->                               -- minor : TBasicType TUInt64
    Word64 ->                               -- micro : TBasicType TUInt64
    IO ()

{- |
Set the application version. If the application doesn\'t use the format
major.minor.micro you can pass 0 as the micro to use major.minor, or pass
0 as both micro and minor to use only major number. Any other format must
be converted to major.minor.micro so that it can be used in version comparisons.

/Since: 2.18/
-}
applicationInfoSetVersion ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ApplicationInfo
    {- ^ /@info@/: a 'GI.WebKit2.Structs.ApplicationInfo.ApplicationInfo' -}
    -> Word64
    {- ^ /@major@/: the major version number -}
    -> Word64
    {- ^ /@minor@/: the minor version number -}
    -> Word64
    {- ^ /@micro@/: the micro version number -}
    -> m ()
applicationInfoSetVersion info major minor micro = liftIO $ do
    info' <- unsafeManagedPtrGetPtr info
    webkit_application_info_set_version info' major minor micro
    touchManagedPtr info
    return ()

#if ENABLE_OVERLOADING
data ApplicationInfoSetVersionMethodInfo
instance (signature ~ (Word64 -> Word64 -> Word64 -> m ()), MonadIO m) => O.MethodInfo ApplicationInfoSetVersionMethodInfo ApplicationInfo signature where
    overloadedMethod _ = applicationInfoSetVersion

#endif

-- method ApplicationInfo::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "WebKit2", name = "ApplicationInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitApplicationInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_application_info_unref" webkit_application_info_unref ::
    Ptr ApplicationInfo ->                  -- info : TInterface (Name {namespace = "WebKit2", name = "ApplicationInfo"})
    IO ()

{- |
Atomically decrements the reference count of /@info@/ by one. If the
reference count drops to 0, all memory allocated by the 'GI.WebKit2.Structs.ApplicationInfo.ApplicationInfo' is
released. This function is MT-safe and may be called from any
thread.

/Since: 2.18/
-}
applicationInfoUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ApplicationInfo
    {- ^ /@info@/: a 'GI.WebKit2.Structs.ApplicationInfo.ApplicationInfo' -}
    -> m ()
applicationInfoUnref info = liftIO $ do
    info' <- unsafeManagedPtrGetPtr info
    webkit_application_info_unref info'
    touchManagedPtr info
    return ()

#if ENABLE_OVERLOADING
data ApplicationInfoUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo ApplicationInfoUnrefMethodInfo ApplicationInfo signature where
    overloadedMethod _ = applicationInfoUnref

#endif

#if ENABLE_OVERLOADING
type family ResolveApplicationInfoMethod (t :: Symbol) (o :: *) :: * where
    ResolveApplicationInfoMethod "ref" o = ApplicationInfoRefMethodInfo
    ResolveApplicationInfoMethod "unref" o = ApplicationInfoUnrefMethodInfo
    ResolveApplicationInfoMethod "getName" o = ApplicationInfoGetNameMethodInfo
    ResolveApplicationInfoMethod "getVersion" o = ApplicationInfoGetVersionMethodInfo
    ResolveApplicationInfoMethod "setName" o = ApplicationInfoSetNameMethodInfo
    ResolveApplicationInfoMethod "setVersion" o = ApplicationInfoSetVersionMethodInfo
    ResolveApplicationInfoMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveApplicationInfoMethod t ApplicationInfo, O.MethodInfo info ApplicationInfo p) => OL.IsLabel t (ApplicationInfo -> 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