#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.GObject.Structs.FlagsValue
(
FlagsValue(..) ,
newZeroFlagsValue ,
noFlagsValue ,
#if ENABLE_OVERLOADING
flagsValue_value ,
#endif
getFlagsValueValue ,
setFlagsValueValue ,
clearFlagsValueValueName ,
#if ENABLE_OVERLOADING
flagsValue_valueName ,
#endif
getFlagsValueValueName ,
setFlagsValueValueName ,
clearFlagsValueValueNick ,
#if ENABLE_OVERLOADING
flagsValue_valueNick ,
#endif
getFlagsValueValueNick ,
setFlagsValueValueNick ,
) 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 FlagsValue = FlagsValue (ManagedPtr FlagsValue)
instance WrappedPtr FlagsValue where
wrappedPtrCalloc = callocBytes 24
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 24 >=> wrapPtr FlagsValue)
wrappedPtrFree = Just ptr_to_g_free
newZeroFlagsValue :: MonadIO m => m FlagsValue
newZeroFlagsValue = liftIO $ wrappedPtrCalloc >>= wrapPtr FlagsValue
instance tag ~ 'AttrSet => Constructible FlagsValue tag where
new _ attrs = do
o <- newZeroFlagsValue
GI.Attributes.set o attrs
return o
noFlagsValue :: Maybe FlagsValue
noFlagsValue = Nothing
getFlagsValueValue :: MonadIO m => FlagsValue -> m Word32
getFlagsValueValue s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO Word32
return val
setFlagsValueValue :: MonadIO m => FlagsValue -> Word32 -> m ()
setFlagsValueValue s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (val :: Word32)
#if ENABLE_OVERLOADING
data FlagsValueValueFieldInfo
instance AttrInfo FlagsValueValueFieldInfo where
type AttrAllowedOps FlagsValueValueFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint FlagsValueValueFieldInfo = (~) Word32
type AttrBaseTypeConstraint FlagsValueValueFieldInfo = (~) FlagsValue
type AttrGetType FlagsValueValueFieldInfo = Word32
type AttrLabel FlagsValueValueFieldInfo = "value"
type AttrOrigin FlagsValueValueFieldInfo = FlagsValue
attrGet _ = getFlagsValueValue
attrSet _ = setFlagsValueValue
attrConstruct = undefined
attrClear _ = undefined
flagsValue_value :: AttrLabelProxy "value"
flagsValue_value = AttrLabelProxy
#endif
getFlagsValueValueName :: MonadIO m => FlagsValue -> m (Maybe T.Text)
getFlagsValueValueName 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
setFlagsValueValueName :: MonadIO m => FlagsValue -> CString -> m ()
setFlagsValueValueName s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: CString)
clearFlagsValueValueName :: MonadIO m => FlagsValue -> m ()
clearFlagsValueValueName s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (FP.nullPtr :: CString)
#if ENABLE_OVERLOADING
data FlagsValueValueNameFieldInfo
instance AttrInfo FlagsValueValueNameFieldInfo where
type AttrAllowedOps FlagsValueValueNameFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint FlagsValueValueNameFieldInfo = (~) CString
type AttrBaseTypeConstraint FlagsValueValueNameFieldInfo = (~) FlagsValue
type AttrGetType FlagsValueValueNameFieldInfo = Maybe T.Text
type AttrLabel FlagsValueValueNameFieldInfo = "value_name"
type AttrOrigin FlagsValueValueNameFieldInfo = FlagsValue
attrGet _ = getFlagsValueValueName
attrSet _ = setFlagsValueValueName
attrConstruct = undefined
attrClear _ = clearFlagsValueValueName
flagsValue_valueName :: AttrLabelProxy "valueName"
flagsValue_valueName = AttrLabelProxy
#endif
getFlagsValueValueNick :: MonadIO m => FlagsValue -> m (Maybe T.Text)
getFlagsValueValueNick s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
setFlagsValueValueNick :: MonadIO m => FlagsValue -> CString -> m ()
setFlagsValueValueNick s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 16) (val :: CString)
clearFlagsValueValueNick :: MonadIO m => FlagsValue -> m ()
clearFlagsValueValueNick s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 16) (FP.nullPtr :: CString)
#if ENABLE_OVERLOADING
data FlagsValueValueNickFieldInfo
instance AttrInfo FlagsValueValueNickFieldInfo where
type AttrAllowedOps FlagsValueValueNickFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint FlagsValueValueNickFieldInfo = (~) CString
type AttrBaseTypeConstraint FlagsValueValueNickFieldInfo = (~) FlagsValue
type AttrGetType FlagsValueValueNickFieldInfo = Maybe T.Text
type AttrLabel FlagsValueValueNickFieldInfo = "value_nick"
type AttrOrigin FlagsValueValueNickFieldInfo = FlagsValue
attrGet _ = getFlagsValueValueNick
attrSet _ = setFlagsValueValueNick
attrConstruct = undefined
attrClear _ = clearFlagsValueValueNick
flagsValue_valueNick :: AttrLabelProxy "valueNick"
flagsValue_valueNick = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList FlagsValue
type instance O.AttributeList FlagsValue = FlagsValueAttributeList
type FlagsValueAttributeList = ('[ '("value", FlagsValueValueFieldInfo), '("valueName", FlagsValueValueNameFieldInfo), '("valueNick", FlagsValueValueNickFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveFlagsValueMethod (t :: Symbol) (o :: *) :: * where
ResolveFlagsValueMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFlagsValueMethod t FlagsValue, O.MethodInfo info FlagsValue p) => OL.IsLabel t (FlagsValue -> 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