Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
BitReader
provides a bit reader that can read any number of bits
from a memory buffer. It provides functions for reading any number of bits
into 8, 16, 32 and 64 bit variables.
- newtype BitReader = BitReader (ManagedPtr BitReader)
- newZeroBitReader :: MonadIO m => m BitReader
- noBitReader :: Maybe BitReader
- data BitReaderFreeMethodInfo
- bitReaderFree :: (HasCallStack, MonadIO m) => BitReader -> m ()
- data BitReaderGetBitsUint16MethodInfo
- bitReaderGetBitsUint16 :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m (Bool, Word16)
- data BitReaderGetBitsUint32MethodInfo
- bitReaderGetBitsUint32 :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m (Bool, Word32)
- data BitReaderGetBitsUint64MethodInfo
- bitReaderGetBitsUint64 :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m (Bool, Word64)
- data BitReaderGetBitsUint8MethodInfo
- bitReaderGetBitsUint8 :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m (Bool, Word8)
- data BitReaderGetPosMethodInfo
- bitReaderGetPos :: (HasCallStack, MonadIO m) => BitReader -> m Word32
- data BitReaderGetRemainingMethodInfo
- bitReaderGetRemaining :: (HasCallStack, MonadIO m) => BitReader -> m Word32
- data BitReaderGetSizeMethodInfo
- bitReaderGetSize :: (HasCallStack, MonadIO m) => BitReader -> m Word32
- data BitReaderInitMethodInfo
- bitReaderInit :: (HasCallStack, MonadIO m) => BitReader -> ByteString -> m ()
- data BitReaderPeekBitsUint16MethodInfo
- bitReaderPeekBitsUint16 :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m (Bool, Word16)
- data BitReaderPeekBitsUint32MethodInfo
- bitReaderPeekBitsUint32 :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m (Bool, Word32)
- data BitReaderPeekBitsUint64MethodInfo
- bitReaderPeekBitsUint64 :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m (Bool, Word64)
- data BitReaderPeekBitsUint8MethodInfo
- bitReaderPeekBitsUint8 :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m (Bool, Word8)
- data BitReaderSetPosMethodInfo
- bitReaderSetPos :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m Bool
- data BitReaderSkipMethodInfo
- bitReaderSkip :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m Bool
- data BitReaderSkipToByteMethodInfo
- bitReaderSkipToByte :: (HasCallStack, MonadIO m) => BitReader -> m Bool
- bitReader_bit :: AttrLabelProxy "bit"
- getBitReaderBit :: MonadIO m => BitReader -> m Word32
- setBitReaderBit :: MonadIO m => BitReader -> Word32 -> m ()
- bitReader_byte :: AttrLabelProxy "byte"
- getBitReaderByte :: MonadIO m => BitReader -> m Word32
- setBitReaderByte :: MonadIO m => BitReader -> Word32 -> m ()
- bitReader_size :: AttrLabelProxy "size"
- getBitReaderSize :: MonadIO m => BitReader -> m Word32
- setBitReaderSize :: MonadIO m => BitReader -> Word32 -> m ()
Exported types
newZeroBitReader :: MonadIO m => m BitReader Source #
Construct a BitReader
struct initialized to zero.
Methods
free
data BitReaderFreeMethodInfo Source #
((~) * signature (m ()), MonadIO m) => MethodInfo * BitReaderFreeMethodInfo BitReader signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> m () |
Frees a BitReader
instance, which was previously allocated by
gst_bit_reader_new()
.
getBitsUint16
bitReaderGetBitsUint16 Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m (Bool, Word16) |
Read nbits
bits into val
and update the current position.
getBitsUint32
bitReaderGetBitsUint32 Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m (Bool, Word32) |
Read nbits
bits into val
and update the current position.
getBitsUint64
bitReaderGetBitsUint64 Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m (Bool, Word64) |
Read nbits
bits into val
and update the current position.
getBitsUint8
bitReaderGetBitsUint8 Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m (Bool, Word8) |
Read nbits
bits into val
and update the current position.
getPos
data BitReaderGetPosMethodInfo Source #
((~) * signature (m Word32), MonadIO m) => MethodInfo * BitReaderGetPosMethodInfo BitReader signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> m Word32 | Returns: The current position of |
Returns the current position of a BitReader
instance in bits.
getRemaining
data BitReaderGetRemainingMethodInfo Source #
((~) * signature (m Word32), MonadIO m) => MethodInfo * BitReaderGetRemainingMethodInfo BitReader signature Source # | |
bitReaderGetRemaining Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> m Word32 | Returns: The remaining number of bits of |
Returns the remaining number of bits of a BitReader
instance.
getSize
data BitReaderGetSizeMethodInfo Source #
((~) * signature (m Word32), MonadIO m) => MethodInfo * BitReaderGetSizeMethodInfo BitReader signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> m Word32 | Returns: The total number of bits of |
Returns the total number of bits of a BitReader
instance.
init
data BitReaderInitMethodInfo Source #
((~) * signature (ByteString -> m ()), MonadIO m) => MethodInfo * BitReaderInitMethodInfo BitReader signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> ByteString |
|
-> m () |
Initializes a BitReader
instance to read from data
. This function
can be called on already initialized instances.
peekBitsUint16
bitReaderPeekBitsUint16 Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m (Bool, Word16) |
Read nbits
bits into val
but keep the current position.
peekBitsUint32
bitReaderPeekBitsUint32 Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m (Bool, Word32) |
Read nbits
bits into val
but keep the current position.
peekBitsUint64
bitReaderPeekBitsUint64 Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m (Bool, Word64) |
Read nbits
bits into val
but keep the current position.
peekBitsUint8
bitReaderPeekBitsUint8 Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m (Bool, Word8) |
Read nbits
bits into val
but keep the current position.
setPos
data BitReaderSetPosMethodInfo Source #
((~) * signature (Word32 -> m Bool), MonadIO m) => MethodInfo * BitReaderSetPosMethodInfo BitReader signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m Bool | Returns: |
Sets the new position of a BitReader
instance to pos
in bits.
skip
data BitReaderSkipMethodInfo Source #
((~) * signature (Word32 -> m Bool), MonadIO m) => MethodInfo * BitReaderSkipMethodInfo BitReader signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m Bool | Returns: |
Skips nbits
bits of the BitReader
instance.
skipToByte
data BitReaderSkipToByteMethodInfo Source #
((~) * signature (m Bool), MonadIO m) => MethodInfo * BitReaderSkipToByteMethodInfo BitReader signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> m Bool |
Skips until the next byte.
Properties
bit
bitReader_bit :: AttrLabelProxy "bit" Source #
byte
bitReader_byte :: AttrLabelProxy "byte" Source #
size
bitReader_size :: AttrLabelProxy "size" Source #