    {-# LANGUAGE TypeApplications #-}

    -- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
    -- License    : LGPL-2.1
    -- Maintainer : Iñaki García Etxebarria
    --
    -- A socket address of some unknown native type.

    #if !defined(__HADDOCK_VERSION__)
    #define ENABLE_OVERLOADING
    #endif

    module GI.Gio.Objects.NativeSocketAddress
        (

    -- * Exported types
        NativeSocketAddress(..)                 ,
        IsNativeSocketAddress                   ,
        toNativeSocketAddress                   ,

     -- * Methods
    -- ** Overloaded methods #method:Overloaded methods#

    #if defined(ENABLE_OVERLOADING)
        ResolveNativeSocketAddressMethod        ,
    #endif

    -- ** new #method:new#

        nativeSocketAddressNew                  ,

        ) 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.BasicTypes as B.Types
    import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
    import qualified Data.GI.Base.GArray as B.GArray
    import qualified Data.GI.Base.GClosure as B.GClosure
    import qualified Data.GI.Base.GError as B.GError
    import qualified Data.GI.Base.GVariant as B.GVariant
    import qualified Data.GI.Base.GValue as B.GValue
    import qualified Data.GI.Base.GParamSpec as B.GParamSpec
    import qualified Data.GI.Base.CallStack as B.CallStack
    import qualified Data.GI.Base.Properties as B.Properties
    import qualified Data.GI.Base.Signals as B.Signals
    import qualified Control.Monad.IO.Class as MIO
    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 GHC.OverloadedLabels as OL

    import qualified GI.GObject.Objects.Object as GObject.Object
    import {-# SOURCE #-} qualified GI.Gio.Interfaces.SocketConnectable as Gio.SocketConnectable
    import {-# SOURCE #-} qualified GI.Gio.Objects.SocketAddress as Gio.SocketAddress

    -- | Memory-managed wrapper type.
    newtype NativeSocketAddress = NativeSocketAddress (SP.ManagedPtr NativeSocketAddress)
        deriving (NativeSocketAddress -> NativeSocketAddress -> Bool
    (NativeSocketAddress -> NativeSocketAddress -> Bool)
    -> (NativeSocketAddress -> NativeSocketAddress -> Bool)
    -> Eq NativeSocketAddress
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: NativeSocketAddress -> NativeSocketAddress -> Bool
    $c/= :: NativeSocketAddress -> NativeSocketAddress -> Bool
    == :: NativeSocketAddress -> NativeSocketAddress -> Bool
    $c== :: NativeSocketAddress -> NativeSocketAddress -> Bool
    Eq)

    instance SP.ManagedPtrNewtype NativeSocketAddress where
        toManagedPtr :: NativeSocketAddress -> ManagedPtr NativeSocketAddress
    toManagedPtr (NativeSocketAddress p :: ManagedPtr NativeSocketAddress
    p) = ManagedPtr NativeSocketAddress
    p

    foreign import ccall "g_native_socket_address_get_type"
        c_g_native_socket_address_get_type :: IO B.Types.GType

    instance B.Types.TypedObject NativeSocketAddress where
        glibType :: IO GType
    glibType = IO GType
    c_g_native_socket_address_get_type

    instance B.Types.GObject NativeSocketAddress

    -- | Convert 'NativeSocketAddress' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
    instance B.GValue.IsGValue NativeSocketAddress where
        toGValue :: NativeSocketAddress -> IO GValue
    toGValue o :: NativeSocketAddress
    o = do
            GType
    gtype <- IO GType
    c_g_native_socket_address_get_type
            NativeSocketAddress
    -> (Ptr NativeSocketAddress -> IO GValue) -> IO GValue
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    B.ManagedPtr.withManagedPtr NativeSocketAddress
    o (GType
    -> (GValue -> Ptr NativeSocketAddress -> IO ())
    -> Ptr NativeSocketAddress
    -> IO GValue
    forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
    B.GValue.buildGValue GType
    gtype GValue -> Ptr NativeSocketAddress -> IO ()
    forall a. GObject a => GValue -> Ptr a -> IO ()
    B.GValue.set_object)

        fromGValue :: GValue -> IO NativeSocketAddress
    fromGValue gv :: GValue
    gv = do
            Ptr NativeSocketAddress
    ptr <- GValue -> IO (Ptr NativeSocketAddress)
    forall b. GObject b => GValue -> IO (Ptr b)
    B.GValue.get_object GValue
    gv :: IO (Ptr NativeSocketAddress)
            (ManagedPtr NativeSocketAddress -> NativeSocketAddress)
    -> Ptr NativeSocketAddress -> IO NativeSocketAddress
    forall a b.
    (HasCallStack, GObject a, GObject b) =>
    (ManagedPtr a -> a) -> Ptr b -> IO a
    B.ManagedPtr.newObject ManagedPtr NativeSocketAddress -> NativeSocketAddress
    NativeSocketAddress Ptr NativeSocketAddress
    ptr

    -- | Type class for types which can be safely cast to `NativeSocketAddress`, for instance with `toNativeSocketAddress`.
    class (SP.GObject o, O.IsDescendantOf NativeSocketAddress o) => IsNativeSocketAddress o
    instance (SP.GObject o, O.IsDescendantOf NativeSocketAddress o) => IsNativeSocketAddress o

    instance O.HasParentTypes NativeSocketAddress
    type instance O.ParentTypes NativeSocketAddress = '[Gio.SocketAddress.SocketAddress, GObject.Object.Object, Gio.SocketConnectable.SocketConnectable]

    -- | Cast to `NativeSocketAddress`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
    toNativeSocketAddress :: (MonadIO m, IsNativeSocketAddress o) => o -> m NativeSocketAddress
    toNativeSocketAddress :: o -> m NativeSocketAddress
    toNativeSocketAddress = IO NativeSocketAddress -> m NativeSocketAddress
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO NativeSocketAddress -> m NativeSocketAddress)
    -> (o -> IO NativeSocketAddress) -> o -> m NativeSocketAddress
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (ManagedPtr NativeSocketAddress -> NativeSocketAddress)
    -> o -> IO NativeSocketAddress
    forall o o'.
    (HasCallStack, ManagedPtrNewtype o, TypedObject o,
     ManagedPtrNewtype o', TypedObject o') =>
    (ManagedPtr o' -> o') -> o -> IO o'
    unsafeCastTo ManagedPtr NativeSocketAddress -> NativeSocketAddress
    NativeSocketAddress

    #if defined(ENABLE_OVERLOADING)
    type family ResolveNativeSocketAddressMethod (t :: Symbol) (o :: *) :: * where
        ResolveNativeSocketAddressMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
        ResolveNativeSocketAddressMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
        ResolveNativeSocketAddressMethod "enumerate" o = Gio.SocketConnectable.SocketConnectableEnumerateMethodInfo
        ResolveNativeSocketAddressMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
        ResolveNativeSocketAddressMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
        ResolveNativeSocketAddressMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
        ResolveNativeSocketAddressMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
        ResolveNativeSocketAddressMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
        ResolveNativeSocketAddressMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
        ResolveNativeSocketAddressMethod "proxyEnumerate" o = Gio.SocketConnectable.SocketConnectableProxyEnumerateMethodInfo
        ResolveNativeSocketAddressMethod "ref" o = GObject.Object.ObjectRefMethodInfo
        ResolveNativeSocketAddressMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
        ResolveNativeSocketAddressMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
        ResolveNativeSocketAddressMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
        ResolveNativeSocketAddressMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
        ResolveNativeSocketAddressMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
        ResolveNativeSocketAddressMethod "toNative" o = Gio.SocketAddress.SocketAddressToNativeMethodInfo
        ResolveNativeSocketAddressMethod "toString" o = Gio.SocketConnectable.SocketConnectableToStringMethodInfo
        ResolveNativeSocketAddressMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
        ResolveNativeSocketAddressMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
        ResolveNativeSocketAddressMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
        ResolveNativeSocketAddressMethod "getFamily" o = Gio.SocketAddress.SocketAddressGetFamilyMethodInfo
        ResolveNativeSocketAddressMethod "getNativeSize" o = Gio.SocketAddress.SocketAddressGetNativeSizeMethodInfo
        ResolveNativeSocketAddressMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
        ResolveNativeSocketAddressMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
        ResolveNativeSocketAddressMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
        ResolveNativeSocketAddressMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
        ResolveNativeSocketAddressMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
        ResolveNativeSocketAddressMethod l o = O.MethodResolutionFailed l o

    instance (info ~ ResolveNativeSocketAddressMethod t NativeSocketAddress, O.MethodInfo info NativeSocketAddress p) => OL.IsLabel t (NativeSocketAddress -> p) where
    #if MIN_VERSION_base(4,10,0)
        fromLabel = O.overloadedMethod @info
    #else
        fromLabel _ = O.overloadedMethod @info
    #endif

    #endif

    #if defined(ENABLE_OVERLOADING)
    instance O.HasAttributeList NativeSocketAddress
    type instance O.AttributeList NativeSocketAddress = NativeSocketAddressAttributeList
    type NativeSocketAddressAttributeList = ('[ '("family", Gio.SocketAddress.SocketAddressFamilyPropertyInfo)] :: [(Symbol, *)])
    #endif

    #if defined(ENABLE_OVERLOADING)
    #endif

    #if defined(ENABLE_OVERLOADING)
    type instance O.SignalList NativeSocketAddress = NativeSocketAddressSignalList
    type NativeSocketAddressSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

    #endif

    -- method NativeSocketAddress::new
    -- method type : Constructor
    -- Args: [ Arg
    --           { argCName = "native"
    --           , argType = TBasicType TPtr
    --           , direction = DirectionIn
    --           , mayBeNull = True
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a native address object"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "len"
    --           , argType = TBasicType TUInt64
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "the length of @native, in bytes"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Just
    --               (TInterface
    --                  Name { namespace = "Gio" , name = "NativeSocketAddress" })
    -- throws : False
    -- Skip return : False

    foreign import ccall "g_native_socket_address_new" g_native_socket_address_new ::
        Ptr () ->                               -- native : TBasicType TPtr
        Word64 ->                               -- len : TBasicType TUInt64
        IO (Ptr NativeSocketAddress)

    -- | Creates a new t'GI.Gio.Objects.NativeSocketAddress.NativeSocketAddress' for /@native@/ and /@len@/.
    --
    -- /Since: 2.46/
    nativeSocketAddressNew ::
        (B.CallStack.HasCallStack, MonadIO m) =>
        Ptr ()
        -- ^ /@native@/: a native address object
        -> Word64
        -- ^ /@len@/: the length of /@native@/, in bytes
        -> m NativeSocketAddress
        -- ^ __Returns:__ a new t'GI.Gio.Objects.NativeSocketAddress.NativeSocketAddress'
    nativeSocketAddressNew :: Ptr () -> Word64 -> m NativeSocketAddress
    nativeSocketAddressNew native :: Ptr ()
    native len :: Word64
    len = IO NativeSocketAddress -> m NativeSocketAddress
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO NativeSocketAddress -> m NativeSocketAddress)
    -> IO NativeSocketAddress -> m NativeSocketAddress
    forall a b. (a -> b) -> a -> b
    $ do
        Ptr NativeSocketAddress
    result <- Ptr () -> Word64 -> IO (Ptr NativeSocketAddress)
    g_native_socket_address_new Ptr ()
    native Word64
    len
        Text -> Ptr NativeSocketAddress -> IO ()
    forall a. HasCallStack => Text -> Ptr a -> IO ()
    checkUnexpectedReturnNULL "nativeSocketAddressNew" Ptr NativeSocketAddress
    result
        NativeSocketAddress
    result' <- ((ManagedPtr NativeSocketAddress -> NativeSocketAddress)
    -> Ptr NativeSocketAddress -> IO NativeSocketAddress
    forall a b.
    (HasCallStack, GObject a, GObject b) =>
    (ManagedPtr a -> a) -> Ptr b -> IO a
    wrapObject ManagedPtr NativeSocketAddress -> NativeSocketAddress
    NativeSocketAddress) Ptr NativeSocketAddress
    result
        NativeSocketAddress -> IO NativeSocketAddress
    forall (m :: * -> *) a. Monad m => a -> m a
    return NativeSocketAddress
    result'

    #if defined(ENABLE_OVERLOADING)
    #endif