#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gio.Structs.DBusErrorEntry
(
DBusErrorEntry(..) ,
newZeroDBusErrorEntry ,
noDBusErrorEntry ,
clearDBusErrorEntryDbusErrorName ,
#if ENABLE_OVERLOADING
dBusErrorEntry_dbusErrorName ,
#endif
getDBusErrorEntryDbusErrorName ,
setDBusErrorEntryDbusErrorName ,
#if 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.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.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 DBusErrorEntry = DBusErrorEntry (ManagedPtr DBusErrorEntry)
instance WrappedPtr DBusErrorEntry where
wrappedPtrCalloc = callocBytes 16
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 16 >=> wrapPtr DBusErrorEntry)
wrappedPtrFree = Just ptr_to_g_free
newZeroDBusErrorEntry :: MonadIO m => m DBusErrorEntry
newZeroDBusErrorEntry = liftIO $ wrappedPtrCalloc >>= wrapPtr DBusErrorEntry
instance tag ~ 'AttrSet => Constructible DBusErrorEntry tag where
new _ attrs = do
o <- newZeroDBusErrorEntry
GI.Attributes.set o attrs
return o
noDBusErrorEntry :: Maybe DBusErrorEntry
noDBusErrorEntry = Nothing
getDBusErrorEntryErrorCode :: MonadIO m => DBusErrorEntry -> m Int32
getDBusErrorEntryErrorCode s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO Int32
return val
setDBusErrorEntryErrorCode :: MonadIO m => DBusErrorEntry -> Int32 -> m ()
setDBusErrorEntryErrorCode s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (val :: Int32)
#if ENABLE_OVERLOADING
data DBusErrorEntryErrorCodeFieldInfo
instance AttrInfo DBusErrorEntryErrorCodeFieldInfo where
type AttrAllowedOps DBusErrorEntryErrorCodeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint DBusErrorEntryErrorCodeFieldInfo = (~) Int32
type AttrBaseTypeConstraint DBusErrorEntryErrorCodeFieldInfo = (~) DBusErrorEntry
type AttrGetType DBusErrorEntryErrorCodeFieldInfo = Int32
type AttrLabel DBusErrorEntryErrorCodeFieldInfo = "error_code"
type AttrOrigin DBusErrorEntryErrorCodeFieldInfo = DBusErrorEntry
attrGet _ = getDBusErrorEntryErrorCode
attrSet _ = setDBusErrorEntryErrorCode
attrConstruct = undefined
attrClear _ = undefined
dBusErrorEntry_errorCode :: AttrLabelProxy "errorCode"
dBusErrorEntry_errorCode = AttrLabelProxy
#endif
getDBusErrorEntryDbusErrorName :: MonadIO m => DBusErrorEntry -> m (Maybe T.Text)
getDBusErrorEntryDbusErrorName s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
setDBusErrorEntryDbusErrorName :: MonadIO m => DBusErrorEntry -> CString -> m ()
setDBusErrorEntryDbusErrorName s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: CString)
clearDBusErrorEntryDbusErrorName :: MonadIO m => DBusErrorEntry -> m ()
clearDBusErrorEntryDbusErrorName s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (FP.nullPtr :: CString)
#if ENABLE_OVERLOADING
data DBusErrorEntryDbusErrorNameFieldInfo
instance AttrInfo DBusErrorEntryDbusErrorNameFieldInfo where
type AttrAllowedOps DBusErrorEntryDbusErrorNameFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint DBusErrorEntryDbusErrorNameFieldInfo = (~) CString
type AttrBaseTypeConstraint DBusErrorEntryDbusErrorNameFieldInfo = (~) DBusErrorEntry
type AttrGetType DBusErrorEntryDbusErrorNameFieldInfo = Maybe T.Text
type AttrLabel DBusErrorEntryDbusErrorNameFieldInfo = "dbus_error_name"
type AttrOrigin DBusErrorEntryDbusErrorNameFieldInfo = DBusErrorEntry
attrGet _ = getDBusErrorEntryDbusErrorName
attrSet _ = setDBusErrorEntryDbusErrorName
attrConstruct = undefined
attrClear _ = clearDBusErrorEntryDbusErrorName
dBusErrorEntry_dbusErrorName :: AttrLabelProxy "dbusErrorName"
dBusErrorEntry_dbusErrorName = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList DBusErrorEntry
type instance O.AttributeList DBusErrorEntry = DBusErrorEntryAttributeList
type DBusErrorEntryAttributeList = ('[ '("errorCode", DBusErrorEntryErrorCodeFieldInfo), '("dbusErrorName", DBusErrorEntryDbusErrorNameFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveDBusErrorEntryMethod (t :: Symbol) (o :: *) :: * where
ResolveDBusErrorEntryMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveDBusErrorEntryMethod t DBusErrorEntry, O.MethodInfo info DBusErrorEntry p) => OL.IsLabel t (DBusErrorEntry -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif