#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.GLib.Structs.OptionEntry
(
OptionEntry(..) ,
newZeroOptionEntry ,
noOptionEntry ,
getOptionEntryArg ,
#if ENABLE_OVERLOADING
optionEntry_arg ,
#endif
setOptionEntryArg ,
clearOptionEntryArgData ,
getOptionEntryArgData ,
#if ENABLE_OVERLOADING
optionEntry_argData ,
#endif
setOptionEntryArgData ,
clearOptionEntryArgDescription ,
getOptionEntryArgDescription ,
#if ENABLE_OVERLOADING
optionEntry_argDescription ,
#endif
setOptionEntryArgDescription ,
clearOptionEntryDescription ,
getOptionEntryDescription ,
#if ENABLE_OVERLOADING
optionEntry_description ,
#endif
setOptionEntryDescription ,
getOptionEntryFlags ,
#if ENABLE_OVERLOADING
optionEntry_flags ,
#endif
setOptionEntryFlags ,
clearOptionEntryLongName ,
getOptionEntryLongName ,
#if ENABLE_OVERLOADING
optionEntry_longName ,
#endif
setOptionEntryLongName ,
getOptionEntryShortName ,
#if ENABLE_OVERLOADING
optionEntry_shortName ,
#endif
setOptionEntryShortName ,
) 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.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.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import {-# SOURCE #-} qualified GI.GLib.Enums as GLib.Enums
newtype OptionEntry = OptionEntry (ManagedPtr OptionEntry)
instance WrappedPtr OptionEntry where
wrappedPtrCalloc = callocBytes 48
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 48 >=> wrapPtr OptionEntry)
wrappedPtrFree = Just ptr_to_g_free
newZeroOptionEntry :: MonadIO m => m OptionEntry
newZeroOptionEntry = liftIO $ wrappedPtrCalloc >>= wrapPtr OptionEntry
instance tag ~ 'AttrSet => Constructible OptionEntry tag where
new _ attrs = do
o <- newZeroOptionEntry
GI.Attributes.set o attrs
return o
noOptionEntry :: Maybe OptionEntry
noOptionEntry = Nothing
getOptionEntryLongName :: MonadIO m => OptionEntry -> m (Maybe T.Text)
getOptionEntryLongName s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
setOptionEntryLongName :: MonadIO m => OptionEntry -> CString -> m ()
setOptionEntryLongName s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (val :: CString)
clearOptionEntryLongName :: MonadIO m => OptionEntry -> m ()
clearOptionEntryLongName s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (FP.nullPtr :: CString)
#if ENABLE_OVERLOADING
data OptionEntryLongNameFieldInfo
instance AttrInfo OptionEntryLongNameFieldInfo where
type AttrAllowedOps OptionEntryLongNameFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint OptionEntryLongNameFieldInfo = (~) CString
type AttrBaseTypeConstraint OptionEntryLongNameFieldInfo = (~) OptionEntry
type AttrGetType OptionEntryLongNameFieldInfo = Maybe T.Text
type AttrLabel OptionEntryLongNameFieldInfo = "long_name"
type AttrOrigin OptionEntryLongNameFieldInfo = OptionEntry
attrGet _ = getOptionEntryLongName
attrSet _ = setOptionEntryLongName
attrConstruct = undefined
attrClear _ = clearOptionEntryLongName
optionEntry_longName :: AttrLabelProxy "longName"
optionEntry_longName = AttrLabelProxy
#endif
getOptionEntryShortName :: MonadIO m => OptionEntry -> m Int8
getOptionEntryShortName s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO Int8
return val
setOptionEntryShortName :: MonadIO m => OptionEntry -> Int8 -> m ()
setOptionEntryShortName s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: Int8)
#if ENABLE_OVERLOADING
data OptionEntryShortNameFieldInfo
instance AttrInfo OptionEntryShortNameFieldInfo where
type AttrAllowedOps OptionEntryShortNameFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint OptionEntryShortNameFieldInfo = (~) Int8
type AttrBaseTypeConstraint OptionEntryShortNameFieldInfo = (~) OptionEntry
type AttrGetType OptionEntryShortNameFieldInfo = Int8
type AttrLabel OptionEntryShortNameFieldInfo = "short_name"
type AttrOrigin OptionEntryShortNameFieldInfo = OptionEntry
attrGet _ = getOptionEntryShortName
attrSet _ = setOptionEntryShortName
attrConstruct = undefined
attrClear _ = undefined
optionEntry_shortName :: AttrLabelProxy "shortName"
optionEntry_shortName = AttrLabelProxy
#endif
getOptionEntryFlags :: MonadIO m => OptionEntry -> m Int32
getOptionEntryFlags s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 12) :: IO Int32
return val
setOptionEntryFlags :: MonadIO m => OptionEntry -> Int32 -> m ()
setOptionEntryFlags s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 12) (val :: Int32)
#if ENABLE_OVERLOADING
data OptionEntryFlagsFieldInfo
instance AttrInfo OptionEntryFlagsFieldInfo where
type AttrAllowedOps OptionEntryFlagsFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint OptionEntryFlagsFieldInfo = (~) Int32
type AttrBaseTypeConstraint OptionEntryFlagsFieldInfo = (~) OptionEntry
type AttrGetType OptionEntryFlagsFieldInfo = Int32
type AttrLabel OptionEntryFlagsFieldInfo = "flags"
type AttrOrigin OptionEntryFlagsFieldInfo = OptionEntry
attrGet _ = getOptionEntryFlags
attrSet _ = setOptionEntryFlags
attrConstruct = undefined
attrClear _ = undefined
optionEntry_flags :: AttrLabelProxy "flags"
optionEntry_flags = AttrLabelProxy
#endif
getOptionEntryArg :: MonadIO m => OptionEntry -> m GLib.Enums.OptionArg
getOptionEntryArg s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
setOptionEntryArg :: MonadIO m => OptionEntry -> GLib.Enums.OptionArg -> m ()
setOptionEntryArg s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = (fromIntegral . fromEnum) val
poke (ptr `plusPtr` 16) (val' :: CUInt)
#if ENABLE_OVERLOADING
data OptionEntryArgFieldInfo
instance AttrInfo OptionEntryArgFieldInfo where
type AttrAllowedOps OptionEntryArgFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint OptionEntryArgFieldInfo = (~) GLib.Enums.OptionArg
type AttrBaseTypeConstraint OptionEntryArgFieldInfo = (~) OptionEntry
type AttrGetType OptionEntryArgFieldInfo = GLib.Enums.OptionArg
type AttrLabel OptionEntryArgFieldInfo = "arg"
type AttrOrigin OptionEntryArgFieldInfo = OptionEntry
attrGet _ = getOptionEntryArg
attrSet _ = setOptionEntryArg
attrConstruct = undefined
attrClear _ = undefined
optionEntry_arg :: AttrLabelProxy "arg"
optionEntry_arg = AttrLabelProxy
#endif
getOptionEntryArgData :: MonadIO m => OptionEntry -> m (Ptr ())
getOptionEntryArgData s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO (Ptr ())
return val
setOptionEntryArgData :: MonadIO m => OptionEntry -> Ptr () -> m ()
setOptionEntryArgData s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 24) (val :: Ptr ())
clearOptionEntryArgData :: MonadIO m => OptionEntry -> m ()
clearOptionEntryArgData s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 24) (FP.nullPtr :: Ptr ())
#if ENABLE_OVERLOADING
data OptionEntryArgDataFieldInfo
instance AttrInfo OptionEntryArgDataFieldInfo where
type AttrAllowedOps OptionEntryArgDataFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint OptionEntryArgDataFieldInfo = (~) (Ptr ())
type AttrBaseTypeConstraint OptionEntryArgDataFieldInfo = (~) OptionEntry
type AttrGetType OptionEntryArgDataFieldInfo = Ptr ()
type AttrLabel OptionEntryArgDataFieldInfo = "arg_data"
type AttrOrigin OptionEntryArgDataFieldInfo = OptionEntry
attrGet _ = getOptionEntryArgData
attrSet _ = setOptionEntryArgData
attrConstruct = undefined
attrClear _ = clearOptionEntryArgData
optionEntry_argData :: AttrLabelProxy "argData"
optionEntry_argData = AttrLabelProxy
#endif
getOptionEntryDescription :: MonadIO m => OptionEntry -> m (Maybe T.Text)
getOptionEntryDescription s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 32) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
setOptionEntryDescription :: MonadIO m => OptionEntry -> CString -> m ()
setOptionEntryDescription s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 32) (val :: CString)
clearOptionEntryDescription :: MonadIO m => OptionEntry -> m ()
clearOptionEntryDescription s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 32) (FP.nullPtr :: CString)
#if ENABLE_OVERLOADING
data OptionEntryDescriptionFieldInfo
instance AttrInfo OptionEntryDescriptionFieldInfo where
type AttrAllowedOps OptionEntryDescriptionFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint OptionEntryDescriptionFieldInfo = (~) CString
type AttrBaseTypeConstraint OptionEntryDescriptionFieldInfo = (~) OptionEntry
type AttrGetType OptionEntryDescriptionFieldInfo = Maybe T.Text
type AttrLabel OptionEntryDescriptionFieldInfo = "description"
type AttrOrigin OptionEntryDescriptionFieldInfo = OptionEntry
attrGet _ = getOptionEntryDescription
attrSet _ = setOptionEntryDescription
attrConstruct = undefined
attrClear _ = clearOptionEntryDescription
optionEntry_description :: AttrLabelProxy "description"
optionEntry_description = AttrLabelProxy
#endif
getOptionEntryArgDescription :: MonadIO m => OptionEntry -> m (Maybe T.Text)
getOptionEntryArgDescription s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 40) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
setOptionEntryArgDescription :: MonadIO m => OptionEntry -> CString -> m ()
setOptionEntryArgDescription s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 40) (val :: CString)
clearOptionEntryArgDescription :: MonadIO m => OptionEntry -> m ()
clearOptionEntryArgDescription s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 40) (FP.nullPtr :: CString)
#if ENABLE_OVERLOADING
data OptionEntryArgDescriptionFieldInfo
instance AttrInfo OptionEntryArgDescriptionFieldInfo where
type AttrAllowedOps OptionEntryArgDescriptionFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint OptionEntryArgDescriptionFieldInfo = (~) CString
type AttrBaseTypeConstraint OptionEntryArgDescriptionFieldInfo = (~) OptionEntry
type AttrGetType OptionEntryArgDescriptionFieldInfo = Maybe T.Text
type AttrLabel OptionEntryArgDescriptionFieldInfo = "arg_description"
type AttrOrigin OptionEntryArgDescriptionFieldInfo = OptionEntry
attrGet _ = getOptionEntryArgDescription
attrSet _ = setOptionEntryArgDescription
attrConstruct = undefined
attrClear _ = clearOptionEntryArgDescription
optionEntry_argDescription :: AttrLabelProxy "argDescription"
optionEntry_argDescription = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList OptionEntry
type instance O.AttributeList OptionEntry = OptionEntryAttributeList
type OptionEntryAttributeList = ('[ '("longName", OptionEntryLongNameFieldInfo), '("shortName", OptionEntryShortNameFieldInfo), '("flags", OptionEntryFlagsFieldInfo), '("arg", OptionEntryArgFieldInfo), '("argData", OptionEntryArgDataFieldInfo), '("description", OptionEntryDescriptionFieldInfo), '("argDescription", OptionEntryArgDescriptionFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveOptionEntryMethod (t :: Symbol) (o :: *) :: * where
ResolveOptionEntryMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveOptionEntryMethod t OptionEntry, O.MethodInfo info OptionEntry p) => O.IsLabelProxy t (OptionEntry -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveOptionEntryMethod t OptionEntry, O.MethodInfo info OptionEntry p) => O.IsLabel t (OptionEntry -> 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
#endif