{- |
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.WebKit.Objects.DOMProcessingInstruction
    ( 

-- * Exported types
    DOMProcessingInstruction(..)            ,
    DOMProcessingInstructionK               ,
    toDOMProcessingInstruction              ,
    noDOMProcessingInstruction              ,


 -- * Methods
-- ** dOMProcessingInstructionGetData
    dOMProcessingInstructionGetData         ,


-- ** dOMProcessingInstructionGetSheet
    dOMProcessingInstructionGetSheet        ,


-- ** dOMProcessingInstructionGetTarget
    dOMProcessingInstructionGetTarget       ,


-- ** dOMProcessingInstructionSetData
    dOMProcessingInstructionSetData         ,




 -- * Properties
-- ** Sheet
    DOMProcessingInstructionSheetPropertyInfo,
    getDOMProcessingInstructionSheet        ,


-- ** Target
    DOMProcessingInstructionTargetPropertyInfo,
    getDOMProcessingInstructionTarget       ,




    ) 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 DOMProcessingInstruction = DOMProcessingInstruction (ForeignPtr DOMProcessingInstruction)
foreign import ccall "webkit_dom_processing_instruction_get_type"
    c_webkit_dom_processing_instruction_get_type :: IO GType

type instance ParentTypes DOMProcessingInstruction = DOMProcessingInstructionParentTypes
type DOMProcessingInstructionParentTypes = '[DOMCharacterData, DOMNode, DOMObject, GObject.Object, DOMEventTarget]

instance GObject DOMProcessingInstruction where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_dom_processing_instruction_get_type
    

class GObject o => DOMProcessingInstructionK o
instance (GObject o, IsDescendantOf DOMProcessingInstruction o) => DOMProcessingInstructionK o

toDOMProcessingInstruction :: DOMProcessingInstructionK o => o -> IO DOMProcessingInstruction
toDOMProcessingInstruction = unsafeCastTo DOMProcessingInstruction

noDOMProcessingInstruction :: Maybe DOMProcessingInstruction
noDOMProcessingInstruction = Nothing

-- VVV Prop "sheet"
   -- Type: TInterface "WebKit" "DOMStyleSheet"
   -- Flags: [PropertyReadable]

getDOMProcessingInstructionSheet :: (MonadIO m, DOMProcessingInstructionK o) => o -> m DOMStyleSheet
getDOMProcessingInstructionSheet obj = liftIO $ getObjectPropertyObject obj "sheet" DOMStyleSheet

data DOMProcessingInstructionSheetPropertyInfo
instance AttrInfo DOMProcessingInstructionSheetPropertyInfo where
    type AttrAllowedOps DOMProcessingInstructionSheetPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMProcessingInstructionSheetPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMProcessingInstructionSheetPropertyInfo = DOMProcessingInstructionK
    type AttrGetType DOMProcessingInstructionSheetPropertyInfo = DOMStyleSheet
    type AttrLabel DOMProcessingInstructionSheetPropertyInfo = "DOMProcessingInstruction::sheet"
    attrGet _ = getDOMProcessingInstructionSheet
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "target"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable]

getDOMProcessingInstructionTarget :: (MonadIO m, DOMProcessingInstructionK o) => o -> m T.Text
getDOMProcessingInstructionTarget obj = liftIO $ getObjectPropertyString obj "target"

data DOMProcessingInstructionTargetPropertyInfo
instance AttrInfo DOMProcessingInstructionTargetPropertyInfo where
    type AttrAllowedOps DOMProcessingInstructionTargetPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMProcessingInstructionTargetPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMProcessingInstructionTargetPropertyInfo = DOMProcessingInstructionK
    type AttrGetType DOMProcessingInstructionTargetPropertyInfo = T.Text
    type AttrLabel DOMProcessingInstructionTargetPropertyInfo = "DOMProcessingInstruction::target"
    attrGet _ = getDOMProcessingInstructionTarget
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList DOMProcessingInstruction = DOMProcessingInstructionAttributeList
type DOMProcessingInstructionAttributeList = ('[ '("base-uri", DOMNodeBaseUriPropertyInfo), '("child-nodes", DOMNodeChildNodesPropertyInfo), '("core-object", DOMObjectCoreObjectPropertyInfo), '("data", DOMCharacterDataDataPropertyInfo), '("first-child", DOMNodeFirstChildPropertyInfo), '("last-child", DOMNodeLastChildPropertyInfo), '("length", DOMCharacterDataLengthPropertyInfo), '("local-name", DOMNodeLocalNamePropertyInfo), '("namespace-uri", DOMNodeNamespaceUriPropertyInfo), '("next-sibling", DOMNodeNextSiblingPropertyInfo), '("node-name", DOMNodeNodeNamePropertyInfo), '("node-type", DOMNodeNodeTypePropertyInfo), '("node-value", DOMNodeNodeValuePropertyInfo), '("owner-document", DOMNodeOwnerDocumentPropertyInfo), '("parent-element", DOMNodeParentElementPropertyInfo), '("parent-node", DOMNodeParentNodePropertyInfo), '("prefix", DOMNodePrefixPropertyInfo), '("previous-sibling", DOMNodePreviousSiblingPropertyInfo), '("sheet", DOMProcessingInstructionSheetPropertyInfo), '("target", DOMProcessingInstructionTargetPropertyInfo), '("text-content", DOMNodeTextContentPropertyInfo)] :: [(Symbol, *)])

type instance SignalList DOMProcessingInstruction = DOMProcessingInstructionSignalList
type DOMProcessingInstructionSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method DOMProcessingInstruction::get_data
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMProcessingInstruction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMProcessingInstruction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_processing_instruction_get_data" webkit_dom_processing_instruction_get_data :: 
    Ptr DOMProcessingInstruction ->         -- _obj : TInterface "WebKit" "DOMProcessingInstruction"
    IO CString

{-# DEPRECATED dOMProcessingInstructionGetData ["(Since version 2.4)"]#-}
dOMProcessingInstructionGetData ::
    (MonadIO m, DOMProcessingInstructionK a) =>
    a ->                                    -- _obj
    m T.Text
dOMProcessingInstructionGetData _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_processing_instruction_get_data _obj'
    checkUnexpectedReturnNULL "webkit_dom_processing_instruction_get_data" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'

-- method DOMProcessingInstruction::get_sheet
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMProcessingInstruction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMProcessingInstruction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "WebKit" "DOMStyleSheet"
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_processing_instruction_get_sheet" webkit_dom_processing_instruction_get_sheet :: 
    Ptr DOMProcessingInstruction ->         -- _obj : TInterface "WebKit" "DOMProcessingInstruction"
    IO (Ptr DOMStyleSheet)


dOMProcessingInstructionGetSheet ::
    (MonadIO m, DOMProcessingInstructionK a) =>
    a ->                                    -- _obj
    m DOMStyleSheet
dOMProcessingInstructionGetSheet _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_processing_instruction_get_sheet _obj'
    checkUnexpectedReturnNULL "webkit_dom_processing_instruction_get_sheet" result
    result' <- (wrapObject DOMStyleSheet) result
    touchManagedPtr _obj
    return result'

-- method DOMProcessingInstruction::get_target
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMProcessingInstruction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMProcessingInstruction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_processing_instruction_get_target" webkit_dom_processing_instruction_get_target :: 
    Ptr DOMProcessingInstruction ->         -- _obj : TInterface "WebKit" "DOMProcessingInstruction"
    IO CString


dOMProcessingInstructionGetTarget ::
    (MonadIO m, DOMProcessingInstructionK a) =>
    a ->                                    -- _obj
    m T.Text
dOMProcessingInstructionGetTarget _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_processing_instruction_get_target _obj'
    checkUnexpectedReturnNULL "webkit_dom_processing_instruction_get_target" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'

-- method DOMProcessingInstruction::set_data
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMProcessingInstruction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMProcessingInstruction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : True
-- Skip return : False

foreign import ccall "webkit_dom_processing_instruction_set_data" webkit_dom_processing_instruction_set_data :: 
    Ptr DOMProcessingInstruction ->         -- _obj : TInterface "WebKit" "DOMProcessingInstruction"
    CString ->                              -- value : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO ()

{-# DEPRECATED dOMProcessingInstructionSetData ["(Since version 2.4)"]#-}
dOMProcessingInstructionSetData ::
    (MonadIO m, DOMProcessingInstructionK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- value
    m ()
dOMProcessingInstructionSetData _obj value = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    value' <- textToCString value
    onException (do
        propagateGError $ webkit_dom_processing_instruction_set_data _obj' value'
        touchManagedPtr _obj
        freeMem value'
        return ()
     ) (do
        freeMem value'
     )