{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) -} module GI.WebKit2.Structs.WebsiteData ( -- * Exported types WebsiteData(..) , noWebsiteData , -- * Methods -- ** getName #method:getName# WebsiteDataGetNameMethodInfo , websiteDataGetName , -- ** getSize #method:getSize# WebsiteDataGetSizeMethodInfo , websiteDataGetSize , -- ** getTypes #method:getTypes# WebsiteDataGetTypesMethodInfo , websiteDataGetTypes , -- ** ref #method:ref# WebsiteDataRefMethodInfo , websiteDataRef , -- ** unref #method:unref# WebsiteDataUnrefMethodInfo , websiteDataUnref , ) 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.GError as B.GError import qualified Data.GI.Base.GVariant as B.GVariant import qualified Data.GI.Base.GParamSpec as B.GParamSpec import qualified Data.GI.Base.CallStack as B.CallStack 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 {-# SOURCE #-} qualified GI.WebKit2.Flags as WebKit2.Flags newtype WebsiteData = WebsiteData (ManagedPtr WebsiteData) foreign import ccall "webkit_website_data_get_type" c_webkit_website_data_get_type :: IO GType instance BoxedObject WebsiteData where boxedType _ = c_webkit_website_data_get_type noWebsiteData :: Maybe WebsiteData noWebsiteData = Nothing instance O.HasAttributeList WebsiteData type instance O.AttributeList WebsiteData = WebsiteDataAttributeList type WebsiteDataAttributeList = ('[ ] :: [(Symbol, *)]) -- method WebsiteData::get_name -- method type : OrdinaryMethod -- Args : [Arg {argCName = "website_data", argType = TInterface (Name {namespace = "WebKit2", name = "WebsiteData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitWebsiteData", 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_website_data_get_name" webkit_website_data_get_name :: Ptr WebsiteData -> -- website_data : TInterface (Name {namespace = "WebKit2", name = "WebsiteData"}) IO CString {- | Gets the name of 'GI.WebKit2.Structs.WebsiteData.WebsiteData'. This is the website name, normally represented by a domain or host name. All local documents are grouped in the same 'GI.WebKit2.Structs.WebsiteData.WebsiteData' using the name \"Local files\". @since 2.16 -} websiteDataGetName :: (B.CallStack.HasCallStack, MonadIO m) => WebsiteData {- ^ /@websiteData@/: a 'GI.WebKit2.Structs.WebsiteData.WebsiteData' -} -> m T.Text {- ^ __Returns:__ the website name of /@websiteData@/. -} websiteDataGetName websiteData = liftIO $ do websiteData' <- unsafeManagedPtrGetPtr websiteData result <- webkit_website_data_get_name websiteData' checkUnexpectedReturnNULL "websiteDataGetName" result result' <- cstringToText result touchManagedPtr websiteData return result' data WebsiteDataGetNameMethodInfo instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo WebsiteDataGetNameMethodInfo WebsiteData signature where overloadedMethod _ = websiteDataGetName -- method WebsiteData::get_size -- method type : OrdinaryMethod -- Args : [Arg {argCName = "website_data", argType = TInterface (Name {namespace = "WebKit2", name = "WebsiteData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitWebsiteData", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "types", argType = TInterface (Name {namespace = "WebKit2", name = "WebsiteDataTypes"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a bitmask of #WebKitWebsiteDataTypes", 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_website_data_get_size" webkit_website_data_get_size :: Ptr WebsiteData -> -- website_data : TInterface (Name {namespace = "WebKit2", name = "WebsiteData"}) CUInt -> -- types : TInterface (Name {namespace = "WebKit2", name = "WebsiteDataTypes"}) IO Word64 {- | Gets the size of the data of types /@types@/ in a 'GI.WebKit2.Structs.WebsiteData.WebsiteData'. Note that currently the data size is only known for 'GI.WebKit2.Flags.WebsiteDataTypesDiskCache' data type so for all other types 0 will be returned. @since 2.16 -} websiteDataGetSize :: (B.CallStack.HasCallStack, MonadIO m) => WebsiteData {- ^ /@websiteData@/: a 'GI.WebKit2.Structs.WebsiteData.WebsiteData' -} -> [WebKit2.Flags.WebsiteDataTypes] {- ^ /@types@/: a bitmask of 'GI.WebKit2.Flags.WebsiteDataTypes' -} -> m Word64 {- ^ __Returns:__ the size of /@websiteData@/ for the given /@types@/. -} websiteDataGetSize websiteData types = liftIO $ do websiteData' <- unsafeManagedPtrGetPtr websiteData let types' = gflagsToWord types result <- webkit_website_data_get_size websiteData' types' touchManagedPtr websiteData return result data WebsiteDataGetSizeMethodInfo instance (signature ~ ([WebKit2.Flags.WebsiteDataTypes] -> m Word64), MonadIO m) => O.MethodInfo WebsiteDataGetSizeMethodInfo WebsiteData signature where overloadedMethod _ = websiteDataGetSize -- method WebsiteData::get_types -- method type : OrdinaryMethod -- Args : [Arg {argCName = "website_data", argType = TInterface (Name {namespace = "WebKit2", name = "WebsiteData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitWebsiteData", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "WebsiteDataTypes"})) -- throws : False -- Skip return : False foreign import ccall "webkit_website_data_get_types" webkit_website_data_get_types :: Ptr WebsiteData -> -- website_data : TInterface (Name {namespace = "WebKit2", name = "WebsiteData"}) IO CUInt {- | Gets the types of data stored in the client for a 'GI.WebKit2.Structs.WebsiteData.WebsiteData'. These are the types actually present, not the types queried with 'GI.WebKit2.Objects.WebsiteDataManager.websiteDataManagerFetch'. @since 2.16 -} websiteDataGetTypes :: (B.CallStack.HasCallStack, MonadIO m) => WebsiteData {- ^ /@websiteData@/: a 'GI.WebKit2.Structs.WebsiteData.WebsiteData' -} -> m [WebKit2.Flags.WebsiteDataTypes] {- ^ __Returns:__ a bitmask of 'GI.WebKit2.Flags.WebsiteDataTypes' in /@websiteData@/ -} websiteDataGetTypes websiteData = liftIO $ do websiteData' <- unsafeManagedPtrGetPtr websiteData result <- webkit_website_data_get_types websiteData' let result' = wordToGFlags result touchManagedPtr websiteData return result' data WebsiteDataGetTypesMethodInfo instance (signature ~ (m [WebKit2.Flags.WebsiteDataTypes]), MonadIO m) => O.MethodInfo WebsiteDataGetTypesMethodInfo WebsiteData signature where overloadedMethod _ = websiteDataGetTypes -- method WebsiteData::ref -- method type : OrdinaryMethod -- Args : [Arg {argCName = "website_data", argType = TInterface (Name {namespace = "WebKit2", name = "WebsiteData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitWebsiteData", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "WebsiteData"})) -- throws : False -- Skip return : False foreign import ccall "webkit_website_data_ref" webkit_website_data_ref :: Ptr WebsiteData -> -- website_data : TInterface (Name {namespace = "WebKit2", name = "WebsiteData"}) IO (Ptr WebsiteData) {- | Atomically increments the reference count of /@websiteData@/ by one. This function is MT-safe and may be called from any thread. @since 2.16 -} websiteDataRef :: (B.CallStack.HasCallStack, MonadIO m) => WebsiteData {- ^ /@websiteData@/: a 'GI.WebKit2.Structs.WebsiteData.WebsiteData' -} -> m WebsiteData {- ^ __Returns:__ The passed 'GI.WebKit2.Structs.WebsiteData.WebsiteData' -} websiteDataRef websiteData = liftIO $ do websiteData' <- unsafeManagedPtrGetPtr websiteData result <- webkit_website_data_ref websiteData' checkUnexpectedReturnNULL "websiteDataRef" result result' <- (wrapBoxed WebsiteData) result touchManagedPtr websiteData return result' data WebsiteDataRefMethodInfo instance (signature ~ (m WebsiteData), MonadIO m) => O.MethodInfo WebsiteDataRefMethodInfo WebsiteData signature where overloadedMethod _ = websiteDataRef -- method WebsiteData::unref -- method type : OrdinaryMethod -- Args : [Arg {argCName = "website_data", argType = TInterface (Name {namespace = "WebKit2", name = "WebsiteData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitWebsiteData", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "webkit_website_data_unref" webkit_website_data_unref :: Ptr WebsiteData -> -- website_data : TInterface (Name {namespace = "WebKit2", name = "WebsiteData"}) IO () {- | Atomically decrements the reference count of /@websiteData@/ by one. If the reference count drops to 0, all memory allocated by 'GI.WebKit2.Structs.WebsiteData.WebsiteData' is released. This function is MT-safe and may be called from any thread. @since 2.16 -} websiteDataUnref :: (B.CallStack.HasCallStack, MonadIO m) => WebsiteData {- ^ /@websiteData@/: A 'GI.WebKit2.Structs.WebsiteData.WebsiteData' -} -> m () websiteDataUnref websiteData = liftIO $ do websiteData' <- unsafeManagedPtrGetPtr websiteData webkit_website_data_unref websiteData' touchManagedPtr websiteData return () data WebsiteDataUnrefMethodInfo instance (signature ~ (m ()), MonadIO m) => O.MethodInfo WebsiteDataUnrefMethodInfo WebsiteData signature where overloadedMethod _ = websiteDataUnref type family ResolveWebsiteDataMethod (t :: Symbol) (o :: *) :: * where ResolveWebsiteDataMethod "ref" o = WebsiteDataRefMethodInfo ResolveWebsiteDataMethod "unref" o = WebsiteDataUnrefMethodInfo ResolveWebsiteDataMethod "getName" o = WebsiteDataGetNameMethodInfo ResolveWebsiteDataMethod "getSize" o = WebsiteDataGetSizeMethodInfo ResolveWebsiteDataMethod "getTypes" o = WebsiteDataGetTypesMethodInfo ResolveWebsiteDataMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveWebsiteDataMethod t WebsiteData, O.MethodInfo info WebsiteData p) => O.IsLabelProxy t (WebsiteData -> p) where fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #if MIN_VERSION_base(4,9,0) instance (info ~ ResolveWebsiteDataMethod t WebsiteData, O.MethodInfo info WebsiteData p) => O.IsLabel t (WebsiteData -> p) where fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #endif