openxr-0.1: Bindings to the OpenXR API
Safe HaskellNone
LanguageHaskell2010

OpenXR.CStruct.Utils

Synopsis

Documentation

pokeFixedLengthByteString :: forall n. KnownNat n => Ptr (FixedArray n Word8) -> ByteString -> IO () Source #

Store a ByteString in a fixed amount of space, truncating if necessary.

If the ByteString is not long enough to fill the space the remaining bytes are unchanged

pokeFixedLengthNullTerminatedByteString :: forall n. KnownNat n => Ptr (FixedArray n CChar) -> ByteString -> IO () Source #

Store a ByteString in a fixed amount of space inserting a null character at the end and truncating if necessary.

If the ByteString is not long enough to fill the space the remaining bytes are unchanged

Note that if the ByteString is exactly long enough the last byte will still be replaced with 0

peekByteStringFromSizedVectorPtr :: forall n. KnownNat n => Ptr (FixedArray n Word8) -> IO ByteString Source #

Peek a ByteString from a fixed sized array of bytes

callocFixedArray :: forall n a. (KnownNat n, Storable a) => IO (Ptr (FixedArray n a)) Source #

Allocate a zero array with the size specified by the FixedArray return type. Make sure to release the memory with free

lowerArrayPtr :: forall a n. Ptr (FixedArray n a) -> Ptr a Source #

Get the pointer to the first element in the array

advancePtrBytes :: Ptr a -> Int -> Ptr a Source #

A type restricted plusPtr

data FixedArray (n :: Nat) (a :: Type) Source #

An unpopulated type intended to be used as in Ptr (FixedArray n a) to indicate that the pointer points to an array of n as