{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Structs.SrvTarget
(
SrvTarget(..) ,
#if defined(ENABLE_OVERLOADING)
ResolveSrvTargetMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
SrvTargetCopyMethodInfo ,
#endif
srvTargetCopy ,
#if defined(ENABLE_OVERLOADING)
SrvTargetFreeMethodInfo ,
#endif
srvTargetFree ,
#if defined(ENABLE_OVERLOADING)
SrvTargetGetHostnameMethodInfo ,
#endif
srvTargetGetHostname ,
#if defined(ENABLE_OVERLOADING)
SrvTargetGetPortMethodInfo ,
#endif
srvTargetGetPort ,
#if defined(ENABLE_OVERLOADING)
SrvTargetGetPriorityMethodInfo ,
#endif
srvTargetGetPriority ,
#if defined(ENABLE_OVERLOADING)
SrvTargetGetWeightMethodInfo ,
#endif
srvTargetGetWeight ,
srvTargetNew ,
) 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.GHashTable as B.GHT
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.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
#else
#endif
newtype SrvTarget = SrvTarget (SP.ManagedPtr SrvTarget)
deriving (SrvTarget -> SrvTarget -> Bool
(SrvTarget -> SrvTarget -> Bool)
-> (SrvTarget -> SrvTarget -> Bool) -> Eq SrvTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SrvTarget -> SrvTarget -> Bool
== :: SrvTarget -> SrvTarget -> Bool
$c/= :: SrvTarget -> SrvTarget -> Bool
/= :: SrvTarget -> SrvTarget -> Bool
Eq)
instance SP.ManagedPtrNewtype SrvTarget where
toManagedPtr :: SrvTarget -> ManagedPtr SrvTarget
toManagedPtr (SrvTarget ManagedPtr SrvTarget
p) = ManagedPtr SrvTarget
p
foreign import ccall "g_srv_target_get_type" c_g_srv_target_get_type ::
IO GType
type instance O.ParentTypes SrvTarget = '[]
instance O.HasParentTypes SrvTarget
instance B.Types.TypedObject SrvTarget where
glibType :: IO GType
glibType = IO GType
c_g_srv_target_get_type
instance B.Types.GBoxed SrvTarget
instance B.GValue.IsGValue (Maybe SrvTarget) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_srv_target_get_type
gvalueSet_ :: Ptr GValue -> Maybe SrvTarget -> IO ()
gvalueSet_ Ptr GValue
gv Maybe SrvTarget
P.Nothing = Ptr GValue -> Ptr SrvTarget -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr SrvTarget
forall a. Ptr a
FP.nullPtr :: FP.Ptr SrvTarget)
gvalueSet_ Ptr GValue
gv (P.Just SrvTarget
obj) = SrvTarget -> (Ptr SrvTarget -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr SrvTarget
obj (Ptr GValue -> Ptr SrvTarget -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe SrvTarget)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr SrvTarget)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr SrvTarget)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newBoxed SrvTarget ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList SrvTarget
type instance O.AttributeList SrvTarget = SrvTargetAttributeList
type SrvTargetAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "g_srv_target_new" g_srv_target_new ::
CString ->
Word16 ->
Word16 ->
Word16 ->
IO (Ptr SrvTarget)
srvTargetNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> Word16
-> Word16
-> Word16
-> m SrvTarget
srvTargetNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Word16 -> Word16 -> Word16 -> m SrvTarget
srvTargetNew Text
hostname Word16
port Word16
priority Word16
weight = IO SrvTarget -> m SrvTarget
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SrvTarget -> m SrvTarget) -> IO SrvTarget -> m SrvTarget
forall a b. (a -> b) -> a -> b
$ do
hostname' <- Text -> IO CString
textToCString Text
hostname
result <- g_srv_target_new hostname' port priority weight
checkUnexpectedReturnNULL "srvTargetNew" result
result' <- (wrapBoxed SrvTarget) result
freeMem hostname'
return result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_srv_target_copy" g_srv_target_copy ::
Ptr SrvTarget ->
IO (Ptr SrvTarget)
srvTargetCopy ::
(B.CallStack.HasCallStack, MonadIO m) =>
SrvTarget
-> m SrvTarget
srvTargetCopy :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
SrvTarget -> m SrvTarget
srvTargetCopy SrvTarget
target = IO SrvTarget -> m SrvTarget
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SrvTarget -> m SrvTarget) -> IO SrvTarget -> m SrvTarget
forall a b. (a -> b) -> a -> b
$ do
target' <- SrvTarget -> IO (Ptr SrvTarget)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SrvTarget
target
result <- g_srv_target_copy target'
checkUnexpectedReturnNULL "srvTargetCopy" result
result' <- (wrapBoxed SrvTarget) result
touchManagedPtr target
return result'
#if defined(ENABLE_OVERLOADING)
data SrvTargetCopyMethodInfo
instance (signature ~ (m SrvTarget), MonadIO m) => O.OverloadedMethod SrvTargetCopyMethodInfo SrvTarget signature where
overloadedMethod = srvTargetCopy
instance O.OverloadedMethodInfo SrvTargetCopyMethodInfo SrvTarget where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Structs.SrvTarget.srvTargetCopy",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Structs-SrvTarget.html#v:srvTargetCopy"
})
#endif
foreign import ccall "g_srv_target_free" g_srv_target_free ::
Ptr SrvTarget ->
IO ()
srvTargetFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
SrvTarget
-> m ()
srvTargetFree :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
SrvTarget -> m ()
srvTargetFree SrvTarget
target = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
target' <- SrvTarget -> IO (Ptr SrvTarget)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SrvTarget
target
g_srv_target_free target'
touchManagedPtr target
return ()
#if defined(ENABLE_OVERLOADING)
data SrvTargetFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod SrvTargetFreeMethodInfo SrvTarget signature where
overloadedMethod = srvTargetFree
instance O.OverloadedMethodInfo SrvTargetFreeMethodInfo SrvTarget where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Structs.SrvTarget.srvTargetFree",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Structs-SrvTarget.html#v:srvTargetFree"
})
#endif
foreign import ccall "g_srv_target_get_hostname" g_srv_target_get_hostname ::
Ptr SrvTarget ->
IO CString
srvTargetGetHostname ::
(B.CallStack.HasCallStack, MonadIO m) =>
SrvTarget
-> m T.Text
srvTargetGetHostname :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
SrvTarget -> m Text
srvTargetGetHostname SrvTarget
target = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
target' <- SrvTarget -> IO (Ptr SrvTarget)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SrvTarget
target
result <- g_srv_target_get_hostname target'
checkUnexpectedReturnNULL "srvTargetGetHostname" result
result' <- cstringToText result
touchManagedPtr target
return result'
#if defined(ENABLE_OVERLOADING)
data SrvTargetGetHostnameMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.OverloadedMethod SrvTargetGetHostnameMethodInfo SrvTarget signature where
overloadedMethod = srvTargetGetHostname
instance O.OverloadedMethodInfo SrvTargetGetHostnameMethodInfo SrvTarget where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Structs.SrvTarget.srvTargetGetHostname",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Structs-SrvTarget.html#v:srvTargetGetHostname"
})
#endif
foreign import ccall "g_srv_target_get_port" g_srv_target_get_port ::
Ptr SrvTarget ->
IO Word16
srvTargetGetPort ::
(B.CallStack.HasCallStack, MonadIO m) =>
SrvTarget
-> m Word16
srvTargetGetPort :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
SrvTarget -> m Word16
srvTargetGetPort SrvTarget
target = IO Word16 -> m Word16
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word16 -> m Word16) -> IO Word16 -> m Word16
forall a b. (a -> b) -> a -> b
$ do
target' <- SrvTarget -> IO (Ptr SrvTarget)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SrvTarget
target
result <- g_srv_target_get_port target'
touchManagedPtr target
return result
#if defined(ENABLE_OVERLOADING)
data SrvTargetGetPortMethodInfo
instance (signature ~ (m Word16), MonadIO m) => O.OverloadedMethod SrvTargetGetPortMethodInfo SrvTarget signature where
overloadedMethod = srvTargetGetPort
instance O.OverloadedMethodInfo SrvTargetGetPortMethodInfo SrvTarget where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Structs.SrvTarget.srvTargetGetPort",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Structs-SrvTarget.html#v:srvTargetGetPort"
})
#endif
foreign import ccall "g_srv_target_get_priority" g_srv_target_get_priority ::
Ptr SrvTarget ->
IO Word16
srvTargetGetPriority ::
(B.CallStack.HasCallStack, MonadIO m) =>
SrvTarget
-> m Word16
srvTargetGetPriority :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
SrvTarget -> m Word16
srvTargetGetPriority SrvTarget
target = IO Word16 -> m Word16
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word16 -> m Word16) -> IO Word16 -> m Word16
forall a b. (a -> b) -> a -> b
$ do
target' <- SrvTarget -> IO (Ptr SrvTarget)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SrvTarget
target
result <- g_srv_target_get_priority target'
touchManagedPtr target
return result
#if defined(ENABLE_OVERLOADING)
data SrvTargetGetPriorityMethodInfo
instance (signature ~ (m Word16), MonadIO m) => O.OverloadedMethod SrvTargetGetPriorityMethodInfo SrvTarget signature where
overloadedMethod = srvTargetGetPriority
instance O.OverloadedMethodInfo SrvTargetGetPriorityMethodInfo SrvTarget where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Structs.SrvTarget.srvTargetGetPriority",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Structs-SrvTarget.html#v:srvTargetGetPriority"
})
#endif
foreign import ccall "g_srv_target_get_weight" g_srv_target_get_weight ::
Ptr SrvTarget ->
IO Word16
srvTargetGetWeight ::
(B.CallStack.HasCallStack, MonadIO m) =>
SrvTarget
-> m Word16
srvTargetGetWeight :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
SrvTarget -> m Word16
srvTargetGetWeight SrvTarget
target = IO Word16 -> m Word16
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word16 -> m Word16) -> IO Word16 -> m Word16
forall a b. (a -> b) -> a -> b
$ do
target' <- SrvTarget -> IO (Ptr SrvTarget)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SrvTarget
target
result <- g_srv_target_get_weight target'
touchManagedPtr target
return result
#if defined(ENABLE_OVERLOADING)
data SrvTargetGetWeightMethodInfo
instance (signature ~ (m Word16), MonadIO m) => O.OverloadedMethod SrvTargetGetWeightMethodInfo SrvTarget signature where
overloadedMethod = srvTargetGetWeight
instance O.OverloadedMethodInfo SrvTargetGetWeightMethodInfo SrvTarget where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Structs.SrvTarget.srvTargetGetWeight",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Structs-SrvTarget.html#v:srvTargetGetWeight"
})
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveSrvTargetMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveSrvTargetMethod "copy" o = SrvTargetCopyMethodInfo
ResolveSrvTargetMethod "free" o = SrvTargetFreeMethodInfo
ResolveSrvTargetMethod "getHostname" o = SrvTargetGetHostnameMethodInfo
ResolveSrvTargetMethod "getPort" o = SrvTargetGetPortMethodInfo
ResolveSrvTargetMethod "getPriority" o = SrvTargetGetPriorityMethodInfo
ResolveSrvTargetMethod "getWeight" o = SrvTargetGetWeightMethodInfo
ResolveSrvTargetMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveSrvTargetMethod t SrvTarget, O.OverloadedMethod info SrvTarget p) => OL.IsLabel t (SrvTarget -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveSrvTargetMethod t SrvTarget, O.OverloadedMethod info SrvTarget p, R.HasField t SrvTarget p) => R.HasField t SrvTarget p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveSrvTargetMethod t SrvTarget, O.OverloadedMethodInfo info SrvTarget) => OL.IsLabel t (O.MethodProxy info SrvTarget) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif