module GI.WebKit2.Objects.URIRequest
(
URIRequest(..) ,
URIRequestK ,
toURIRequest ,
noURIRequest ,
uRIRequestGetHttpHeaders ,
uRIRequestGetUri ,
uRIRequestNew ,
uRIRequestSetUri ,
URIRequestUriPropertyInfo ,
constructURIRequestUri ,
getURIRequestUri ,
setURIRequestUri ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.WebKit2.Types
import GI.WebKit2.Callbacks
import qualified GI.GObject as GObject
import qualified GI.Soup as Soup
newtype URIRequest = URIRequest (ForeignPtr URIRequest)
foreign import ccall "webkit_uri_request_get_type"
c_webkit_uri_request_get_type :: IO GType
type instance ParentTypes URIRequest = URIRequestParentTypes
type URIRequestParentTypes = '[GObject.Object]
instance GObject URIRequest where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_webkit_uri_request_get_type
class GObject o => URIRequestK o
instance (GObject o, IsDescendantOf URIRequest o) => URIRequestK o
toURIRequest :: URIRequestK o => o -> IO URIRequest
toURIRequest = unsafeCastTo URIRequest
noURIRequest :: Maybe URIRequest
noURIRequest = Nothing
getURIRequestUri :: (MonadIO m, URIRequestK o) => o -> m T.Text
getURIRequestUri obj = liftIO $ getObjectPropertyString obj "uri"
setURIRequestUri :: (MonadIO m, URIRequestK o) => o -> T.Text -> m ()
setURIRequestUri obj val = liftIO $ setObjectPropertyString obj "uri" val
constructURIRequestUri :: T.Text -> IO ([Char], GValue)
constructURIRequestUri val = constructObjectPropertyString "uri" val
data URIRequestUriPropertyInfo
instance AttrInfo URIRequestUriPropertyInfo where
type AttrAllowedOps URIRequestUriPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint URIRequestUriPropertyInfo = (~) T.Text
type AttrBaseTypeConstraint URIRequestUriPropertyInfo = URIRequestK
type AttrGetType URIRequestUriPropertyInfo = T.Text
type AttrLabel URIRequestUriPropertyInfo = "URIRequest::uri"
attrGet _ = getURIRequestUri
attrSet _ = setURIRequestUri
attrConstruct _ = constructURIRequestUri
type instance AttributeList URIRequest = URIRequestAttributeList
type URIRequestAttributeList = ('[ '("uri", URIRequestUriPropertyInfo)] :: [(Symbol, *)])
type instance SignalList URIRequest = URIRequestSignalList
type URIRequestSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
foreign import ccall "webkit_uri_request_new" webkit_uri_request_new ::
CString ->
IO (Ptr URIRequest)
uRIRequestNew ::
(MonadIO m) =>
T.Text ->
m URIRequest
uRIRequestNew uri = liftIO $ do
uri' <- textToCString uri
result <- webkit_uri_request_new uri'
checkUnexpectedReturnNULL "webkit_uri_request_new" result
result' <- (wrapObject URIRequest) result
freeMem uri'
return result'
foreign import ccall "webkit_uri_request_get_http_headers" webkit_uri_request_get_http_headers ::
Ptr URIRequest ->
IO (Ptr Soup.MessageHeaders)
uRIRequestGetHttpHeaders ::
(MonadIO m, URIRequestK a) =>
a ->
m Soup.MessageHeaders
uRIRequestGetHttpHeaders _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_uri_request_get_http_headers _obj'
checkUnexpectedReturnNULL "webkit_uri_request_get_http_headers" result
result' <- (newBoxed Soup.MessageHeaders) result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_uri_request_get_uri" webkit_uri_request_get_uri ::
Ptr URIRequest ->
IO CString
uRIRequestGetUri ::
(MonadIO m, URIRequestK a) =>
a ->
m T.Text
uRIRequestGetUri _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_uri_request_get_uri _obj'
checkUnexpectedReturnNULL "webkit_uri_request_get_uri" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_uri_request_set_uri" webkit_uri_request_set_uri ::
Ptr URIRequest ->
CString ->
IO ()
uRIRequestSetUri ::
(MonadIO m, URIRequestK a) =>
a ->
T.Text ->
m ()
uRIRequestSetUri _obj uri = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
uri' <- textToCString uri
webkit_uri_request_set_uri _obj' uri'
touchManagedPtr _obj
freeMem uri'
return ()