{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Structs.DBusErrorEntry
(
DBusErrorEntry(..) ,
newZeroDBusErrorEntry ,
#if defined(ENABLE_OVERLOADING)
ResolveDBusErrorEntryMethod ,
#endif
clearDBusErrorEntryDbusErrorName ,
#if defined(ENABLE_OVERLOADING)
dBusErrorEntry_dbusErrorName ,
#endif
getDBusErrorEntryDbusErrorName ,
setDBusErrorEntryDbusErrorName ,
#if defined(ENABLE_OVERLOADING)
dBusErrorEntry_errorCode ,
#endif
getDBusErrorEntryErrorCode ,
setDBusErrorEntryErrorCode ,
) 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 DBusErrorEntry = DBusErrorEntry (SP.ManagedPtr DBusErrorEntry)
deriving (DBusErrorEntry -> DBusErrorEntry -> Bool
(DBusErrorEntry -> DBusErrorEntry -> Bool)
-> (DBusErrorEntry -> DBusErrorEntry -> Bool) -> Eq DBusErrorEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DBusErrorEntry -> DBusErrorEntry -> Bool
== :: DBusErrorEntry -> DBusErrorEntry -> Bool
$c/= :: DBusErrorEntry -> DBusErrorEntry -> Bool
/= :: DBusErrorEntry -> DBusErrorEntry -> Bool
Eq)
instance SP.ManagedPtrNewtype DBusErrorEntry where
toManagedPtr :: DBusErrorEntry -> ManagedPtr DBusErrorEntry
toManagedPtr (DBusErrorEntry ManagedPtr DBusErrorEntry
p) = ManagedPtr DBusErrorEntry
p
instance BoxedPtr DBusErrorEntry where
boxedPtrCopy :: DBusErrorEntry -> IO DBusErrorEntry
boxedPtrCopy = \DBusErrorEntry
p -> DBusErrorEntry
-> (Ptr DBusErrorEntry -> IO DBusErrorEntry) -> IO DBusErrorEntry
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr DBusErrorEntry
p (Int -> Ptr DBusErrorEntry -> IO (Ptr DBusErrorEntry)
forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
copyBytes Int
16 (Ptr DBusErrorEntry -> IO (Ptr DBusErrorEntry))
-> (Ptr DBusErrorEntry -> IO DBusErrorEntry)
-> Ptr DBusErrorEntry
-> IO DBusErrorEntry
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr DBusErrorEntry -> DBusErrorEntry)
-> Ptr DBusErrorEntry -> IO DBusErrorEntry
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.wrapPtr ManagedPtr DBusErrorEntry -> DBusErrorEntry
DBusErrorEntry)
boxedPtrFree :: DBusErrorEntry -> IO ()
boxedPtrFree = \DBusErrorEntry
x -> DBusErrorEntry -> (Ptr DBusErrorEntry -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
SP.withManagedPtr DBusErrorEntry
x Ptr DBusErrorEntry -> IO ()
forall a. Ptr a -> IO ()
SP.freeMem
instance CallocPtr DBusErrorEntry where
boxedPtrCalloc :: IO (Ptr DBusErrorEntry)
boxedPtrCalloc = Int -> IO (Ptr DBusErrorEntry)
forall a. Int -> IO (Ptr a)
callocBytes Int
16
newZeroDBusErrorEntry :: MonadIO m => m DBusErrorEntry
newZeroDBusErrorEntry :: forall (m :: * -> *). MonadIO m => m DBusErrorEntry
newZeroDBusErrorEntry = IO DBusErrorEntry -> m DBusErrorEntry
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DBusErrorEntry -> m DBusErrorEntry)
-> IO DBusErrorEntry -> m DBusErrorEntry
forall a b. (a -> b) -> a -> b
$ IO (Ptr DBusErrorEntry)
forall a. CallocPtr a => IO (Ptr a)
boxedPtrCalloc IO (Ptr DBusErrorEntry)
-> (Ptr DBusErrorEntry -> IO DBusErrorEntry) -> IO DBusErrorEntry
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr DBusErrorEntry -> DBusErrorEntry)
-> Ptr DBusErrorEntry -> IO DBusErrorEntry
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr DBusErrorEntry -> DBusErrorEntry
DBusErrorEntry
instance tag ~ 'AttrSet => Constructible DBusErrorEntry tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr DBusErrorEntry -> DBusErrorEntry)
-> [AttrOp DBusErrorEntry tag] -> m DBusErrorEntry
new ManagedPtr DBusErrorEntry -> DBusErrorEntry
_ [AttrOp DBusErrorEntry tag]
attrs = do
o <- m DBusErrorEntry
forall (m :: * -> *). MonadIO m => m DBusErrorEntry
newZeroDBusErrorEntry
GI.Attributes.set o attrs
return o
getDBusErrorEntryErrorCode :: MonadIO m => DBusErrorEntry -> m Int32
getDBusErrorEntryErrorCode :: forall (m :: * -> *). MonadIO m => DBusErrorEntry -> m Int32
getDBusErrorEntryErrorCode DBusErrorEntry
s = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ DBusErrorEntry -> (Ptr DBusErrorEntry -> IO Int32) -> IO Int32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusErrorEntry
s ((Ptr DBusErrorEntry -> IO Int32) -> IO Int32)
-> (Ptr DBusErrorEntry -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \Ptr DBusErrorEntry
ptr -> do
val <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek (Ptr DBusErrorEntry
ptr Ptr DBusErrorEntry -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO Int32
return val
setDBusErrorEntryErrorCode :: MonadIO m => DBusErrorEntry -> Int32 -> m ()
setDBusErrorEntryErrorCode :: forall (m :: * -> *). MonadIO m => DBusErrorEntry -> Int32 -> m ()
setDBusErrorEntryErrorCode DBusErrorEntry
s Int32
val = 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
$ DBusErrorEntry -> (Ptr DBusErrorEntry -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusErrorEntry
s ((Ptr DBusErrorEntry -> IO ()) -> IO ())
-> (Ptr DBusErrorEntry -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DBusErrorEntry
ptr -> do
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DBusErrorEntry
ptr Ptr DBusErrorEntry -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (Int32
val :: Int32)
#if defined(ENABLE_OVERLOADING)
data DBusErrorEntryErrorCodeFieldInfo
instance AttrInfo DBusErrorEntryErrorCodeFieldInfo where
type AttrBaseTypeConstraint DBusErrorEntryErrorCodeFieldInfo = (~) DBusErrorEntry
type AttrAllowedOps DBusErrorEntryErrorCodeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint DBusErrorEntryErrorCodeFieldInfo = (~) Int32
type AttrTransferTypeConstraint DBusErrorEntryErrorCodeFieldInfo = (~)Int32
type AttrTransferType DBusErrorEntryErrorCodeFieldInfo = Int32
type AttrGetType DBusErrorEntryErrorCodeFieldInfo = Int32
type AttrLabel DBusErrorEntryErrorCodeFieldInfo = "error_code"
type AttrOrigin DBusErrorEntryErrorCodeFieldInfo = DBusErrorEntry
attrGet = getDBusErrorEntryErrorCode
attrSet = setDBusErrorEntryErrorCode
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Structs.DBusErrorEntry.errorCode"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Structs-DBusErrorEntry.html#g:attr:errorCode"
})
dBusErrorEntry_errorCode :: AttrLabelProxy "errorCode"
dBusErrorEntry_errorCode = AttrLabelProxy
#endif
getDBusErrorEntryDbusErrorName :: MonadIO m => DBusErrorEntry -> m (Maybe T.Text)
getDBusErrorEntryDbusErrorName :: forall (m :: * -> *). MonadIO m => DBusErrorEntry -> m (Maybe Text)
getDBusErrorEntryDbusErrorName DBusErrorEntry
s = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ DBusErrorEntry
-> (Ptr DBusErrorEntry -> IO (Maybe Text)) -> IO (Maybe Text)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusErrorEntry
s ((Ptr DBusErrorEntry -> IO (Maybe Text)) -> IO (Maybe Text))
-> (Ptr DBusErrorEntry -> IO (Maybe Text)) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \Ptr DBusErrorEntry
ptr -> do
val <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek (Ptr DBusErrorEntry
ptr Ptr DBusErrorEntry -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) :: IO CString
result <- SP.convertIfNonNull val $ \CString
val' -> do
val'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
val'
return val''
return result
setDBusErrorEntryDbusErrorName :: MonadIO m => DBusErrorEntry -> CString -> m ()
setDBusErrorEntryDbusErrorName :: forall (m :: * -> *).
MonadIO m =>
DBusErrorEntry -> CString -> m ()
setDBusErrorEntryDbusErrorName DBusErrorEntry
s CString
val = 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
$ DBusErrorEntry -> (Ptr DBusErrorEntry -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusErrorEntry
s ((Ptr DBusErrorEntry -> IO ()) -> IO ())
-> (Ptr DBusErrorEntry -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DBusErrorEntry
ptr -> do
Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DBusErrorEntry
ptr Ptr DBusErrorEntry -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (CString
val :: CString)
clearDBusErrorEntryDbusErrorName :: MonadIO m => DBusErrorEntry -> m ()
clearDBusErrorEntryDbusErrorName :: forall (m :: * -> *). MonadIO m => DBusErrorEntry -> m ()
clearDBusErrorEntryDbusErrorName DBusErrorEntry
s = 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
$ DBusErrorEntry -> (Ptr DBusErrorEntry -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DBusErrorEntry
s ((Ptr DBusErrorEntry -> IO ()) -> IO ())
-> (Ptr DBusErrorEntry -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DBusErrorEntry
ptr -> do
Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr DBusErrorEntry
ptr Ptr DBusErrorEntry -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (CString
forall a. Ptr a
FP.nullPtr :: CString)
#if defined(ENABLE_OVERLOADING)
data DBusErrorEntryDbusErrorNameFieldInfo
instance AttrInfo DBusErrorEntryDbusErrorNameFieldInfo where
type AttrBaseTypeConstraint DBusErrorEntryDbusErrorNameFieldInfo = (~) DBusErrorEntry
type AttrAllowedOps DBusErrorEntryDbusErrorNameFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint DBusErrorEntryDbusErrorNameFieldInfo = (~) CString
type AttrTransferTypeConstraint DBusErrorEntryDbusErrorNameFieldInfo = (~)CString
type AttrTransferType DBusErrorEntryDbusErrorNameFieldInfo = CString
type AttrGetType DBusErrorEntryDbusErrorNameFieldInfo = Maybe T.Text
type AttrLabel DBusErrorEntryDbusErrorNameFieldInfo = "dbus_error_name"
type AttrOrigin DBusErrorEntryDbusErrorNameFieldInfo = DBusErrorEntry
attrGet = getDBusErrorEntryDbusErrorName
attrSet = setDBusErrorEntryDbusErrorName
attrConstruct = undefined
attrClear = clearDBusErrorEntryDbusErrorName
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Structs.DBusErrorEntry.dbusErrorName"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Structs-DBusErrorEntry.html#g:attr:dbusErrorName"
})
dBusErrorEntry_dbusErrorName :: AttrLabelProxy "dbusErrorName"
dBusErrorEntry_dbusErrorName = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList DBusErrorEntry
type instance O.AttributeList DBusErrorEntry = DBusErrorEntryAttributeList
type DBusErrorEntryAttributeList = ('[ '("errorCode", DBusErrorEntryErrorCodeFieldInfo), '("dbusErrorName", DBusErrorEntryDbusErrorNameFieldInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveDBusErrorEntryMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveDBusErrorEntryMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveDBusErrorEntryMethod t DBusErrorEntry, O.OverloadedMethod info DBusErrorEntry p) => OL.IsLabel t (DBusErrorEntry -> 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 ~ ResolveDBusErrorEntryMethod t DBusErrorEntry, O.OverloadedMethod info DBusErrorEntry p, R.HasField t DBusErrorEntry p) => R.HasField t DBusErrorEntry p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveDBusErrorEntryMethod t DBusErrorEntry, O.OverloadedMethodInfo info DBusErrorEntry) => OL.IsLabel t (O.MethodProxy info DBusErrorEntry) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif