module GI.WebKit.Objects.DOMAttr
(
DOMAttr(..) ,
DOMAttrK ,
toDOMAttr ,
noDOMAttr ,
dOMAttrGetIsId ,
dOMAttrGetName ,
dOMAttrGetOwnerElement ,
dOMAttrGetSpecified ,
dOMAttrGetValue ,
dOMAttrSetValue ,
DOMAttrIsIdPropertyInfo ,
getDOMAttrIsId ,
DOMAttrNamePropertyInfo ,
getDOMAttrName ,
DOMAttrOwnerElementPropertyInfo ,
getDOMAttrOwnerElement ,
DOMAttrSpecifiedPropertyInfo ,
getDOMAttrSpecified ,
DOMAttrValuePropertyInfo ,
constructDOMAttrValue ,
getDOMAttrValue ,
setDOMAttrValue ,
) 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.WebKit.Types
import GI.WebKit.Callbacks
import qualified GI.GObject as GObject
newtype DOMAttr = DOMAttr (ForeignPtr DOMAttr)
foreign import ccall "webkit_dom_attr_get_type"
c_webkit_dom_attr_get_type :: IO GType
type instance ParentTypes DOMAttr = DOMAttrParentTypes
type DOMAttrParentTypes = '[DOMNode, DOMObject, GObject.Object, DOMEventTarget]
instance GObject DOMAttr where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_webkit_dom_attr_get_type
class GObject o => DOMAttrK o
instance (GObject o, IsDescendantOf DOMAttr o) => DOMAttrK o
toDOMAttr :: DOMAttrK o => o -> IO DOMAttr
toDOMAttr = unsafeCastTo DOMAttr
noDOMAttr :: Maybe DOMAttr
noDOMAttr = Nothing
getDOMAttrIsId :: (MonadIO m, DOMAttrK o) => o -> m Bool
getDOMAttrIsId obj = liftIO $ getObjectPropertyBool obj "is-id"
data DOMAttrIsIdPropertyInfo
instance AttrInfo DOMAttrIsIdPropertyInfo where
type AttrAllowedOps DOMAttrIsIdPropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint DOMAttrIsIdPropertyInfo = (~) ()
type AttrBaseTypeConstraint DOMAttrIsIdPropertyInfo = DOMAttrK
type AttrGetType DOMAttrIsIdPropertyInfo = Bool
type AttrLabel DOMAttrIsIdPropertyInfo = "DOMAttr::is-id"
attrGet _ = getDOMAttrIsId
attrSet _ = undefined
attrConstruct _ = undefined
getDOMAttrName :: (MonadIO m, DOMAttrK o) => o -> m T.Text
getDOMAttrName obj = liftIO $ getObjectPropertyString obj "name"
data DOMAttrNamePropertyInfo
instance AttrInfo DOMAttrNamePropertyInfo where
type AttrAllowedOps DOMAttrNamePropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint DOMAttrNamePropertyInfo = (~) ()
type AttrBaseTypeConstraint DOMAttrNamePropertyInfo = DOMAttrK
type AttrGetType DOMAttrNamePropertyInfo = T.Text
type AttrLabel DOMAttrNamePropertyInfo = "DOMAttr::name"
attrGet _ = getDOMAttrName
attrSet _ = undefined
attrConstruct _ = undefined
getDOMAttrOwnerElement :: (MonadIO m, DOMAttrK o) => o -> m DOMElement
getDOMAttrOwnerElement obj = liftIO $ getObjectPropertyObject obj "owner-element" DOMElement
data DOMAttrOwnerElementPropertyInfo
instance AttrInfo DOMAttrOwnerElementPropertyInfo where
type AttrAllowedOps DOMAttrOwnerElementPropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint DOMAttrOwnerElementPropertyInfo = (~) ()
type AttrBaseTypeConstraint DOMAttrOwnerElementPropertyInfo = DOMAttrK
type AttrGetType DOMAttrOwnerElementPropertyInfo = DOMElement
type AttrLabel DOMAttrOwnerElementPropertyInfo = "DOMAttr::owner-element"
attrGet _ = getDOMAttrOwnerElement
attrSet _ = undefined
attrConstruct _ = undefined
getDOMAttrSpecified :: (MonadIO m, DOMAttrK o) => o -> m Bool
getDOMAttrSpecified obj = liftIO $ getObjectPropertyBool obj "specified"
data DOMAttrSpecifiedPropertyInfo
instance AttrInfo DOMAttrSpecifiedPropertyInfo where
type AttrAllowedOps DOMAttrSpecifiedPropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint DOMAttrSpecifiedPropertyInfo = (~) ()
type AttrBaseTypeConstraint DOMAttrSpecifiedPropertyInfo = DOMAttrK
type AttrGetType DOMAttrSpecifiedPropertyInfo = Bool
type AttrLabel DOMAttrSpecifiedPropertyInfo = "DOMAttr::specified"
attrGet _ = getDOMAttrSpecified
attrSet _ = undefined
attrConstruct _ = undefined
getDOMAttrValue :: (MonadIO m, DOMAttrK o) => o -> m T.Text
getDOMAttrValue obj = liftIO $ getObjectPropertyString obj "value"
setDOMAttrValue :: (MonadIO m, DOMAttrK o) => o -> T.Text -> m ()
setDOMAttrValue obj val = liftIO $ setObjectPropertyString obj "value" val
constructDOMAttrValue :: T.Text -> IO ([Char], GValue)
constructDOMAttrValue val = constructObjectPropertyString "value" val
data DOMAttrValuePropertyInfo
instance AttrInfo DOMAttrValuePropertyInfo where
type AttrAllowedOps DOMAttrValuePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint DOMAttrValuePropertyInfo = (~) T.Text
type AttrBaseTypeConstraint DOMAttrValuePropertyInfo = DOMAttrK
type AttrGetType DOMAttrValuePropertyInfo = T.Text
type AttrLabel DOMAttrValuePropertyInfo = "DOMAttr::value"
attrGet _ = getDOMAttrValue
attrSet _ = setDOMAttrValue
attrConstruct _ = constructDOMAttrValue
type instance AttributeList DOMAttr = DOMAttrAttributeList
type DOMAttrAttributeList = ('[ '("base-uri", DOMNodeBaseUriPropertyInfo), '("child-nodes", DOMNodeChildNodesPropertyInfo), '("core-object", DOMObjectCoreObjectPropertyInfo), '("first-child", DOMNodeFirstChildPropertyInfo), '("is-id", DOMAttrIsIdPropertyInfo), '("last-child", DOMNodeLastChildPropertyInfo), '("local-name", DOMNodeLocalNamePropertyInfo), '("name", DOMAttrNamePropertyInfo), '("namespace-uri", DOMNodeNamespaceUriPropertyInfo), '("next-sibling", DOMNodeNextSiblingPropertyInfo), '("node-name", DOMNodeNodeNamePropertyInfo), '("node-type", DOMNodeNodeTypePropertyInfo), '("node-value", DOMNodeNodeValuePropertyInfo), '("owner-document", DOMNodeOwnerDocumentPropertyInfo), '("owner-element", DOMAttrOwnerElementPropertyInfo), '("parent-element", DOMNodeParentElementPropertyInfo), '("parent-node", DOMNodeParentNodePropertyInfo), '("prefix", DOMNodePrefixPropertyInfo), '("previous-sibling", DOMNodePreviousSiblingPropertyInfo), '("specified", DOMAttrSpecifiedPropertyInfo), '("text-content", DOMNodeTextContentPropertyInfo), '("value", DOMAttrValuePropertyInfo)] :: [(Symbol, *)])
type instance SignalList DOMAttr = DOMAttrSignalList
type DOMAttrSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
foreign import ccall "webkit_dom_attr_get_is_id" webkit_dom_attr_get_is_id ::
Ptr DOMAttr ->
IO CInt
dOMAttrGetIsId ::
(MonadIO m, DOMAttrK a) =>
a ->
m Bool
dOMAttrGetIsId _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_dom_attr_get_is_id _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_dom_attr_get_name" webkit_dom_attr_get_name ::
Ptr DOMAttr ->
IO CString
dOMAttrGetName ::
(MonadIO m, DOMAttrK a) =>
a ->
m T.Text
dOMAttrGetName _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_dom_attr_get_name _obj'
checkUnexpectedReturnNULL "webkit_dom_attr_get_name" result
result' <- cstringToText result
freeMem result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_dom_attr_get_owner_element" webkit_dom_attr_get_owner_element ::
Ptr DOMAttr ->
IO (Ptr DOMElement)
dOMAttrGetOwnerElement ::
(MonadIO m, DOMAttrK a) =>
a ->
m DOMElement
dOMAttrGetOwnerElement _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_dom_attr_get_owner_element _obj'
checkUnexpectedReturnNULL "webkit_dom_attr_get_owner_element" result
result' <- (newObject DOMElement) result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_dom_attr_get_specified" webkit_dom_attr_get_specified ::
Ptr DOMAttr ->
IO CInt
dOMAttrGetSpecified ::
(MonadIO m, DOMAttrK a) =>
a ->
m Bool
dOMAttrGetSpecified _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_dom_attr_get_specified _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_dom_attr_get_value" webkit_dom_attr_get_value ::
Ptr DOMAttr ->
IO CString
dOMAttrGetValue ::
(MonadIO m, DOMAttrK a) =>
a ->
m T.Text
dOMAttrGetValue _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_dom_attr_get_value _obj'
checkUnexpectedReturnNULL "webkit_dom_attr_get_value" result
result' <- cstringToText result
freeMem result
touchManagedPtr _obj
return result'
foreign import ccall "webkit_dom_attr_set_value" webkit_dom_attr_set_value ::
Ptr DOMAttr ->
CString ->
Ptr (Ptr GError) ->
IO ()
dOMAttrSetValue ::
(MonadIO m, DOMAttrK a) =>
a ->
T.Text ->
m ()
dOMAttrSetValue _obj value = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
value' <- textToCString value
onException (do
propagateGError $ webkit_dom_attr_set_value _obj' value'
touchManagedPtr _obj
freeMem value'
return ()
) (do
freeMem value'
)