{- |
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.Gio.Objects.TcpWrapperConnection
    ( 

-- * Exported types
    TcpWrapperConnection(..)                ,
    TcpWrapperConnectionK                   ,
    toTcpWrapperConnection                  ,
    noTcpWrapperConnection                  ,


 -- * Methods
-- ** tcpWrapperConnectionGetBaseIoStream
    tcpWrapperConnectionGetBaseIoStream     ,


-- ** tcpWrapperConnectionNew
    tcpWrapperConnectionNew                 ,




 -- * Properties
-- ** BaseIoStream
    TcpWrapperConnectionBaseIoStreamPropertyInfo,
    constructTcpWrapperConnectionBaseIoStream,
    getTcpWrapperConnectionBaseIoStream     ,




    ) 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.Gio.Types
import GI.Gio.Callbacks
import qualified GI.GObject as GObject

newtype TcpWrapperConnection = TcpWrapperConnection (ForeignPtr TcpWrapperConnection)
foreign import ccall "g_tcp_wrapper_connection_get_type"
    c_g_tcp_wrapper_connection_get_type :: IO GType

type instance ParentTypes TcpWrapperConnection = TcpWrapperConnectionParentTypes
type TcpWrapperConnectionParentTypes = '[TcpConnection, SocketConnection, IOStream, GObject.Object]

instance GObject TcpWrapperConnection where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_tcp_wrapper_connection_get_type
    

class GObject o => TcpWrapperConnectionK o
instance (GObject o, IsDescendantOf TcpWrapperConnection o) => TcpWrapperConnectionK o

toTcpWrapperConnection :: TcpWrapperConnectionK o => o -> IO TcpWrapperConnection
toTcpWrapperConnection = unsafeCastTo TcpWrapperConnection

noTcpWrapperConnection :: Maybe TcpWrapperConnection
noTcpWrapperConnection = Nothing

-- VVV Prop "base-io-stream"
   -- Type: TInterface "Gio" "IOStream"
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getTcpWrapperConnectionBaseIoStream :: (MonadIO m, TcpWrapperConnectionK o) => o -> m IOStream
getTcpWrapperConnectionBaseIoStream obj = liftIO $ getObjectPropertyObject obj "base-io-stream" IOStream

constructTcpWrapperConnectionBaseIoStream :: (IOStreamK a) => a -> IO ([Char], GValue)
constructTcpWrapperConnectionBaseIoStream val = constructObjectPropertyObject "base-io-stream" val

data TcpWrapperConnectionBaseIoStreamPropertyInfo
instance AttrInfo TcpWrapperConnectionBaseIoStreamPropertyInfo where
    type AttrAllowedOps TcpWrapperConnectionBaseIoStreamPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint TcpWrapperConnectionBaseIoStreamPropertyInfo = IOStreamK
    type AttrBaseTypeConstraint TcpWrapperConnectionBaseIoStreamPropertyInfo = TcpWrapperConnectionK
    type AttrGetType TcpWrapperConnectionBaseIoStreamPropertyInfo = IOStream
    type AttrLabel TcpWrapperConnectionBaseIoStreamPropertyInfo = "TcpWrapperConnection::base-io-stream"
    attrGet _ = getTcpWrapperConnectionBaseIoStream
    attrSet _ = undefined
    attrConstruct _ = constructTcpWrapperConnectionBaseIoStream

type instance AttributeList TcpWrapperConnection = TcpWrapperConnectionAttributeList
type TcpWrapperConnectionAttributeList = ('[ '("base-io-stream", TcpWrapperConnectionBaseIoStreamPropertyInfo), '("closed", IOStreamClosedPropertyInfo), '("graceful-disconnect", TcpConnectionGracefulDisconnectPropertyInfo), '("input-stream", IOStreamInputStreamPropertyInfo), '("output-stream", IOStreamOutputStreamPropertyInfo), '("socket", SocketConnectionSocketPropertyInfo)] :: [(Symbol, *)])

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

-- method TcpWrapperConnection::new
-- method type : Constructor
-- Args : [Arg {argName = "base_io_stream", argType = TInterface "Gio" "IOStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "socket", argType = TInterface "Gio" "Socket", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "base_io_stream", argType = TInterface "Gio" "IOStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "socket", argType = TInterface "Gio" "Socket", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "TcpWrapperConnection"
-- throws : False
-- Skip return : False

foreign import ccall "g_tcp_wrapper_connection_new" g_tcp_wrapper_connection_new :: 
    Ptr IOStream ->                         -- base_io_stream : TInterface "Gio" "IOStream"
    Ptr Socket ->                           -- socket : TInterface "Gio" "Socket"
    IO (Ptr TcpWrapperConnection)


tcpWrapperConnectionNew ::
    (MonadIO m, IOStreamK a, SocketK b) =>
    a ->                                    -- base_io_stream
    b ->                                    -- socket
    m TcpWrapperConnection
tcpWrapperConnectionNew base_io_stream socket = liftIO $ do
    let base_io_stream' = unsafeManagedPtrCastPtr base_io_stream
    let socket' = unsafeManagedPtrCastPtr socket
    result <- g_tcp_wrapper_connection_new base_io_stream' socket'
    checkUnexpectedReturnNULL "g_tcp_wrapper_connection_new" result
    result' <- (wrapObject TcpWrapperConnection) result
    touchManagedPtr base_io_stream
    touchManagedPtr socket
    return result'

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

foreign import ccall "g_tcp_wrapper_connection_get_base_io_stream" g_tcp_wrapper_connection_get_base_io_stream :: 
    Ptr TcpWrapperConnection ->             -- _obj : TInterface "Gio" "TcpWrapperConnection"
    IO (Ptr IOStream)


tcpWrapperConnectionGetBaseIoStream ::
    (MonadIO m, TcpWrapperConnectionK a) =>
    a ->                                    -- _obj
    m IOStream
tcpWrapperConnectionGetBaseIoStream _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_tcp_wrapper_connection_get_base_io_stream _obj'
    checkUnexpectedReturnNULL "g_tcp_wrapper_connection_get_base_io_stream" result
    result' <- (newObject IOStream) result
    touchManagedPtr _obj
    return result'