1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
-- | Information on explicit allocation/deallocation for foreign pointers.
module Data.GI.GIR.Allocation
( AllocationInfo(..)
, AllocationOp(..)
, unknownAllocationInfo
) where
import Data.Text (Text)
-- | Allocation/deallocation information for a given foreign pointer.
data AllocationInfo = AllocationInfo {
allocCalloc :: AllocationOp
, allocCopy :: AllocationOp
, allocFree :: AllocationOp
} deriving (Show)
-- | Information about a given allocation operation. It is either disallowed,
-- allowed via the given function, or it is unknown at the current
-- stage how to perform the operation.
data AllocationOp = AllocationOpUnknown
| AllocationOp Text
deriving (Show, Eq)
-- | A convenience function, filling in all the allocation info to unknown.
unknownAllocationInfo :: AllocationInfo
unknownAllocationInfo = AllocationInfo {
allocCalloc = AllocationOpUnknown
, allocCopy = AllocationOpUnknown
, allocFree = AllocationOpUnknown
}
|