#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.GObject.Structs.FlagsClass
(
FlagsClass(..) ,
newZeroFlagsClass ,
noFlagsClass ,
#if ENABLE_OVERLOADING
flagsClass_gTypeClass ,
#endif
getFlagsClassGTypeClass ,
#if ENABLE_OVERLOADING
flagsClass_mask ,
#endif
getFlagsClassMask ,
setFlagsClassMask ,
#if ENABLE_OVERLOADING
flagsClass_nValues ,
#endif
getFlagsClassNValues ,
setFlagsClassNValues ,
clearFlagsClassValues ,
#if ENABLE_OVERLOADING
flagsClass_values ,
#endif
getFlagsClassValues ,
setFlagsClassValues ,
) 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
import {-# SOURCE #-} qualified GI.GObject.Structs.FlagsValue as GObject.FlagsValue
import {-# SOURCE #-} qualified GI.GObject.Structs.TypeClass as GObject.TypeClass
newtype FlagsClass = FlagsClass (ManagedPtr FlagsClass)
instance WrappedPtr FlagsClass where
wrappedPtrCalloc = callocBytes 24
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 24 >=> wrapPtr FlagsClass)
wrappedPtrFree = Just ptr_to_g_free
newZeroFlagsClass :: MonadIO m => m FlagsClass
newZeroFlagsClass = liftIO $ wrappedPtrCalloc >>= wrapPtr FlagsClass
instance tag ~ 'AttrSet => Constructible FlagsClass tag where
new _ attrs = do
o <- newZeroFlagsClass
GI.Attributes.set o attrs
return o
noFlagsClass :: Maybe FlagsClass
noFlagsClass = Nothing
getFlagsClassGTypeClass :: MonadIO m => FlagsClass -> m GObject.TypeClass.TypeClass
getFlagsClassGTypeClass s = liftIO $ withManagedPtr s $ \ptr -> do
let val = ptr `plusPtr` 0 :: (Ptr GObject.TypeClass.TypeClass)
val' <- (newPtr GObject.TypeClass.TypeClass) val
return val'
#if ENABLE_OVERLOADING
data FlagsClassGTypeClassFieldInfo
instance AttrInfo FlagsClassGTypeClassFieldInfo where
type AttrAllowedOps FlagsClassGTypeClassFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint FlagsClassGTypeClassFieldInfo = (~) (Ptr GObject.TypeClass.TypeClass)
type AttrBaseTypeConstraint FlagsClassGTypeClassFieldInfo = (~) FlagsClass
type AttrGetType FlagsClassGTypeClassFieldInfo = GObject.TypeClass.TypeClass
type AttrLabel FlagsClassGTypeClassFieldInfo = "g_type_class"
type AttrOrigin FlagsClassGTypeClassFieldInfo = FlagsClass
attrGet _ = getFlagsClassGTypeClass
attrSet _ = undefined
attrConstruct = undefined
attrClear _ = undefined
flagsClass_gTypeClass :: AttrLabelProxy "gTypeClass"
flagsClass_gTypeClass = AttrLabelProxy
#endif
getFlagsClassMask :: MonadIO m => FlagsClass -> m Word32
getFlagsClassMask s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO Word32
return val
setFlagsClassMask :: MonadIO m => FlagsClass -> Word32 -> m ()
setFlagsClassMask s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: Word32)
#if ENABLE_OVERLOADING
data FlagsClassMaskFieldInfo
instance AttrInfo FlagsClassMaskFieldInfo where
type AttrAllowedOps FlagsClassMaskFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint FlagsClassMaskFieldInfo = (~) Word32
type AttrBaseTypeConstraint FlagsClassMaskFieldInfo = (~) FlagsClass
type AttrGetType FlagsClassMaskFieldInfo = Word32
type AttrLabel FlagsClassMaskFieldInfo = "mask"
type AttrOrigin FlagsClassMaskFieldInfo = FlagsClass
attrGet _ = getFlagsClassMask
attrSet _ = setFlagsClassMask
attrConstruct = undefined
attrClear _ = undefined
flagsClass_mask :: AttrLabelProxy "mask"
flagsClass_mask = AttrLabelProxy
#endif
getFlagsClassNValues :: MonadIO m => FlagsClass -> m Word32
getFlagsClassNValues s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 12) :: IO Word32
return val
setFlagsClassNValues :: MonadIO m => FlagsClass -> Word32 -> m ()
setFlagsClassNValues s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 12) (val :: Word32)
#if ENABLE_OVERLOADING
data FlagsClassNValuesFieldInfo
instance AttrInfo FlagsClassNValuesFieldInfo where
type AttrAllowedOps FlagsClassNValuesFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint FlagsClassNValuesFieldInfo = (~) Word32
type AttrBaseTypeConstraint FlagsClassNValuesFieldInfo = (~) FlagsClass
type AttrGetType FlagsClassNValuesFieldInfo = Word32
type AttrLabel FlagsClassNValuesFieldInfo = "n_values"
type AttrOrigin FlagsClassNValuesFieldInfo = FlagsClass
attrGet _ = getFlagsClassNValues
attrSet _ = setFlagsClassNValues
attrConstruct = undefined
attrClear _ = undefined
flagsClass_nValues :: AttrLabelProxy "nValues"
flagsClass_nValues = AttrLabelProxy
#endif
getFlagsClassValues :: MonadIO m => FlagsClass -> m (Maybe GObject.FlagsValue.FlagsValue)
getFlagsClassValues s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO (Ptr GObject.FlagsValue.FlagsValue)
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- (newPtr GObject.FlagsValue.FlagsValue) val'
return val''
return result
setFlagsClassValues :: MonadIO m => FlagsClass -> Ptr GObject.FlagsValue.FlagsValue -> m ()
setFlagsClassValues s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 16) (val :: Ptr GObject.FlagsValue.FlagsValue)
clearFlagsClassValues :: MonadIO m => FlagsClass -> m ()
clearFlagsClassValues s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 16) (FP.nullPtr :: Ptr GObject.FlagsValue.FlagsValue)
#if ENABLE_OVERLOADING
data FlagsClassValuesFieldInfo
instance AttrInfo FlagsClassValuesFieldInfo where
type AttrAllowedOps FlagsClassValuesFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint FlagsClassValuesFieldInfo = (~) (Ptr GObject.FlagsValue.FlagsValue)
type AttrBaseTypeConstraint FlagsClassValuesFieldInfo = (~) FlagsClass
type AttrGetType FlagsClassValuesFieldInfo = Maybe GObject.FlagsValue.FlagsValue
type AttrLabel FlagsClassValuesFieldInfo = "values"
type AttrOrigin FlagsClassValuesFieldInfo = FlagsClass
attrGet _ = getFlagsClassValues
attrSet _ = setFlagsClassValues
attrConstruct = undefined
attrClear _ = clearFlagsClassValues
flagsClass_values :: AttrLabelProxy "values"
flagsClass_values = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList FlagsClass
type instance O.AttributeList FlagsClass = FlagsClassAttributeList
type FlagsClassAttributeList = ('[ '("gTypeClass", FlagsClassGTypeClassFieldInfo), '("mask", FlagsClassMaskFieldInfo), '("nValues", FlagsClassNValuesFieldInfo), '("values", FlagsClassValuesFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveFlagsClassMethod (t :: Symbol) (o :: *) :: * where
ResolveFlagsClassMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFlagsClassMethod t FlagsClass, O.MethodInfo info FlagsClass p) => OL.IsLabel t (FlagsClass -> 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