module GI.Soup.Structs.Cookie
(
Cookie(..) ,
newZeroCookie ,
noCookie ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieAppliesToUriMethodInfo ,
#endif
cookieAppliesToUri ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieCopyMethodInfo ,
#endif
cookieCopy ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieDomainMatchesMethodInfo ,
#endif
cookieDomainMatches ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieEqualMethodInfo ,
#endif
cookieEqual ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieFreeMethodInfo ,
#endif
cookieFree ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieGetDomainMethodInfo ,
#endif
cookieGetDomain ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieGetExpiresMethodInfo ,
#endif
cookieGetExpires ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieGetHttpOnlyMethodInfo ,
#endif
cookieGetHttpOnly ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieGetNameMethodInfo ,
#endif
cookieGetName ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieGetPathMethodInfo ,
#endif
cookieGetPath ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieGetSecureMethodInfo ,
#endif
cookieGetSecure ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieGetValueMethodInfo ,
#endif
cookieGetValue ,
cookieNew ,
cookieParse ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieSetDomainMethodInfo ,
#endif
cookieSetDomain ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieSetExpiresMethodInfo ,
#endif
cookieSetExpires ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieSetHttpOnlyMethodInfo ,
#endif
cookieSetHttpOnly ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieSetMaxAgeMethodInfo ,
#endif
cookieSetMaxAge ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieSetNameMethodInfo ,
#endif
cookieSetName ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieSetPathMethodInfo ,
#endif
cookieSetPath ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieSetSecureMethodInfo ,
#endif
cookieSetSecure ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieSetValueMethodInfo ,
#endif
cookieSetValue ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieToCookieHeaderMethodInfo ,
#endif
cookieToCookieHeader ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
CookieToSetCookieHeaderMethodInfo ,
#endif
cookieToSetCookieHeader ,
clearCookieDomain ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
cookie_domain ,
#endif
getCookieDomain ,
setCookieDomain ,
clearCookieExpires ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
cookie_expires ,
#endif
getCookieExpires ,
setCookieExpires ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
cookie_httpOnly ,
#endif
getCookieHttpOnly ,
setCookieHttpOnly ,
clearCookieName ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
cookie_name ,
#endif
getCookieName ,
setCookieName ,
clearCookiePath ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
cookie_path ,
#endif
getCookiePath ,
setCookiePath ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
cookie_secure ,
#endif
getCookieSecure ,
setCookieSecure ,
clearCookieValue ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
cookie_value ,
#endif
getCookieValue ,
setCookieValue ,
) 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 qualified GI.Soup.Structs.Date as Soup.Date
import qualified GI.Soup.Structs.URI as Soup.URI
newtype Cookie = Cookie (ManagedPtr Cookie)
foreign import ccall "soup_cookie_get_type" c_soup_cookie_get_type ::
IO GType
instance BoxedObject Cookie where
boxedType _ = c_soup_cookie_get_type
newZeroCookie :: MonadIO m => m Cookie
newZeroCookie = liftIO $ callocBoxedBytes 48 >>= wrapBoxed Cookie
instance tag ~ 'AttrSet => Constructible Cookie tag where
new _ attrs = do
o <- newZeroCookie
GI.Attributes.set o attrs
return o
noCookie :: Maybe Cookie
noCookie = Nothing
getCookieName :: MonadIO m => Cookie -> m (Maybe T.Text)
getCookieName s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
setCookieName :: MonadIO m => Cookie -> CString -> m ()
setCookieName s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (val :: CString)
clearCookieName :: MonadIO m => Cookie -> m ()
clearCookieName s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (FP.nullPtr :: CString)
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieNameFieldInfo
instance AttrInfo CookieNameFieldInfo where
type AttrAllowedOps CookieNameFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint CookieNameFieldInfo = (~) CString
type AttrBaseTypeConstraint CookieNameFieldInfo = (~) Cookie
type AttrGetType CookieNameFieldInfo = Maybe T.Text
type AttrLabel CookieNameFieldInfo = "name"
type AttrOrigin CookieNameFieldInfo = Cookie
attrGet _ = getCookieName
attrSet _ = setCookieName
attrConstruct = undefined
attrClear _ = clearCookieName
cookie_name :: AttrLabelProxy "name"
cookie_name = AttrLabelProxy
#endif
getCookieValue :: MonadIO m => Cookie -> m (Maybe T.Text)
getCookieValue s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
setCookieValue :: MonadIO m => Cookie -> CString -> m ()
setCookieValue s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: CString)
clearCookieValue :: MonadIO m => Cookie -> m ()
clearCookieValue s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (FP.nullPtr :: CString)
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieValueFieldInfo
instance AttrInfo CookieValueFieldInfo where
type AttrAllowedOps CookieValueFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint CookieValueFieldInfo = (~) CString
type AttrBaseTypeConstraint CookieValueFieldInfo = (~) Cookie
type AttrGetType CookieValueFieldInfo = Maybe T.Text
type AttrLabel CookieValueFieldInfo = "value"
type AttrOrigin CookieValueFieldInfo = Cookie
attrGet _ = getCookieValue
attrSet _ = setCookieValue
attrConstruct = undefined
attrClear _ = clearCookieValue
cookie_value :: AttrLabelProxy "value"
cookie_value = AttrLabelProxy
#endif
getCookieDomain :: MonadIO m => Cookie -> m (Maybe T.Text)
getCookieDomain s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
setCookieDomain :: MonadIO m => Cookie -> CString -> m ()
setCookieDomain s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 16) (val :: CString)
clearCookieDomain :: MonadIO m => Cookie -> m ()
clearCookieDomain s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 16) (FP.nullPtr :: CString)
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieDomainFieldInfo
instance AttrInfo CookieDomainFieldInfo where
type AttrAllowedOps CookieDomainFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint CookieDomainFieldInfo = (~) CString
type AttrBaseTypeConstraint CookieDomainFieldInfo = (~) Cookie
type AttrGetType CookieDomainFieldInfo = Maybe T.Text
type AttrLabel CookieDomainFieldInfo = "domain"
type AttrOrigin CookieDomainFieldInfo = Cookie
attrGet _ = getCookieDomain
attrSet _ = setCookieDomain
attrConstruct = undefined
attrClear _ = clearCookieDomain
cookie_domain :: AttrLabelProxy "domain"
cookie_domain = AttrLabelProxy
#endif
getCookiePath :: MonadIO m => Cookie -> m (Maybe T.Text)
getCookiePath s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
setCookiePath :: MonadIO m => Cookie -> CString -> m ()
setCookiePath s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 24) (val :: CString)
clearCookiePath :: MonadIO m => Cookie -> m ()
clearCookiePath s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 24) (FP.nullPtr :: CString)
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookiePathFieldInfo
instance AttrInfo CookiePathFieldInfo where
type AttrAllowedOps CookiePathFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint CookiePathFieldInfo = (~) CString
type AttrBaseTypeConstraint CookiePathFieldInfo = (~) Cookie
type AttrGetType CookiePathFieldInfo = Maybe T.Text
type AttrLabel CookiePathFieldInfo = "path"
type AttrOrigin CookiePathFieldInfo = Cookie
attrGet _ = getCookiePath
attrSet _ = setCookiePath
attrConstruct = undefined
attrClear _ = clearCookiePath
cookie_path :: AttrLabelProxy "path"
cookie_path = AttrLabelProxy
#endif
getCookieExpires :: MonadIO m => Cookie -> m (Maybe Soup.Date.Date)
getCookieExpires s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 32) :: IO (Ptr Soup.Date.Date)
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- (newBoxed Soup.Date.Date) val'
return val''
return result
setCookieExpires :: MonadIO m => Cookie -> Ptr Soup.Date.Date -> m ()
setCookieExpires s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 32) (val :: Ptr Soup.Date.Date)
clearCookieExpires :: MonadIO m => Cookie -> m ()
clearCookieExpires s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 32) (FP.nullPtr :: Ptr Soup.Date.Date)
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieExpiresFieldInfo
instance AttrInfo CookieExpiresFieldInfo where
type AttrAllowedOps CookieExpiresFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint CookieExpiresFieldInfo = (~) (Ptr Soup.Date.Date)
type AttrBaseTypeConstraint CookieExpiresFieldInfo = (~) Cookie
type AttrGetType CookieExpiresFieldInfo = Maybe Soup.Date.Date
type AttrLabel CookieExpiresFieldInfo = "expires"
type AttrOrigin CookieExpiresFieldInfo = Cookie
attrGet _ = getCookieExpires
attrSet _ = setCookieExpires
attrConstruct = undefined
attrClear _ = clearCookieExpires
cookie_expires :: AttrLabelProxy "expires"
cookie_expires = AttrLabelProxy
#endif
getCookieSecure :: MonadIO m => Cookie -> m Bool
getCookieSecure s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 40) :: IO CInt
let val' = (/= 0) val
return val'
setCookieSecure :: MonadIO m => Cookie -> Bool -> m ()
setCookieSecure s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = (fromIntegral . fromEnum) val
poke (ptr `plusPtr` 40) (val' :: CInt)
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieSecureFieldInfo
instance AttrInfo CookieSecureFieldInfo where
type AttrAllowedOps CookieSecureFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint CookieSecureFieldInfo = (~) Bool
type AttrBaseTypeConstraint CookieSecureFieldInfo = (~) Cookie
type AttrGetType CookieSecureFieldInfo = Bool
type AttrLabel CookieSecureFieldInfo = "secure"
type AttrOrigin CookieSecureFieldInfo = Cookie
attrGet _ = getCookieSecure
attrSet _ = setCookieSecure
attrConstruct = undefined
attrClear _ = undefined
cookie_secure :: AttrLabelProxy "secure"
cookie_secure = AttrLabelProxy
#endif
getCookieHttpOnly :: MonadIO m => Cookie -> m Bool
getCookieHttpOnly s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 44) :: IO CInt
let val' = (/= 0) val
return val'
setCookieHttpOnly :: MonadIO m => Cookie -> Bool -> m ()
setCookieHttpOnly s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = (fromIntegral . fromEnum) val
poke (ptr `plusPtr` 44) (val' :: CInt)
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieHttpOnlyFieldInfo
instance AttrInfo CookieHttpOnlyFieldInfo where
type AttrAllowedOps CookieHttpOnlyFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint CookieHttpOnlyFieldInfo = (~) Bool
type AttrBaseTypeConstraint CookieHttpOnlyFieldInfo = (~) Cookie
type AttrGetType CookieHttpOnlyFieldInfo = Bool
type AttrLabel CookieHttpOnlyFieldInfo = "http_only"
type AttrOrigin CookieHttpOnlyFieldInfo = Cookie
attrGet _ = getCookieHttpOnly
attrSet _ = setCookieHttpOnly
attrConstruct = undefined
attrClear _ = undefined
cookie_httpOnly :: AttrLabelProxy "httpOnly"
cookie_httpOnly = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
instance O.HasAttributeList Cookie
type instance O.AttributeList Cookie = CookieAttributeList
type CookieAttributeList = ('[ '("name", CookieNameFieldInfo), '("value", CookieValueFieldInfo), '("domain", CookieDomainFieldInfo), '("path", CookiePathFieldInfo), '("expires", CookieExpiresFieldInfo), '("secure", CookieSecureFieldInfo), '("httpOnly", CookieHttpOnlyFieldInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "soup_cookie_new" soup_cookie_new ::
CString ->
CString ->
CString ->
CString ->
Int32 ->
IO (Ptr Cookie)
cookieNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> T.Text
-> T.Text
-> T.Text
-> Int32
-> m Cookie
cookieNew name value domain path maxAge = liftIO $ do
name' <- textToCString name
value' <- textToCString value
domain' <- textToCString domain
path' <- textToCString path
result <- soup_cookie_new name' value' domain' path' maxAge
checkUnexpectedReturnNULL "cookieNew" result
result' <- (wrapBoxed Cookie) result
freeMem name'
freeMem value'
freeMem domain'
freeMem path'
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif
foreign import ccall "soup_cookie_applies_to_uri" soup_cookie_applies_to_uri ::
Ptr Cookie ->
Ptr Soup.URI.URI ->
IO CInt
cookieAppliesToUri ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> Soup.URI.URI
-> m Bool
cookieAppliesToUri cookie uri = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
uri' <- unsafeManagedPtrGetPtr uri
result <- soup_cookie_applies_to_uri cookie' uri'
let result' = (/= 0) result
touchManagedPtr cookie
touchManagedPtr uri
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieAppliesToUriMethodInfo
instance (signature ~ (Soup.URI.URI -> m Bool), MonadIO m) => O.MethodInfo CookieAppliesToUriMethodInfo Cookie signature where
overloadedMethod _ = cookieAppliesToUri
#endif
foreign import ccall "soup_cookie_copy" soup_cookie_copy ::
Ptr Cookie ->
IO (Ptr Cookie)
cookieCopy ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> m Cookie
cookieCopy cookie = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
result <- soup_cookie_copy cookie'
checkUnexpectedReturnNULL "cookieCopy" result
result' <- (wrapBoxed Cookie) result
touchManagedPtr cookie
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieCopyMethodInfo
instance (signature ~ (m Cookie), MonadIO m) => O.MethodInfo CookieCopyMethodInfo Cookie signature where
overloadedMethod _ = cookieCopy
#endif
foreign import ccall "soup_cookie_domain_matches" soup_cookie_domain_matches ::
Ptr Cookie ->
CString ->
IO CInt
cookieDomainMatches ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> T.Text
-> m Bool
cookieDomainMatches cookie host = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
host' <- textToCString host
result <- soup_cookie_domain_matches cookie' host'
let result' = (/= 0) result
touchManagedPtr cookie
freeMem host'
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieDomainMatchesMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo CookieDomainMatchesMethodInfo Cookie signature where
overloadedMethod _ = cookieDomainMatches
#endif
foreign import ccall "soup_cookie_equal" soup_cookie_equal ::
Ptr Cookie ->
Ptr Cookie ->
IO CInt
cookieEqual ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> Cookie
-> m Bool
cookieEqual cookie1 cookie2 = liftIO $ do
cookie1' <- unsafeManagedPtrGetPtr cookie1
cookie2' <- unsafeManagedPtrGetPtr cookie2
result <- soup_cookie_equal cookie1' cookie2'
let result' = (/= 0) result
touchManagedPtr cookie1
touchManagedPtr cookie2
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieEqualMethodInfo
instance (signature ~ (Cookie -> m Bool), MonadIO m) => O.MethodInfo CookieEqualMethodInfo Cookie signature where
overloadedMethod _ = cookieEqual
#endif
foreign import ccall "soup_cookie_free" soup_cookie_free ::
Ptr Cookie ->
IO ()
cookieFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> m ()
cookieFree cookie = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
soup_cookie_free cookie'
touchManagedPtr cookie
return ()
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo CookieFreeMethodInfo Cookie signature where
overloadedMethod _ = cookieFree
#endif
foreign import ccall "soup_cookie_get_domain" soup_cookie_get_domain ::
Ptr Cookie ->
IO CString
cookieGetDomain ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> m T.Text
cookieGetDomain cookie = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
result <- soup_cookie_get_domain cookie'
checkUnexpectedReturnNULL "cookieGetDomain" result
result' <- cstringToText result
touchManagedPtr cookie
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieGetDomainMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo CookieGetDomainMethodInfo Cookie signature where
overloadedMethod _ = cookieGetDomain
#endif
foreign import ccall "soup_cookie_get_expires" soup_cookie_get_expires ::
Ptr Cookie ->
IO (Ptr Soup.Date.Date)
cookieGetExpires ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> m Soup.Date.Date
cookieGetExpires cookie = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
result <- soup_cookie_get_expires cookie'
checkUnexpectedReturnNULL "cookieGetExpires" result
result' <- (newBoxed Soup.Date.Date) result
touchManagedPtr cookie
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieGetExpiresMethodInfo
instance (signature ~ (m Soup.Date.Date), MonadIO m) => O.MethodInfo CookieGetExpiresMethodInfo Cookie signature where
overloadedMethod _ = cookieGetExpires
#endif
foreign import ccall "soup_cookie_get_http_only" soup_cookie_get_http_only ::
Ptr Cookie ->
IO CInt
cookieGetHttpOnly ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> m Bool
cookieGetHttpOnly cookie = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
result <- soup_cookie_get_http_only cookie'
let result' = (/= 0) result
touchManagedPtr cookie
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieGetHttpOnlyMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo CookieGetHttpOnlyMethodInfo Cookie signature where
overloadedMethod _ = cookieGetHttpOnly
#endif
foreign import ccall "soup_cookie_get_name" soup_cookie_get_name ::
Ptr Cookie ->
IO CString
cookieGetName ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> m T.Text
cookieGetName cookie = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
result <- soup_cookie_get_name cookie'
checkUnexpectedReturnNULL "cookieGetName" result
result' <- cstringToText result
touchManagedPtr cookie
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo CookieGetNameMethodInfo Cookie signature where
overloadedMethod _ = cookieGetName
#endif
foreign import ccall "soup_cookie_get_path" soup_cookie_get_path ::
Ptr Cookie ->
IO CString
cookieGetPath ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> m T.Text
cookieGetPath cookie = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
result <- soup_cookie_get_path cookie'
checkUnexpectedReturnNULL "cookieGetPath" result
result' <- cstringToText result
touchManagedPtr cookie
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieGetPathMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo CookieGetPathMethodInfo Cookie signature where
overloadedMethod _ = cookieGetPath
#endif
foreign import ccall "soup_cookie_get_secure" soup_cookie_get_secure ::
Ptr Cookie ->
IO CInt
cookieGetSecure ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> m Bool
cookieGetSecure cookie = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
result <- soup_cookie_get_secure cookie'
let result' = (/= 0) result
touchManagedPtr cookie
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieGetSecureMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo CookieGetSecureMethodInfo Cookie signature where
overloadedMethod _ = cookieGetSecure
#endif
foreign import ccall "soup_cookie_get_value" soup_cookie_get_value ::
Ptr Cookie ->
IO CString
cookieGetValue ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> m T.Text
cookieGetValue cookie = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
result <- soup_cookie_get_value cookie'
checkUnexpectedReturnNULL "cookieGetValue" result
result' <- cstringToText result
touchManagedPtr cookie
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieGetValueMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo CookieGetValueMethodInfo Cookie signature where
overloadedMethod _ = cookieGetValue
#endif
foreign import ccall "soup_cookie_set_domain" soup_cookie_set_domain ::
Ptr Cookie ->
CString ->
IO ()
cookieSetDomain ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> T.Text
-> m ()
cookieSetDomain cookie domain = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
domain' <- textToCString domain
soup_cookie_set_domain cookie' domain'
touchManagedPtr cookie
freeMem domain'
return ()
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieSetDomainMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo CookieSetDomainMethodInfo Cookie signature where
overloadedMethod _ = cookieSetDomain
#endif
foreign import ccall "soup_cookie_set_expires" soup_cookie_set_expires ::
Ptr Cookie ->
Ptr Soup.Date.Date ->
IO ()
cookieSetExpires ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> Soup.Date.Date
-> m ()
cookieSetExpires cookie expires = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
expires' <- unsafeManagedPtrGetPtr expires
soup_cookie_set_expires cookie' expires'
touchManagedPtr cookie
touchManagedPtr expires
return ()
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieSetExpiresMethodInfo
instance (signature ~ (Soup.Date.Date -> m ()), MonadIO m) => O.MethodInfo CookieSetExpiresMethodInfo Cookie signature where
overloadedMethod _ = cookieSetExpires
#endif
foreign import ccall "soup_cookie_set_http_only" soup_cookie_set_http_only ::
Ptr Cookie ->
CInt ->
IO ()
cookieSetHttpOnly ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> Bool
-> m ()
cookieSetHttpOnly cookie httpOnly = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
let httpOnly' = (fromIntegral . fromEnum) httpOnly
soup_cookie_set_http_only cookie' httpOnly'
touchManagedPtr cookie
return ()
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieSetHttpOnlyMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m) => O.MethodInfo CookieSetHttpOnlyMethodInfo Cookie signature where
overloadedMethod _ = cookieSetHttpOnly
#endif
foreign import ccall "soup_cookie_set_max_age" soup_cookie_set_max_age ::
Ptr Cookie ->
Int32 ->
IO ()
cookieSetMaxAge ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> Int32
-> m ()
cookieSetMaxAge cookie maxAge = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
soup_cookie_set_max_age cookie' maxAge
touchManagedPtr cookie
return ()
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieSetMaxAgeMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m) => O.MethodInfo CookieSetMaxAgeMethodInfo Cookie signature where
overloadedMethod _ = cookieSetMaxAge
#endif
foreign import ccall "soup_cookie_set_name" soup_cookie_set_name ::
Ptr Cookie ->
CString ->
IO ()
cookieSetName ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> T.Text
-> m ()
cookieSetName cookie name = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
name' <- textToCString name
soup_cookie_set_name cookie' name'
touchManagedPtr cookie
freeMem name'
return ()
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieSetNameMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo CookieSetNameMethodInfo Cookie signature where
overloadedMethod _ = cookieSetName
#endif
foreign import ccall "soup_cookie_set_path" soup_cookie_set_path ::
Ptr Cookie ->
CString ->
IO ()
cookieSetPath ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> T.Text
-> m ()
cookieSetPath cookie path = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
path' <- textToCString path
soup_cookie_set_path cookie' path'
touchManagedPtr cookie
freeMem path'
return ()
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieSetPathMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo CookieSetPathMethodInfo Cookie signature where
overloadedMethod _ = cookieSetPath
#endif
foreign import ccall "soup_cookie_set_secure" soup_cookie_set_secure ::
Ptr Cookie ->
CInt ->
IO ()
cookieSetSecure ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> Bool
-> m ()
cookieSetSecure cookie secure = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
let secure' = (fromIntegral . fromEnum) secure
soup_cookie_set_secure cookie' secure'
touchManagedPtr cookie
return ()
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieSetSecureMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m) => O.MethodInfo CookieSetSecureMethodInfo Cookie signature where
overloadedMethod _ = cookieSetSecure
#endif
foreign import ccall "soup_cookie_set_value" soup_cookie_set_value ::
Ptr Cookie ->
CString ->
IO ()
cookieSetValue ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> T.Text
-> m ()
cookieSetValue cookie value = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
value' <- textToCString value
soup_cookie_set_value cookie' value'
touchManagedPtr cookie
freeMem value'
return ()
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieSetValueMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo CookieSetValueMethodInfo Cookie signature where
overloadedMethod _ = cookieSetValue
#endif
foreign import ccall "soup_cookie_to_cookie_header" soup_cookie_to_cookie_header ::
Ptr Cookie ->
IO CString
cookieToCookieHeader ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> m T.Text
cookieToCookieHeader cookie = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
result <- soup_cookie_to_cookie_header cookie'
checkUnexpectedReturnNULL "cookieToCookieHeader" result
result' <- cstringToText result
freeMem result
touchManagedPtr cookie
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieToCookieHeaderMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo CookieToCookieHeaderMethodInfo Cookie signature where
overloadedMethod _ = cookieToCookieHeader
#endif
foreign import ccall "soup_cookie_to_set_cookie_header" soup_cookie_to_set_cookie_header ::
Ptr Cookie ->
IO CString
cookieToSetCookieHeader ::
(B.CallStack.HasCallStack, MonadIO m) =>
Cookie
-> m T.Text
cookieToSetCookieHeader cookie = liftIO $ do
cookie' <- unsafeManagedPtrGetPtr cookie
result <- soup_cookie_to_set_cookie_header cookie'
checkUnexpectedReturnNULL "cookieToSetCookieHeader" result
result' <- cstringToText result
freeMem result
touchManagedPtr cookie
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data CookieToSetCookieHeaderMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo CookieToSetCookieHeaderMethodInfo Cookie signature where
overloadedMethod _ = cookieToSetCookieHeader
#endif
foreign import ccall "soup_cookie_parse" soup_cookie_parse ::
CString ->
Ptr Soup.URI.URI ->
IO (Ptr Cookie)
cookieParse ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> Soup.URI.URI
-> m (Maybe Cookie)
cookieParse header origin = liftIO $ do
header' <- textToCString header
origin' <- unsafeManagedPtrGetPtr origin
result <- soup_cookie_parse header' origin'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapBoxed Cookie) result'
return result''
touchManagedPtr origin
freeMem header'
return maybeResult
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type family ResolveCookieMethod (t :: Symbol) (o :: *) :: * where
ResolveCookieMethod "appliesToUri" o = CookieAppliesToUriMethodInfo
ResolveCookieMethod "copy" o = CookieCopyMethodInfo
ResolveCookieMethod "domainMatches" o = CookieDomainMatchesMethodInfo
ResolveCookieMethod "equal" o = CookieEqualMethodInfo
ResolveCookieMethod "free" o = CookieFreeMethodInfo
ResolveCookieMethod "toCookieHeader" o = CookieToCookieHeaderMethodInfo
ResolveCookieMethod "toSetCookieHeader" o = CookieToSetCookieHeaderMethodInfo
ResolveCookieMethod "getDomain" o = CookieGetDomainMethodInfo
ResolveCookieMethod "getExpires" o = CookieGetExpiresMethodInfo
ResolveCookieMethod "getHttpOnly" o = CookieGetHttpOnlyMethodInfo
ResolveCookieMethod "getName" o = CookieGetNameMethodInfo
ResolveCookieMethod "getPath" o = CookieGetPathMethodInfo
ResolveCookieMethod "getSecure" o = CookieGetSecureMethodInfo
ResolveCookieMethod "getValue" o = CookieGetValueMethodInfo
ResolveCookieMethod "setDomain" o = CookieSetDomainMethodInfo
ResolveCookieMethod "setExpires" o = CookieSetExpiresMethodInfo
ResolveCookieMethod "setHttpOnly" o = CookieSetHttpOnlyMethodInfo
ResolveCookieMethod "setMaxAge" o = CookieSetMaxAgeMethodInfo
ResolveCookieMethod "setName" o = CookieSetNameMethodInfo
ResolveCookieMethod "setPath" o = CookieSetPathMethodInfo
ResolveCookieMethod "setSecure" o = CookieSetSecureMethodInfo
ResolveCookieMethod "setValue" o = CookieSetValueMethodInfo
ResolveCookieMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveCookieMethod t Cookie, O.MethodInfo info Cookie p) => O.IsLabelProxy t (Cookie -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveCookieMethod t Cookie, O.MethodInfo info Cookie p) => O.IsLabel t (Cookie -> 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
#endif