{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Structs.SrvTarget
(
SrvTarget(..) ,
noSrvTarget ,
#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.ManagedPtr as B.ManagedPtr
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 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
newtype SrvTarget = SrvTarget (ManagedPtr SrvTarget)
deriving (SrvTarget -> SrvTarget -> Bool
(SrvTarget -> SrvTarget -> Bool)
-> (SrvTarget -> SrvTarget -> Bool) -> Eq SrvTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SrvTarget -> SrvTarget -> Bool
$c/= :: SrvTarget -> SrvTarget -> Bool
== :: SrvTarget -> SrvTarget -> Bool
$c== :: SrvTarget -> SrvTarget -> Bool
Eq)
foreign import ccall "g_srv_target_get_type" c_g_srv_target_get_type ::
IO GType
instance BoxedObject SrvTarget where
boxedType :: SrvTarget -> IO GType
boxedType _ = IO GType
c_g_srv_target_get_type
instance B.GValue.IsGValue SrvTarget where
toGValue :: SrvTarget -> IO GValue
toGValue o :: SrvTarget
o = do
GType
gtype <- IO GType
c_g_srv_target_get_type
SrvTarget -> (Ptr SrvTarget -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr SrvTarget
o (GType
-> (GValue -> Ptr SrvTarget -> IO ()) -> Ptr SrvTarget -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr SrvTarget -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
fromGValue :: GValue -> IO SrvTarget
fromGValue gv :: GValue
gv = do
Ptr SrvTarget
ptr <- GValue -> IO (Ptr SrvTarget)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr SrvTarget)
(ManagedPtr SrvTarget -> SrvTarget)
-> Ptr SrvTarget -> IO SrvTarget
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr SrvTarget -> SrvTarget
SrvTarget Ptr SrvTarget
ptr
noSrvTarget :: Maybe SrvTarget
noSrvTarget :: Maybe SrvTarget
noSrvTarget = Maybe SrvTarget
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList SrvTarget
type instance O.AttributeList SrvTarget = SrvTargetAttributeList
type SrvTargetAttributeList = ('[ ] :: [(Symbol, *)])
#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 :: Text -> Word16 -> Word16 -> Word16 -> m SrvTarget
srvTargetNew hostname :: Text
hostname port :: Word16
port priority :: Word16
priority weight :: Word16
weight = IO SrvTarget -> m SrvTarget
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
CString
hostname' <- Text -> IO CString
textToCString Text
hostname
Ptr SrvTarget
result <- CString -> Word16 -> Word16 -> Word16 -> IO (Ptr SrvTarget)
g_srv_target_new CString
hostname' Word16
port Word16
priority Word16
weight
Text -> Ptr SrvTarget -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "srvTargetNew" Ptr SrvTarget
result
SrvTarget
result' <- ((ManagedPtr SrvTarget -> SrvTarget)
-> Ptr SrvTarget -> IO SrvTarget
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr SrvTarget -> SrvTarget
SrvTarget) Ptr SrvTarget
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
hostname'
SrvTarget -> IO SrvTarget
forall (m :: * -> *) a. Monad m => a -> m a
return SrvTarget
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 :: SrvTarget -> m SrvTarget
srvTargetCopy target :: SrvTarget
target = IO SrvTarget -> m SrvTarget
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
Ptr SrvTarget
target' <- SrvTarget -> IO (Ptr SrvTarget)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SrvTarget
target
Ptr SrvTarget
result <- Ptr SrvTarget -> IO (Ptr SrvTarget)
g_srv_target_copy Ptr SrvTarget
target'
Text -> Ptr SrvTarget -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "srvTargetCopy" Ptr SrvTarget
result
SrvTarget
result' <- ((ManagedPtr SrvTarget -> SrvTarget)
-> Ptr SrvTarget -> IO SrvTarget
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr SrvTarget -> SrvTarget
SrvTarget) Ptr SrvTarget
result
SrvTarget -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SrvTarget
target
SrvTarget -> IO SrvTarget
forall (m :: * -> *) a. Monad m => a -> m a
return SrvTarget
result'
#if defined(ENABLE_OVERLOADING)
data SrvTargetCopyMethodInfo
instance (signature ~ (m SrvTarget), MonadIO m) => O.MethodInfo SrvTargetCopyMethodInfo SrvTarget signature where
overloadedMethod = 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 :: SrvTarget -> m ()
srvTargetFree target :: SrvTarget
target = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr SrvTarget
target' <- SrvTarget -> IO (Ptr SrvTarget)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SrvTarget
target
Ptr SrvTarget -> IO ()
g_srv_target_free Ptr SrvTarget
target'
SrvTarget -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SrvTarget
target
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SrvTargetFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo SrvTargetFreeMethodInfo SrvTarget signature where
overloadedMethod = 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 :: SrvTarget -> m Text
srvTargetGetHostname target :: SrvTarget
target = IO Text -> m Text
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
Ptr SrvTarget
target' <- SrvTarget -> IO (Ptr SrvTarget)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SrvTarget
target
CString
result <- Ptr SrvTarget -> IO CString
g_srv_target_get_hostname Ptr SrvTarget
target'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "srvTargetGetHostname" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
SrvTarget -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SrvTarget
target
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data SrvTargetGetHostnameMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo SrvTargetGetHostnameMethodInfo SrvTarget signature where
overloadedMethod = 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 :: SrvTarget -> m Word16
srvTargetGetPort target :: SrvTarget
target = IO Word16 -> m Word16
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
Ptr SrvTarget
target' <- SrvTarget -> IO (Ptr SrvTarget)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SrvTarget
target
Word16
result <- Ptr SrvTarget -> IO Word16
g_srv_target_get_port Ptr SrvTarget
target'
SrvTarget -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SrvTarget
target
Word16 -> IO Word16
forall (m :: * -> *) a. Monad m => a -> m a
return Word16
result
#if defined(ENABLE_OVERLOADING)
data SrvTargetGetPortMethodInfo
instance (signature ~ (m Word16), MonadIO m) => O.MethodInfo SrvTargetGetPortMethodInfo SrvTarget signature where
overloadedMethod = 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 :: SrvTarget -> m Word16
srvTargetGetPriority target :: SrvTarget
target = IO Word16 -> m Word16
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
Ptr SrvTarget
target' <- SrvTarget -> IO (Ptr SrvTarget)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SrvTarget
target
Word16
result <- Ptr SrvTarget -> IO Word16
g_srv_target_get_priority Ptr SrvTarget
target'
SrvTarget -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SrvTarget
target
Word16 -> IO Word16
forall (m :: * -> *) a. Monad m => a -> m a
return Word16
result
#if defined(ENABLE_OVERLOADING)
data SrvTargetGetPriorityMethodInfo
instance (signature ~ (m Word16), MonadIO m) => O.MethodInfo SrvTargetGetPriorityMethodInfo SrvTarget signature where
overloadedMethod = 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 :: SrvTarget -> m Word16
srvTargetGetWeight target :: SrvTarget
target = IO Word16 -> m Word16
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
Ptr SrvTarget
target' <- SrvTarget -> IO (Ptr SrvTarget)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SrvTarget
target
Word16
result <- Ptr SrvTarget -> IO Word16
g_srv_target_get_weight Ptr SrvTarget
target'
SrvTarget -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SrvTarget
target
Word16 -> IO Word16
forall (m :: * -> *) a. Monad m => a -> m a
return Word16
result
#if defined(ENABLE_OVERLOADING)
data SrvTargetGetWeightMethodInfo
instance (signature ~ (m Word16), MonadIO m) => O.MethodInfo SrvTargetGetWeightMethodInfo SrvTarget signature where
overloadedMethod = srvTargetGetWeight
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveSrvTargetMethod (t :: Symbol) (o :: *) :: * 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.MethodInfo 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
#endif