![]() |
nalchi
|
Bit stream flat API. More...
#include "nalchi/bit_stream.hpp"#include "nalchi/export.hpp"#include <cstdint>Go to the source code of this file.
Functions | |
| nalchi::bit_stream_writer * | nalchi_bit_stream_writer_construct_default () |
Constructs a bit_stream_writer instance without a buffer. | |
| nalchi::bit_stream_writer * | nalchi_bit_stream_writer_construct_with_shared_payload (nalchi::shared_payload buffer, nalchi::bit_stream_writer::size_type logical_bytes_length) |
Constructs a bit_stream_writer instance with a shared_payload buffer. | |
| nalchi::bit_stream_writer * | nalchi_bit_stream_writer_construct_with_word_range (nalchi::bit_stream_writer::word_type *begin, nalchi::bit_stream_writer::word_type *end, nalchi::bit_stream_writer::size_type logical_bytes_length) |
Constructs a bit_stream_writer instance with a word range. | |
| nalchi::bit_stream_writer * | nalchi_bit_stream_writer_construct_with_word_ptr_and_length (nalchi::bit_stream_writer::word_type *begin, nalchi::bit_stream_writer::size_type words_length, nalchi::bit_stream_writer::size_type logical_bytes_length) |
Constructs a bit_stream_writer instance with a word begin pointer and the word length. | |
| void | nalchi_bit_stream_writer_destroy (nalchi::bit_stream_writer *self) |
Destroys the bit_stream_writer instance. | |
| void | nalchi_bit_stream_writer_set_fail (nalchi::bit_stream_writer *self) |
| Force set the fail flag. | |
| bool | nalchi_bit_stream_writer_fail (const nalchi::bit_stream_writer *self) |
| Check if writing to your buffer has been failed or not. | |
| auto | nalchi_bit_stream_writer_total_bytes (const nalchi::bit_stream_writer *self) -> nalchi::bit_stream_writer::size_type |
| Gets the number of total bytes in the stream. | |
| auto | nalchi_bit_stream_writer_total_bits (const nalchi::bit_stream_writer *self) -> nalchi::bit_stream_writer::size_type |
| Gets the number of total bits in the stream. | |
| auto | nalchi_bit_stream_writer_used_bytes (const nalchi::bit_stream_writer *self) -> nalchi::bit_stream_writer::size_type |
| Gets the number of used bytes in the stream. | |
| auto | nalchi_bit_stream_writer_used_bits (const nalchi::bit_stream_writer *self) -> nalchi::bit_stream_writer::size_type |
| Gets the number of used bits in the stream. | |
| auto | nalchi_bit_stream_writer_unused_bytes (const nalchi::bit_stream_writer *self) -> nalchi::bit_stream_writer::size_type |
| Gets the number of unused bytes in the stream. | |
| auto | nalchi_bit_stream_writer_unused_bits (const nalchi::bit_stream_writer *self) -> nalchi::bit_stream_writer::size_type |
| Gets the number of unused bits in the stream. | |
| void | nalchi_bit_stream_writer_restart (nalchi::bit_stream_writer *self) |
| Restarts the stream so that it can write from the beginning again. | |
| void | nalchi_bit_stream_writer_reset (nalchi::bit_stream_writer *self) |
| Resets the stream so that it no longer holds your buffer anymore. | |
| void | nalchi_bit_stream_writer_reset_with_shared_payload (nalchi::bit_stream_writer *self, nalchi::shared_payload buffer, nalchi::bit_stream_writer::size_type logical_bytes_length) |
Resets the stream with a shared_payload buffer. | |
| void | nalchi_bit_stream_writer_reset_with_word_range (nalchi::bit_stream_writer *self, nalchi::bit_stream_writer::word_type *begin, nalchi::bit_stream_writer::word_type *end, nalchi::bit_stream_writer::size_type logical_bytes_length) |
| Resets the stream with a word range. | |
| void | nalchi_bit_stream_writer_reset_with_word_ptr_and_length (nalchi::bit_stream_writer *self, nalchi::bit_stream_writer::word_type *begin, nalchi::bit_stream_writer::size_type words_length, nalchi::bit_stream_writer::size_type logical_bytes_length) |
| Resets the stream with a word begin pointer and the word length. | |
| bool | nalchi_bit_stream_writer_flush_final (nalchi::bit_stream_writer *self) |
| Flushes the last remaining bytes on the internal scratch buffer to your buffer. | |
| bool | nalchi_bit_stream_writer_flushed (const nalchi::bit_stream_writer *self) |
Checks if flush_final() has been called or not. | |
| bool | nalchi_bit_stream_writer_write_bytes (nalchi::bit_stream_writer *self, const void *data, nalchi::bit_stream_writer::size_type size) |
| Writes some arbitrary data to the bit stream. | |
| bool | nalchi_bit_stream_writer_write_bool (nalchi::bit_stream_writer *self, bool data) |
| Writes a bool value to the bit stream. | |
| bool | nalchi_bit_stream_writer_write_s8 (nalchi::bit_stream_writer *self, std::int8_t data, std::int8_t min, std::int8_t max) |
Writes a std::int8_t value to the bit stream. | |
| bool | nalchi_bit_stream_writer_write_u8 (nalchi::bit_stream_writer *self, std::uint8_t data, std::uint8_t min, std::uint8_t max) |
Writes a std::uint8_t value to the bit stream. | |
| bool | nalchi_bit_stream_writer_write_s16 (nalchi::bit_stream_writer *self, std::int16_t data, std::int16_t min, std::int16_t max) |
Writes a std::int16_t value to the bit stream. | |
| bool | nalchi_bit_stream_writer_write_u16 (nalchi::bit_stream_writer *self, std::uint16_t data, std::uint16_t min, std::uint16_t max) |
Writes a std::uint16_t value to the bit stream. | |
| bool | nalchi_bit_stream_writer_write_s32 (nalchi::bit_stream_writer *self, std::int32_t data, std::int32_t min, std::int32_t max) |
Writes a std::int32_t value to the bit stream. | |
| bool | nalchi_bit_stream_writer_write_u32 (nalchi::bit_stream_writer *self, std::uint32_t data, std::uint32_t min, std::uint32_t max) |
Writes a std::uint32_t value to the bit stream. | |
| bool | nalchi_bit_stream_writer_write_s64 (nalchi::bit_stream_writer *self, std::int64_t data, std::int64_t min, std::int64_t max) |
Writes a std::int64_t value to the bit stream. | |
| bool | nalchi_bit_stream_writer_write_u64 (nalchi::bit_stream_writer *self, std::uint64_t data, std::uint64_t min, std::uint64_t max) |
Writes a std::uint64_t value to the bit stream. | |
| bool | nalchi_bit_stream_writer_write_float (nalchi::bit_stream_writer *self, float data) |
| Writes a float value to the bit stream. | |
| bool | nalchi_bit_stream_writer_write_double (nalchi::bit_stream_writer *self, double data) |
| Writes a double value to the bit stream. | |
| bool | nalchi_bit_stream_writer_write_ordinary_string (nalchi::bit_stream_writer *self, const char *str) |
| Writes a null-terminated ordinary string to the bit stream. | |
| bool | nalchi_bit_stream_writer_write_wide_string (nalchi::bit_stream_writer *self, const wchar_t *str) |
| Writes a null-terminated wide string to the bit stream. | |
| bool | nalchi_bit_stream_writer_write_utf8_string (nalchi::bit_stream_writer *self, const char8_t *str) |
| Writes a null-terminated UTF-8 string to the bit stream. | |
| bool | nalchi_bit_stream_writer_write_utf16_string (nalchi::bit_stream_writer *self, const char16_t *str) |
| Writes a null-terminated UTF-16 string to the bit stream. | |
| bool | nalchi_bit_stream_writer_write_utf32_string (nalchi::bit_stream_writer *self, const char32_t *str) |
| Writes a null-terminated UTF-32 string to the bit stream. | |
| nalchi::bit_stream_measurer * | nalchi_bit_stream_measurer_construct () |
Constructs a bit_stream_measurer instance. | |
| void | nalchi_bit_stream_measurer_destroy (nalchi::bit_stream_measurer *self) |
Destroys a bit_stream_measurer instance. | |
| auto | nalchi_bit_stream_measurer_used_bytes (const nalchi::bit_stream_measurer *self) -> nalchi::bit_stream_measurer::size_type |
| Gets the number of used (measured) bytes. | |
| auto | nalchi_bit_stream_measurer_used_bits (const nalchi::bit_stream_measurer *self) -> nalchi::bit_stream_measurer::size_type |
| Gets the number of used (measured) bits. | |
| void | nalchi_bit_stream_measurer_restart (nalchi::bit_stream_measurer *self) |
| Restarts the measure from zero. | |
| void | nalchi_bit_stream_measurer_write_bytes (nalchi::bit_stream_measurer *self, const void *data, nalchi::bit_stream_measurer::size_type size) |
| Fake-writes some arbitrary data to the bit stream. | |
| void | nalchi_bit_stream_measurer_write_bool (nalchi::bit_stream_measurer *self, bool data) |
| Fake-writes an bool value to the bit stream. | |
| void | nalchi_bit_stream_measurer_write_s8 (nalchi::bit_stream_measurer *self, std::int8_t data, std::int8_t min, std::int8_t max) |
Fake-writes a std::int8_t value to the bit stream. | |
| void | nalchi_bit_stream_measurer_write_u8 (nalchi::bit_stream_measurer *self, std::uint8_t data, std::uint8_t min, std::uint8_t max) |
Fake-writes a std::uint8_t value to the bit stream. | |
| void | nalchi_bit_stream_measurer_write_s16 (nalchi::bit_stream_measurer *self, std::int16_t data, std::int16_t min, std::int16_t max) |
Fake-writes a std::int16_t value to the bit stream. | |
| void | nalchi_bit_stream_measurer_write_u16 (nalchi::bit_stream_measurer *self, std::uint16_t data, std::uint16_t min, std::uint16_t max) |
Fake-writes a std::uint16_t value to the bit stream. | |
| void | nalchi_bit_stream_measurer_write_s32 (nalchi::bit_stream_measurer *self, std::int32_t data, std::int32_t min, std::int32_t max) |
Fake-writes a std::int32_t value to the bit stream. | |
| void | nalchi_bit_stream_measurer_write_u32 (nalchi::bit_stream_measurer *self, std::uint32_t data, std::uint32_t min, std::uint32_t max) |
Fake-writes a std::uint32_t value to the bit stream. | |
| void | nalchi_bit_stream_measurer_write_s64 (nalchi::bit_stream_measurer *self, std::int64_t data, std::int64_t min, std::int64_t max) |
Fake-writes a std::int64_t value to the bit stream. | |
| void | nalchi_bit_stream_measurer_write_u64 (nalchi::bit_stream_measurer *self, std::uint64_t data, std::uint64_t min, std::uint64_t max) |
Fake-writes a std::uint64_t value to the bit stream. | |
| void | nalchi_bit_stream_measurer_write_float (nalchi::bit_stream_measurer *self, float data) |
| Fake-writes a float value to the bit stream. | |
| void | nalchi_bit_stream_measurer_write_double (nalchi::bit_stream_measurer *self, double data) |
| Fake-writes a double value to the bit stream. | |
| void | nalchi_bit_stream_measurer_write_ordinary_string (nalchi::bit_stream_measurer *self, const char *str) |
| Fake-writes a null-terminated ordinary string to the bit stream. | |
| void | nalchi_bit_stream_measurer_write_wide_string (nalchi::bit_stream_measurer *self, const wchar_t *str) |
| Fake-writes a null-terminated wide string to the bit stream. | |
| void | nalchi_bit_stream_measurer_write_utf8_string (nalchi::bit_stream_measurer *self, const char8_t *str) |
| Fake-writes a null-terminated UTF-8 string to the bit stream. | |
| void | nalchi_bit_stream_measurer_write_utf16_string (nalchi::bit_stream_measurer *self, const char16_t *str) |
| Fake-writes a null-terminated UTF-16 string to the bit stream. | |
| void | nalchi_bit_stream_measurer_write_utf32_string (nalchi::bit_stream_measurer *self, const char32_t *str) |
| Fake-writes a null-terminated UTF-32 string to the bit stream. | |
| nalchi::bit_stream_reader * | nalchi_bit_stream_reader_construct_default () |
Constructs a bit_stream_reader instance without a buffer. | |
| nalchi::bit_stream_reader * | nalchi_bit_stream_reader_construct_with_word_range (const nalchi::bit_stream_reader::word_type *begin, const nalchi::bit_stream_reader::word_type *end, nalchi::bit_stream_reader::size_type logical_bytes_length) |
Constructs a bit_stream_reader instance with a word range. | |
| nalchi::bit_stream_reader * | nalchi_bit_stream_reader_construct_with_word_ptr_and_length (const nalchi::bit_stream_reader::word_type *begin, nalchi::bit_stream_reader::size_type words_length, nalchi::bit_stream_reader::size_type logical_bytes_length) |
Constructs a bit_stream_reader instance with a word begin pointer and the word length. | |
| void | nalchi_bit_stream_reader_destroy (nalchi::bit_stream_reader *self) |
Destroys the bit_stream_reader instance. | |
| void | nalchi_bit_stream_reader_set_fail (nalchi::bit_stream_reader *self) |
| Force set the fail flag. | |
| bool | nalchi_bit_stream_reader_fail (const nalchi::bit_stream_reader *self) |
| Check if reading from your buffer has been failed or not. | |
| auto | nalchi_bit_stream_reader_total_bytes (const nalchi::bit_stream_reader *self) -> nalchi::bit_stream_reader::size_type |
| Gets the number of total bytes in the stream. | |
| auto | nalchi_bit_stream_reader_total_bits (const nalchi::bit_stream_reader *self) -> nalchi::bit_stream_reader::size_type |
| Gets the number of total bits in the stream. | |
| auto | nalchi_bit_stream_reader_used_bytes (const nalchi::bit_stream_reader *self) -> nalchi::bit_stream_reader::size_type |
| Gets the number of used bytes in the stream. | |
| auto | nalchi_bit_stream_reader_used_bits (const nalchi::bit_stream_reader *self) -> nalchi::bit_stream_reader::size_type |
| Gets the number of used bits in the stream. | |
| auto | nalchi_bit_stream_reader_unused_bytes (const nalchi::bit_stream_reader *self) -> nalchi::bit_stream_reader::size_type |
| Gets the number of unused bytes in the stream. | |
| auto | nalchi_bit_stream_reader_unused_bits (const nalchi::bit_stream_reader *self) -> nalchi::bit_stream_reader::size_type |
| Gets the number of unused bits in the stream. | |
| void | nalchi_bit_stream_reader_restart (nalchi::bit_stream_reader *self) |
| Restarts the stream so that it can read from the beginning again. | |
| void | nalchi_bit_stream_reader_reset (nalchi::bit_stream_reader *self) |
| Resets the stream so that it no longer holds your buffer anymore. | |
| void | nalchi_bit_stream_reader_reset_with_word_range (nalchi::bit_stream_reader *self, const nalchi::bit_stream_reader::word_type *begin, const nalchi::bit_stream_reader::word_type *end, nalchi::bit_stream_reader::size_type logical_bytes_length) |
| Resets the stream with a word range. | |
| void | nalchi_bit_stream_reader_reset_with_word_ptr_and_length (nalchi::bit_stream_reader *self, const nalchi::bit_stream_reader::word_type *begin, nalchi::bit_stream_reader::size_type words_length, nalchi::bit_stream_reader::size_type logical_bytes_length) |
| Resets the stream with a word begin pointer and the word length. | |
| bool | nalchi_bit_stream_reader_read_bytes (nalchi::bit_stream_reader *self, void *data, nalchi::bit_stream_reader::size_type size) |
| Reads some arbitrary data from the bit stream. | |
| bool | nalchi_bit_stream_reader_read_bool (nalchi::bit_stream_reader *self, bool *data) |
| Reads a bool value from the bit stream. | |
| bool | nalchi_bit_stream_reader_read_s8 (nalchi::bit_stream_reader *self, std::int8_t *data, std::int8_t min, std::int8_t max) |
Reads a std::int8_t value from the bit stream. | |
| bool | nalchi_bit_stream_reader_read_u8 (nalchi::bit_stream_reader *self, std::uint8_t *data, std::uint8_t min, std::uint8_t max) |
Reads a std::uint8_t value from the bit stream. | |
| bool | nalchi_bit_stream_reader_read_s16 (nalchi::bit_stream_reader *self, std::int16_t *data, std::int16_t min, std::int16_t max) |
Reads a std::int16_t value from the bit stream. | |
| bool | nalchi_bit_stream_reader_read_u16 (nalchi::bit_stream_reader *self, std::uint16_t *data, std::uint16_t min, std::uint16_t max) |
Reads a std::uint16_t value from the bit stream. | |
| bool | nalchi_bit_stream_reader_read_s32 (nalchi::bit_stream_reader *self, std::int32_t *data, std::int32_t min, std::int32_t max) |
Reads a std::int32_t value from the bit stream. | |
| bool | nalchi_bit_stream_reader_read_u32 (nalchi::bit_stream_reader *self, std::uint32_t *data, std::uint32_t min, std::uint32_t max) |
Reads a std::uint32_t value from the bit stream. | |
| bool | nalchi_bit_stream_reader_read_s64 (nalchi::bit_stream_reader *self, std::int64_t *data, std::int64_t min, std::int64_t max) |
Reads a std::int64_t value from the bit stream. | |
| bool | nalchi_bit_stream_reader_read_u64 (nalchi::bit_stream_reader *self, std::uint64_t *data, std::uint64_t min, std::uint64_t max) |
Reads a std::uint64_t value from the bit stream. | |
| bool | nalchi_bit_stream_reader_read_float (nalchi::bit_stream_reader *self, float *data) |
| Reads a float value from the bit stream. | |
| bool | nalchi_bit_stream_reader_read_double (nalchi::bit_stream_reader *self, double *data) |
| Reads a double value from the bit stream. | |
| bool | nalchi_bit_stream_reader_read_ordinary_string (nalchi::bit_stream_reader *self, char *str, nalchi::bit_stream_reader::size_type max_length) |
| Reads a null-terminated ordinary string from the bit stream. | |
| bool | nalchi_bit_stream_reader_read_wide_string (nalchi::bit_stream_reader *self, wchar_t *str, nalchi::bit_stream_reader::size_type max_length) |
| Reads a null-terminated wide string from the bit stream. | |
| bool | nalchi_bit_stream_reader_read_utf8_string (nalchi::bit_stream_reader *self, char8_t *str, nalchi::bit_stream_reader::size_type max_length) |
| Reads a null-terminated UTF-8 string from the bit stream. | |
| bool | nalchi_bit_stream_reader_read_utf16_string (nalchi::bit_stream_reader *self, char16_t *str, nalchi::bit_stream_reader::size_type max_length) |
| Reads a null-terminated UTF-16 string from the bit stream. | |
| bool | nalchi_bit_stream_reader_read_utf32_string (nalchi::bit_stream_reader *self, char32_t *str, nalchi::bit_stream_reader::size_type max_length) |
| Reads a null-terminated UTF-32 string from the bit stream. | |
| auto | nalchi_bit_stream_reader_peek_string_length (nalchi::bit_stream_reader *self) -> nalchi::bit_stream_reader::ssize_type |
| Peeks the string length prefix from the current stream position. | |
Bit stream flat API.
| auto nalchi_bit_stream_measurer_used_bits | ( | const nalchi::bit_stream_measurer * | self | ) | -> nalchi::bit_stream_measurer::size_type |
Gets the number of used (measured) bits.
| auto nalchi_bit_stream_measurer_used_bytes | ( | const nalchi::bit_stream_measurer * | self | ) | -> nalchi::bit_stream_measurer::size_type |
Gets the number of used (measured) bytes.
| void nalchi_bit_stream_measurer_write_bool | ( | nalchi::bit_stream_measurer * | self, |
| bool | data ) |
Fake-writes an bool value to the bit stream.
| data | Data to fake-write. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
| void nalchi_bit_stream_measurer_write_bytes | ( | nalchi::bit_stream_measurer * | self, |
| const void * | data, | ||
| nalchi::bit_stream_measurer::size_type | size ) |
Fake-writes some arbitrary data to the bit stream.
| data | Pointer to the arbitrary data. |
| size | Size in bytes of the data. |
| void nalchi_bit_stream_measurer_write_double | ( | nalchi::bit_stream_measurer * | self, |
| double | data ) |
Fake-writes a double value to the bit stream.
| data | Data to fake-write. |
| void nalchi_bit_stream_measurer_write_float | ( | nalchi::bit_stream_measurer * | self, |
| float | data ) |
Fake-writes a float value to the bit stream.
| data | Data to fake-write. |
| void nalchi_bit_stream_measurer_write_ordinary_string | ( | nalchi::bit_stream_measurer * | self, |
| const char * | str ) |
Fake-writes a null-terminated ordinary string to the bit stream.
| str | String to fake-write. |
| void nalchi_bit_stream_measurer_write_s16 | ( | nalchi::bit_stream_measurer * | self, |
| std::int16_t | data, | ||
| std::int16_t | min, | ||
| std::int16_t | max ) |
Fake-writes a std::int16_t value to the bit stream.
| data | Data to fake-write. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
| void nalchi_bit_stream_measurer_write_s32 | ( | nalchi::bit_stream_measurer * | self, |
| std::int32_t | data, | ||
| std::int32_t | min, | ||
| std::int32_t | max ) |
Fake-writes a std::int32_t value to the bit stream.
| data | Data to fake-write. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
| void nalchi_bit_stream_measurer_write_s64 | ( | nalchi::bit_stream_measurer * | self, |
| std::int64_t | data, | ||
| std::int64_t | min, | ||
| std::int64_t | max ) |
Fake-writes a std::int64_t value to the bit stream.
| data | Data to fake-write. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
| void nalchi_bit_stream_measurer_write_s8 | ( | nalchi::bit_stream_measurer * | self, |
| std::int8_t | data, | ||
| std::int8_t | min, | ||
| std::int8_t | max ) |
Fake-writes a std::int8_t value to the bit stream.
| data | Data to fake-write. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
| void nalchi_bit_stream_measurer_write_u16 | ( | nalchi::bit_stream_measurer * | self, |
| std::uint16_t | data, | ||
| std::uint16_t | min, | ||
| std::uint16_t | max ) |
Fake-writes a std::uint16_t value to the bit stream.
| data | Data to fake-write. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
| void nalchi_bit_stream_measurer_write_u32 | ( | nalchi::bit_stream_measurer * | self, |
| std::uint32_t | data, | ||
| std::uint32_t | min, | ||
| std::uint32_t | max ) |
Fake-writes a std::uint32_t value to the bit stream.
| data | Data to fake-write. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
| void nalchi_bit_stream_measurer_write_u64 | ( | nalchi::bit_stream_measurer * | self, |
| std::uint64_t | data, | ||
| std::uint64_t | min, | ||
| std::uint64_t | max ) |
Fake-writes a std::uint64_t value to the bit stream.
| data | Data to fake-write. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
| void nalchi_bit_stream_measurer_write_u8 | ( | nalchi::bit_stream_measurer * | self, |
| std::uint8_t | data, | ||
| std::uint8_t | min, | ||
| std::uint8_t | max ) |
Fake-writes a std::uint8_t value to the bit stream.
| data | Data to fake-write. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
| void nalchi_bit_stream_measurer_write_utf16_string | ( | nalchi::bit_stream_measurer * | self, |
| const char16_t * | str ) |
Fake-writes a null-terminated UTF-16 string to the bit stream.
| str | String to fake-write. |
| void nalchi_bit_stream_measurer_write_utf32_string | ( | nalchi::bit_stream_measurer * | self, |
| const char32_t * | str ) |
Fake-writes a null-terminated UTF-32 string to the bit stream.
| str | String to fake-write. |
| void nalchi_bit_stream_measurer_write_utf8_string | ( | nalchi::bit_stream_measurer * | self, |
| const char8_t * | str ) |
Fake-writes a null-terminated UTF-8 string to the bit stream.
| str | String to fake-write. |
| void nalchi_bit_stream_measurer_write_wide_string | ( | nalchi::bit_stream_measurer * | self, |
| const wchar_t * | str ) |
Fake-writes a null-terminated wide string to the bit stream.
| str | String to fake-write. |
| nalchi::bit_stream_reader * nalchi_bit_stream_reader_construct_default | ( | ) |
Constructs a bit_stream_reader instance without a buffer.
This constructor can be useful if you want to set the buffer afterwards.
To set the buffer, call reset_with().
| nalchi::bit_stream_reader * nalchi_bit_stream_reader_construct_with_word_ptr_and_length | ( | const nalchi::bit_stream_reader::word_type * | begin, |
| nalchi::bit_stream_reader::size_type | words_length, | ||
| nalchi::bit_stream_reader::size_type | logical_bytes_length ) |
Constructs a bit_stream_reader instance with a word begin pointer and the word length.
| begin | Pointer to the beginning of a buffer. |
| words_length | Number of words in the buffer. |
| logical_bytes_length | Number of bytes logically. This is useful if you want to only allow partial read from the final word. |
| nalchi::bit_stream_reader * nalchi_bit_stream_reader_construct_with_word_range | ( | const nalchi::bit_stream_reader::word_type * | begin, |
| const nalchi::bit_stream_reader::word_type * | end, | ||
| nalchi::bit_stream_reader::size_type | logical_bytes_length ) |
Constructs a bit_stream_reader instance with a word range.
| begin | Pointer to the beginning of a buffer. |
| end | Pointer to the end of a buffer. |
| logical_bytes_length | Number of bytes logically. This is useful if you want to only allow partial read from the final word. |
| bool nalchi_bit_stream_reader_fail | ( | const nalchi::bit_stream_reader * | self | ) |
Check if reading from your buffer has been failed or not.
If this is true, all the operations for this bit_stream_reader is no-op.
true if reading has been failed, otherwise false. | auto nalchi_bit_stream_reader_peek_string_length | ( | nalchi::bit_stream_reader * | self | ) | -> nalchi::bit_stream_reader::ssize_type |
Peeks the string length prefix from the current stream position.
If it fails to read a string length prefix,
this function will return a negative value and set the fail flag.
CharT stored in it, or a negative value if length prefix is invalid. | bool nalchi_bit_stream_reader_read_bool | ( | nalchi::bit_stream_reader * | self, |
| bool * | data ) |
Reads a bool value from the bit stream.
| data | Data to read to. |
true if reading has been successful, otherwise false. | bool nalchi_bit_stream_reader_read_bytes | ( | nalchi::bit_stream_reader * | self, |
| void * | data, | ||
| nalchi::bit_stream_reader::size_type | size ) |
Reads some arbitrary data from the bit stream.
| data | Pointer to the arbitrary data. |
| size | Size in bytes of the data. |
true if reading has been successful, otherwise false. | bool nalchi_bit_stream_reader_read_double | ( | nalchi::bit_stream_reader * | self, |
| double * | data ) |
Reads a double value from the bit stream.
| data | Data to read to. |
true if reading has been successful, otherwise false. | bool nalchi_bit_stream_reader_read_float | ( | nalchi::bit_stream_reader * | self, |
| float * | data ) |
Reads a float value from the bit stream.
| data | Data to read to. |
true if reading has been successful, otherwise false. | bool nalchi_bit_stream_reader_read_ordinary_string | ( | nalchi::bit_stream_reader * | self, |
| char * | str, | ||
| nalchi::bit_stream_reader::size_type | max_length ) |
Reads a null-terminated ordinary string from the bit stream.
If max_length is not enough to store the string,
this function will set the fail flag and read nothing.
max_length does not include null character, so your buffer must allocate additional space for it.For example, if max_length is 4 for char, you need 5 bytes.
Because you need space for 5 char including null char, and char is 1 byte per char.
| str | Null-terminated string to read to. |
| max_length | Maximum number of char that can be read. |
true if reading has been successful, otherwise false. | bool nalchi_bit_stream_reader_read_s16 | ( | nalchi::bit_stream_reader * | self, |
| std::int16_t * | data, | ||
| std::int16_t | min, | ||
| std::int16_t | max ) |
Reads a std::int16_t value from the bit stream.
| data | Data to read to. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
true if reading has been successful, otherwise false. | bool nalchi_bit_stream_reader_read_s32 | ( | nalchi::bit_stream_reader * | self, |
| std::int32_t * | data, | ||
| std::int32_t | min, | ||
| std::int32_t | max ) |
Reads a std::int32_t value from the bit stream.
| data | Data to read to. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
true if reading has been successful, otherwise false. | bool nalchi_bit_stream_reader_read_s64 | ( | nalchi::bit_stream_reader * | self, |
| std::int64_t * | data, | ||
| std::int64_t | min, | ||
| std::int64_t | max ) |
Reads a std::int64_t value from the bit stream.
| data | Data to read to. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
true if reading has been successful, otherwise false. | bool nalchi_bit_stream_reader_read_s8 | ( | nalchi::bit_stream_reader * | self, |
| std::int8_t * | data, | ||
| std::int8_t | min, | ||
| std::int8_t | max ) |
Reads a std::int8_t value from the bit stream.
| data | Data to read to. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
true if reading has been successful, otherwise false. | bool nalchi_bit_stream_reader_read_u16 | ( | nalchi::bit_stream_reader * | self, |
| std::uint16_t * | data, | ||
| std::uint16_t | min, | ||
| std::uint16_t | max ) |
Reads a std::uint16_t value from the bit stream.
| data | Data to read to. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
true if reading has been successful, otherwise false. | bool nalchi_bit_stream_reader_read_u32 | ( | nalchi::bit_stream_reader * | self, |
| std::uint32_t * | data, | ||
| std::uint32_t | min, | ||
| std::uint32_t | max ) |
Reads a std::uint32_t value from the bit stream.
| data | Data to read to. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
true if reading has been successful, otherwise false. | bool nalchi_bit_stream_reader_read_u64 | ( | nalchi::bit_stream_reader * | self, |
| std::uint64_t * | data, | ||
| std::uint64_t | min, | ||
| std::uint64_t | max ) |
Reads a std::uint64_t value from the bit stream.
| data | Data to read to. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
true if reading has been successful, otherwise false. | bool nalchi_bit_stream_reader_read_u8 | ( | nalchi::bit_stream_reader * | self, |
| std::uint8_t * | data, | ||
| std::uint8_t | min, | ||
| std::uint8_t | max ) |
Reads a std::uint8_t value from the bit stream.
| data | Data to read to. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
true if reading has been successful, otherwise false. | bool nalchi_bit_stream_reader_read_utf16_string | ( | nalchi::bit_stream_reader * | self, |
| char16_t * | str, | ||
| nalchi::bit_stream_reader::size_type | max_length ) |
Reads a null-terminated UTF-16 string from the bit stream.
If max_length is not enough to store the string,
this function will set the fail flag and read nothing.
max_length does not include null character, so your buffer must allocate additional space for it.For example, if max_length is 4 for char16_t, you need 10 bytes.
Because you need space for 5 char16_t including null char, and char16_t is 2 bytes per char.
| str | Null-terminated string to read to. |
| max_length | Maximum number of char16_t that can be read. |
true if reading has been successful, otherwise false. | bool nalchi_bit_stream_reader_read_utf32_string | ( | nalchi::bit_stream_reader * | self, |
| char32_t * | str, | ||
| nalchi::bit_stream_reader::size_type | max_length ) |
Reads a null-terminated UTF-32 string from the bit stream.
If max_length is not enough to store the string,
this function will set the fail flag and read nothing.
max_length does not include null character, so your buffer must allocate additional space for it.For example, if max_length is 4 for char32_t, you need 20 bytes.
Because you need space for 5 char32_t including null char, and char32_t is 4 bytes per char.
| str | Null-terminated string to read to. |
| max_length | Maximum number of char32_t that can be read. |
true if reading has been successful, otherwise false. | bool nalchi_bit_stream_reader_read_utf8_string | ( | nalchi::bit_stream_reader * | self, |
| char8_t * | str, | ||
| nalchi::bit_stream_reader::size_type | max_length ) |
Reads a null-terminated UTF-8 string from the bit stream.
If max_length is not enough to store the string,
this function will set the fail flag and read nothing.
max_length does not include null character, so your buffer must allocate additional space for it.For example, if max_length is 4 for char8_t, you need 5 bytes.
Because you need space for 5 char8_t including null char, and char8_t is 1 byte per char.
| str | Null-terminated string to read to. |
| max_length | Maximum number of char8_t that can be read. |
true if reading has been successful, otherwise false. | bool nalchi_bit_stream_reader_read_wide_string | ( | nalchi::bit_stream_reader * | self, |
| wchar_t * | str, | ||
| nalchi::bit_stream_reader::size_type | max_length ) |
Reads a null-terminated wide string from the bit stream.
If max_length is not enough to store the string,
this function will set the fail flag and read nothing.
max_length does not include null character, so your buffer must allocate additional space for it.For example, if max_length is 4 for char16_t, you need 10 bytes.
Because you need space for 5 char16_t including null char, and char16_t is 2 bytes per char.
| str | Null-terminated string to read to. |
| max_length | Maximum number of wchar_t that can be read. |
true if reading has been successful, otherwise false. | void nalchi_bit_stream_reader_reset_with_word_ptr_and_length | ( | nalchi::bit_stream_reader * | self, |
| const nalchi::bit_stream_reader::word_type * | begin, | ||
| nalchi::bit_stream_reader::size_type | words_length, | ||
| nalchi::bit_stream_reader::size_type | logical_bytes_length ) |
Resets the stream with a word begin pointer and the word length.
| begin | Pointer to the beginning of a buffer. |
| words_length | Number of words in the buffer. |
| logical_bytes_length | Number of bytes logically. This is useful if you want to only allow partial read from the final word. |
| void nalchi_bit_stream_reader_reset_with_word_range | ( | nalchi::bit_stream_reader * | self, |
| const nalchi::bit_stream_reader::word_type * | begin, | ||
| const nalchi::bit_stream_reader::word_type * | end, | ||
| nalchi::bit_stream_reader::size_type | logical_bytes_length ) |
Resets the stream with a word range.
| begin | Pointer to the beginning of a buffer. |
| end | Pointer to the end of a buffer. |
| logical_bytes_length | Number of bytes logically. This is useful if you want to only allow partial read from the final word. |
| auto nalchi_bit_stream_reader_total_bits | ( | const nalchi::bit_stream_reader * | self | ) | -> nalchi::bit_stream_reader::size_type |
Gets the number of total bits in the stream.
| auto nalchi_bit_stream_reader_total_bytes | ( | const nalchi::bit_stream_reader * | self | ) | -> nalchi::bit_stream_reader::size_type |
Gets the number of total bytes in the stream.
| auto nalchi_bit_stream_reader_unused_bits | ( | const nalchi::bit_stream_reader * | self | ) | -> nalchi::bit_stream_reader::size_type |
Gets the number of unused bits in the stream.
| auto nalchi_bit_stream_reader_unused_bytes | ( | const nalchi::bit_stream_reader * | self | ) | -> nalchi::bit_stream_reader::size_type |
Gets the number of unused bytes in the stream.
| auto nalchi_bit_stream_reader_used_bits | ( | const nalchi::bit_stream_reader * | self | ) | -> nalchi::bit_stream_reader::size_type |
Gets the number of used bits in the stream.
| auto nalchi_bit_stream_reader_used_bytes | ( | const nalchi::bit_stream_reader * | self | ) | -> nalchi::bit_stream_reader::size_type |
Gets the number of used bytes in the stream.
| nalchi::bit_stream_writer * nalchi_bit_stream_writer_construct_default | ( | ) |
Constructs a bit_stream_writer instance without a buffer.
This constructor can be useful if you want to set the buffer afterwards.
To set the buffer, call reset_with().
| nalchi::bit_stream_writer * nalchi_bit_stream_writer_construct_with_shared_payload | ( | nalchi::shared_payload | buffer, |
| nalchi::bit_stream_writer::size_type | logical_bytes_length ) |
Constructs a bit_stream_writer instance with a shared_payload buffer.
| buffer | Buffer to write bits to. |
| logical_bytes_length | Number of bytes logically. This is useful if you want to only allow partial write to the final word. |
| nalchi::bit_stream_writer * nalchi_bit_stream_writer_construct_with_word_ptr_and_length | ( | nalchi::bit_stream_writer::word_type * | begin, |
| nalchi::bit_stream_writer::size_type | words_length, | ||
| nalchi::bit_stream_writer::size_type | logical_bytes_length ) |
Constructs a bit_stream_writer instance with a word begin pointer and the word length.
| begin | Pointer to the beginning of a buffer. |
| words_length | Number of words in the buffer. |
| logical_bytes_length | Number of bytes logically. This is useful if you want to only allow partial write to the final word. |
| nalchi::bit_stream_writer * nalchi_bit_stream_writer_construct_with_word_range | ( | nalchi::bit_stream_writer::word_type * | begin, |
| nalchi::bit_stream_writer::word_type * | end, | ||
| nalchi::bit_stream_writer::size_type | logical_bytes_length ) |
Constructs a bit_stream_writer instance with a word range.
| begin | Pointer to the beginning of a buffer. |
| end | Pointer to the end of a buffer. |
| logical_bytes_length | Number of bytes logically. This is useful if you want to only allow partial write to the final word. |
| bool nalchi_bit_stream_writer_fail | ( | const nalchi::bit_stream_writer * | self | ) |
Check if writing to your buffer has been failed or not.
If this is true, all the operations for this bit_stream_writer is no-op.
true if writing has been failed, otherwise false. | bool nalchi_bit_stream_writer_flush_final | ( | nalchi::bit_stream_writer * | self | ) |
Flushes the last remaining bytes on the internal scratch buffer to your buffer.
true if writing has been successful, otherwise false. | bool nalchi_bit_stream_writer_flushed | ( | const nalchi::bit_stream_writer * | self | ) |
Checks if flush_final() has been called or not.
flush_final() has been called or not. | void nalchi_bit_stream_writer_reset | ( | nalchi::bit_stream_writer * | self | ) |
Resets the stream so that it no longer holds your buffer anymore.
flush_final() beforehand. | void nalchi_bit_stream_writer_reset_with_shared_payload | ( | nalchi::bit_stream_writer * | self, |
| nalchi::shared_payload | buffer, | ||
| nalchi::bit_stream_writer::size_type | logical_bytes_length ) |
Resets the stream with a shared_payload buffer.
flush_final() beforehand. | buffer | Buffer to write bits to. |
| logical_bytes_length | Number of bytes logically. This is useful if you want to only allow partial write to the final word. |
| void nalchi_bit_stream_writer_reset_with_word_ptr_and_length | ( | nalchi::bit_stream_writer * | self, |
| nalchi::bit_stream_writer::word_type * | begin, | ||
| nalchi::bit_stream_writer::size_type | words_length, | ||
| nalchi::bit_stream_writer::size_type | logical_bytes_length ) |
Resets the stream with a word begin pointer and the word length.
flush_final() beforehand. | begin | Pointer to the beginning of a buffer. |
| words_length | Number of words in the buffer. |
| logical_bytes_length | Number of bytes logically. This is useful if you want to only allow partial write to the final word. |
| void nalchi_bit_stream_writer_reset_with_word_range | ( | nalchi::bit_stream_writer * | self, |
| nalchi::bit_stream_writer::word_type * | begin, | ||
| nalchi::bit_stream_writer::word_type * | end, | ||
| nalchi::bit_stream_writer::size_type | logical_bytes_length ) |
Resets the stream with a word range.
flush_final() beforehand. | begin | Pointer to the beginning of a buffer. |
| end | Pointer to the end of a buffer. |
| logical_bytes_length | Number of bytes logically. This is useful if you want to only allow partial write to the final word. |
| void nalchi_bit_stream_writer_restart | ( | nalchi::bit_stream_writer * | self | ) |
Restarts the stream so that it can write from the beginning again.
flush_final() beforehand. | auto nalchi_bit_stream_writer_total_bits | ( | const nalchi::bit_stream_writer * | self | ) | -> nalchi::bit_stream_writer::size_type |
Gets the number of total bits in the stream.
| auto nalchi_bit_stream_writer_total_bytes | ( | const nalchi::bit_stream_writer * | self | ) | -> nalchi::bit_stream_writer::size_type |
Gets the number of total bytes in the stream.
| auto nalchi_bit_stream_writer_unused_bits | ( | const nalchi::bit_stream_writer * | self | ) | -> nalchi::bit_stream_writer::size_type |
Gets the number of unused bits in the stream.
| auto nalchi_bit_stream_writer_unused_bytes | ( | const nalchi::bit_stream_writer * | self | ) | -> nalchi::bit_stream_writer::size_type |
Gets the number of unused bytes in the stream.
| auto nalchi_bit_stream_writer_used_bits | ( | const nalchi::bit_stream_writer * | self | ) | -> nalchi::bit_stream_writer::size_type |
Gets the number of used bits in the stream.
| auto nalchi_bit_stream_writer_used_bytes | ( | const nalchi::bit_stream_writer * | self | ) | -> nalchi::bit_stream_writer::size_type |
Gets the number of used bytes in the stream.
| bool nalchi_bit_stream_writer_write_bool | ( | nalchi::bit_stream_writer * | self, |
| bool | data ) |
Writes a bool value to the bit stream.
| data | Data to write. |
true if writing has been successful, otherwise false. | bool nalchi_bit_stream_writer_write_bytes | ( | nalchi::bit_stream_writer * | self, |
| const void * | data, | ||
| nalchi::bit_stream_writer::size_type | size ) |
Writes some arbitrary data to the bit stream.
| data | Pointer to the arbitrary data. |
| size | Size in bytes of the data. |
true if writing has been successful, otherwise false. | bool nalchi_bit_stream_writer_write_double | ( | nalchi::bit_stream_writer * | self, |
| double | data ) |
Writes a double value to the bit stream.
| data | Data to write. |
true if writing has been successful, otherwise false. | bool nalchi_bit_stream_writer_write_float | ( | nalchi::bit_stream_writer * | self, |
| float | data ) |
Writes a float value to the bit stream.
| data | Data to write. |
true if writing has been successful, otherwise false. | bool nalchi_bit_stream_writer_write_ordinary_string | ( | nalchi::bit_stream_writer * | self, |
| const char * | str ) |
Writes a null-terminated ordinary string to the bit stream.
| str | String to write. |
true if writing has been successful, otherwise false. | bool nalchi_bit_stream_writer_write_s16 | ( | nalchi::bit_stream_writer * | self, |
| std::int16_t | data, | ||
| std::int16_t | min, | ||
| std::int16_t | max ) |
Writes a std::int16_t value to the bit stream.
| data | Data to write. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
true if writing has been successful, otherwise false. | bool nalchi_bit_stream_writer_write_s32 | ( | nalchi::bit_stream_writer * | self, |
| std::int32_t | data, | ||
| std::int32_t | min, | ||
| std::int32_t | max ) |
Writes a std::int32_t value to the bit stream.
| data | Data to write. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
true if writing has been successful, otherwise false. | bool nalchi_bit_stream_writer_write_s64 | ( | nalchi::bit_stream_writer * | self, |
| std::int64_t | data, | ||
| std::int64_t | min, | ||
| std::int64_t | max ) |
Writes a std::int64_t value to the bit stream.
| data | Data to write. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
true if writing has been successful, otherwise false. | bool nalchi_bit_stream_writer_write_s8 | ( | nalchi::bit_stream_writer * | self, |
| std::int8_t | data, | ||
| std::int8_t | min, | ||
| std::int8_t | max ) |
Writes a std::int8_t value to the bit stream.
| data | Data to write. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
true if writing has been successful, otherwise false. | bool nalchi_bit_stream_writer_write_u16 | ( | nalchi::bit_stream_writer * | self, |
| std::uint16_t | data, | ||
| std::uint16_t | min, | ||
| std::uint16_t | max ) |
Writes a std::uint16_t value to the bit stream.
| data | Data to write. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
true if writing has been successful, otherwise false. | bool nalchi_bit_stream_writer_write_u32 | ( | nalchi::bit_stream_writer * | self, |
| std::uint32_t | data, | ||
| std::uint32_t | min, | ||
| std::uint32_t | max ) |
Writes a std::uint32_t value to the bit stream.
| data | Data to write. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
true if writing has been successful, otherwise false. | bool nalchi_bit_stream_writer_write_u64 | ( | nalchi::bit_stream_writer * | self, |
| std::uint64_t | data, | ||
| std::uint64_t | min, | ||
| std::uint64_t | max ) |
Writes a std::uint64_t value to the bit stream.
| data | Data to write. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
true if writing has been successful, otherwise false. | bool nalchi_bit_stream_writer_write_u8 | ( | nalchi::bit_stream_writer * | self, |
| std::uint8_t | data, | ||
| std::uint8_t | min, | ||
| std::uint8_t | max ) |
Writes a std::uint8_t value to the bit stream.
| data | Data to write. |
| min | Minimum value allowed for data. |
| max | Maximum value allowed for data. |
true if writing has been successful, otherwise false. | bool nalchi_bit_stream_writer_write_utf16_string | ( | nalchi::bit_stream_writer * | self, |
| const char16_t * | str ) |
Writes a null-terminated UTF-16 string to the bit stream.
| str | String to write. |
true if writing has been successful, otherwise false. | bool nalchi_bit_stream_writer_write_utf32_string | ( | nalchi::bit_stream_writer * | self, |
| const char32_t * | str ) |
Writes a null-terminated UTF-32 string to the bit stream.
| str | String to write. |
true if writing has been successful, otherwise false. | bool nalchi_bit_stream_writer_write_utf8_string | ( | nalchi::bit_stream_writer * | self, |
| const char8_t * | str ) |
Writes a null-terminated UTF-8 string to the bit stream.
| str | String to write. |
true if writing has been successful, otherwise false. | bool nalchi_bit_stream_writer_write_wide_string | ( | nalchi::bit_stream_writer * | self, |
| const wchar_t * | str ) |
Writes a null-terminated wide string to the bit stream.
| str | String to write. |
true if writing has been successful, otherwise false.