{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Soup.Objects.CookieJarText
(
CookieJarText(..) ,
IsCookieJarText ,
toCookieJarText ,
#if defined(ENABLE_OVERLOADING)
ResolveCookieJarTextMethod ,
#endif
cookieJarTextNew ,
#if defined(ENABLE_OVERLOADING)
CookieJarTextFilenamePropertyInfo ,
#endif
constructCookieJarTextFilename ,
#if defined(ENABLE_OVERLOADING)
cookieJarTextFilename ,
#endif
getCookieJarTextFilename ,
) 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.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.Soup.Interfaces.SessionFeature as Soup.SessionFeature
import {-# SOURCE #-} qualified GI.Soup.Objects.CookieJar as Soup.CookieJar
newtype CookieJarText = CookieJarText (SP.ManagedPtr CookieJarText)
deriving (CookieJarText -> CookieJarText -> Bool
(CookieJarText -> CookieJarText -> Bool)
-> (CookieJarText -> CookieJarText -> Bool) -> Eq CookieJarText
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CookieJarText -> CookieJarText -> Bool
== :: CookieJarText -> CookieJarText -> Bool
$c/= :: CookieJarText -> CookieJarText -> Bool
/= :: CookieJarText -> CookieJarText -> Bool
Eq)
instance SP.ManagedPtrNewtype CookieJarText where
toManagedPtr :: CookieJarText -> ManagedPtr CookieJarText
toManagedPtr (CookieJarText ManagedPtr CookieJarText
p) = ManagedPtr CookieJarText
p
foreign import ccall "soup_cookie_jar_text_get_type"
c_soup_cookie_jar_text_get_type :: IO B.Types.GType
instance B.Types.TypedObject CookieJarText where
glibType :: IO GType
glibType = IO GType
c_soup_cookie_jar_text_get_type
instance B.Types.GObject CookieJarText
class (SP.GObject o, O.IsDescendantOf CookieJarText o) => IsCookieJarText o
instance (SP.GObject o, O.IsDescendantOf CookieJarText o) => IsCookieJarText o
instance O.HasParentTypes CookieJarText
type instance O.ParentTypes CookieJarText = '[Soup.CookieJar.CookieJar, GObject.Object.Object, Soup.SessionFeature.SessionFeature]
toCookieJarText :: (MIO.MonadIO m, IsCookieJarText o) => o -> m CookieJarText
toCookieJarText :: forall (m :: * -> *) o.
(MonadIO m, IsCookieJarText o) =>
o -> m CookieJarText
toCookieJarText = IO CookieJarText -> m CookieJarText
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO CookieJarText -> m CookieJarText)
-> (o -> IO CookieJarText) -> o -> m CookieJarText
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr CookieJarText -> CookieJarText)
-> o -> IO CookieJarText
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr CookieJarText -> CookieJarText
CookieJarText
instance B.GValue.IsGValue (Maybe CookieJarText) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_soup_cookie_jar_text_get_type
gvalueSet_ :: Ptr GValue -> Maybe CookieJarText -> IO ()
gvalueSet_ Ptr GValue
gv Maybe CookieJarText
P.Nothing = Ptr GValue -> Ptr CookieJarText -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr CookieJarText
forall a. Ptr a
FP.nullPtr :: FP.Ptr CookieJarText)
gvalueSet_ Ptr GValue
gv (P.Just CookieJarText
obj) = CookieJarText -> (Ptr CookieJarText -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr CookieJarText
obj (Ptr GValue -> Ptr CookieJarText -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe CookieJarText)
gvalueGet_ Ptr GValue
gv = do
Ptr CookieJarText
ptr <- Ptr GValue -> IO (Ptr CookieJarText)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr CookieJarText)
if Ptr CookieJarText
ptr Ptr CookieJarText -> Ptr CookieJarText -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr CookieJarText
forall a. Ptr a
FP.nullPtr
then CookieJarText -> Maybe CookieJarText
forall a. a -> Maybe a
P.Just (CookieJarText -> Maybe CookieJarText)
-> IO CookieJarText -> IO (Maybe CookieJarText)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr CookieJarText -> CookieJarText)
-> Ptr CookieJarText -> IO CookieJarText
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr CookieJarText -> CookieJarText
CookieJarText Ptr CookieJarText
ptr
else Maybe CookieJarText -> IO (Maybe CookieJarText)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe CookieJarText
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveCookieJarTextMethod (t :: Symbol) (o :: *) :: * where
ResolveCookieJarTextMethod "addCookie" o = Soup.CookieJar.CookieJarAddCookieMethodInfo
ResolveCookieJarTextMethod "addCookieFull" o = Soup.CookieJar.CookieJarAddCookieFullMethodInfo
ResolveCookieJarTextMethod "addCookieWithFirstParty" o = Soup.CookieJar.CookieJarAddCookieWithFirstPartyMethodInfo
ResolveCookieJarTextMethod "addFeature" o = Soup.SessionFeature.SessionFeatureAddFeatureMethodInfo
ResolveCookieJarTextMethod "allCookies" o = Soup.CookieJar.CookieJarAllCookiesMethodInfo
ResolveCookieJarTextMethod "attach" o = Soup.SessionFeature.SessionFeatureAttachMethodInfo
ResolveCookieJarTextMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveCookieJarTextMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveCookieJarTextMethod "deleteCookie" o = Soup.CookieJar.CookieJarDeleteCookieMethodInfo
ResolveCookieJarTextMethod "detach" o = Soup.SessionFeature.SessionFeatureDetachMethodInfo
ResolveCookieJarTextMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveCookieJarTextMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveCookieJarTextMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveCookieJarTextMethod "hasFeature" o = Soup.SessionFeature.SessionFeatureHasFeatureMethodInfo
ResolveCookieJarTextMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveCookieJarTextMethod "isPersistent" o = Soup.CookieJar.CookieJarIsPersistentMethodInfo
ResolveCookieJarTextMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveCookieJarTextMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveCookieJarTextMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveCookieJarTextMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveCookieJarTextMethod "removeFeature" o = Soup.SessionFeature.SessionFeatureRemoveFeatureMethodInfo
ResolveCookieJarTextMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveCookieJarTextMethod "save" o = Soup.CookieJar.CookieJarSaveMethodInfo
ResolveCookieJarTextMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveCookieJarTextMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveCookieJarTextMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveCookieJarTextMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveCookieJarTextMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveCookieJarTextMethod "getAcceptPolicy" o = Soup.CookieJar.CookieJarGetAcceptPolicyMethodInfo
ResolveCookieJarTextMethod "getCookieList" o = Soup.CookieJar.CookieJarGetCookieListMethodInfo
ResolveCookieJarTextMethod "getCookieListWithSameSiteInfo" o = Soup.CookieJar.CookieJarGetCookieListWithSameSiteInfoMethodInfo
ResolveCookieJarTextMethod "getCookies" o = Soup.CookieJar.CookieJarGetCookiesMethodInfo
ResolveCookieJarTextMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveCookieJarTextMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveCookieJarTextMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveCookieJarTextMethod "setAcceptPolicy" o = Soup.CookieJar.CookieJarSetAcceptPolicyMethodInfo
ResolveCookieJarTextMethod "setCookie" o = Soup.CookieJar.CookieJarSetCookieMethodInfo
ResolveCookieJarTextMethod "setCookieWithFirstParty" o = Soup.CookieJar.CookieJarSetCookieWithFirstPartyMethodInfo
ResolveCookieJarTextMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveCookieJarTextMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveCookieJarTextMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveCookieJarTextMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveCookieJarTextMethod t CookieJarText, O.OverloadedMethod info CookieJarText p) => OL.IsLabel t (CookieJarText -> 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 ~ ResolveCookieJarTextMethod t CookieJarText, O.OverloadedMethod info CookieJarText p, R.HasField t CookieJarText p) => R.HasField t CookieJarText p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveCookieJarTextMethod t CookieJarText, O.OverloadedMethodInfo info CookieJarText) => OL.IsLabel t (O.MethodProxy info CookieJarText) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
getCookieJarTextFilename :: (MonadIO m, IsCookieJarText o) => o -> m (Maybe T.Text)
getCookieJarTextFilename :: forall (m :: * -> *) o.
(MonadIO m, IsCookieJarText o) =>
o -> m (Maybe Text)
getCookieJarTextFilename o
obj = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
B.Properties.getObjectPropertyString o
obj String
"filename"
constructCookieJarTextFilename :: (IsCookieJarText o, MIO.MonadIO m) => T.Text -> m (GValueConstruct o)
constructCookieJarTextFilename :: forall o (m :: * -> *).
(IsCookieJarText o, MonadIO m) =>
Text -> m (GValueConstruct o)
constructCookieJarTextFilename Text
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyString String
"filename" (Text -> Maybe Text
forall a. a -> Maybe a
P.Just Text
val)
#if defined(ENABLE_OVERLOADING)
data CookieJarTextFilenamePropertyInfo
instance AttrInfo CookieJarTextFilenamePropertyInfo where
type AttrAllowedOps CookieJarTextFilenamePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint CookieJarTextFilenamePropertyInfo = IsCookieJarText
type AttrSetTypeConstraint CookieJarTextFilenamePropertyInfo = (~) T.Text
type AttrTransferTypeConstraint CookieJarTextFilenamePropertyInfo = (~) T.Text
type AttrTransferType CookieJarTextFilenamePropertyInfo = T.Text
type AttrGetType CookieJarTextFilenamePropertyInfo = (Maybe T.Text)
type AttrLabel CookieJarTextFilenamePropertyInfo = "filename"
type AttrOrigin CookieJarTextFilenamePropertyInfo = CookieJarText
attrGet = getCookieJarTextFilename
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructCookieJarTextFilename
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.CookieJarText.filename"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-CookieJarText.html#g:attr:filename"
})
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList CookieJarText
type instance O.AttributeList CookieJarText = CookieJarTextAttributeList
type CookieJarTextAttributeList = ('[ '("acceptPolicy", Soup.CookieJar.CookieJarAcceptPolicyPropertyInfo), '("filename", CookieJarTextFilenamePropertyInfo), '("readOnly", Soup.CookieJar.CookieJarReadOnlyPropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
cookieJarTextFilename :: AttrLabelProxy "filename"
cookieJarTextFilename = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList CookieJarText = CookieJarTextSignalList
type CookieJarTextSignalList = ('[ '("changed", Soup.CookieJar.CookieJarChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "soup_cookie_jar_text_new" soup_cookie_jar_text_new ::
CString ->
CInt ->
IO (Ptr CookieJarText)
cookieJarTextNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> Bool
-> m CookieJarText
cookieJarTextNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Bool -> m CookieJarText
cookieJarTextNew Text
filename Bool
readOnly = IO CookieJarText -> m CookieJarText
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CookieJarText -> m CookieJarText)
-> IO CookieJarText -> m CookieJarText
forall a b. (a -> b) -> a -> b
$ do
CString
filename' <- Text -> IO CString
textToCString Text
filename
let readOnly' :: CInt
readOnly' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
readOnly
Ptr CookieJarText
result <- CString -> CInt -> IO (Ptr CookieJarText)
soup_cookie_jar_text_new CString
filename' CInt
readOnly'
Text -> Ptr CookieJarText -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"cookieJarTextNew" Ptr CookieJarText
result
CookieJarText
result' <- ((ManagedPtr CookieJarText -> CookieJarText)
-> Ptr CookieJarText -> IO CookieJarText
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr CookieJarText -> CookieJarText
CookieJarText) Ptr CookieJarText
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
filename'
CookieJarText -> IO CookieJarText
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CookieJarText
result'
#if defined(ENABLE_OVERLOADING)
#endif