Measures the bytes bit_stream_writer
will use.
More...
#include <nalchi/bit_stream.hpp>
|
| bit_stream_measurer (const bit_stream_measurer &)=delete |
| Deleted copy constructor.
|
|
auto | operator= (const bit_stream_measurer &) -> bit_stream_measurer &=delete |
| Deleted copy assignment operator.
|
|
| bit_stream_measurer ()=default |
| Constructs a bit_stream_measurer instance.
|
|
auto | used_bytes () const -> size_type |
| Gets the number of used (measured) bytes.
|
|
auto | used_bits () const -> size_type |
| Gets the number of used (measured) bits.
|
|
void | restart () |
| Restarts the measure from zero.
|
|
auto | write (const void *data, size_type size) -> bit_stream_measurer & |
| Fake-writes some arbitrary data to the bit stream.
|
|
template<std::integral Int> |
auto | write (Int data, Int min=std::numeric_limits< Int >::min(), Int max=std::numeric_limits< Int >::max()) -> bit_stream_measurer & |
| Fake-writes an integral value to the bit stream.
|
|
auto | write (float data) -> bit_stream_measurer & |
| Fake-writes a float value to the bit stream.
|
|
auto | write (double data) -> bit_stream_measurer & |
| Fake-writes a double value to the bit stream.
|
|
template<character CharT, typename CharTraits > |
auto | write (std::basic_string_view< CharT, CharTraits > str) -> bit_stream_measurer & |
| Fake-writes a string view to the bit stream.
|
|
template<character CharT, typename CharTraits , typename Allocator > |
auto | write (const std::basic_string< CharT, CharTraits, Allocator > &str) -> bit_stream_measurer & |
| Fake-writes a string to the bit stream.
|
|
template<character CharT> |
auto | write (const CharT *str) -> bit_stream_measurer & |
| Fake-writes a null-terminated string to the bit stream.
|
|
Measures the bytes bit_stream_writer
will use.
This never actually writes any data.
Instead, it only measures how many bytes bit_stream_writer
would use.
You can use this to measure the required space for the bit_stream_writer
.
◆ used_bits()
auto nalchi::bit_stream_measurer::used_bits |
( |
| ) |
const -> size_type
|
|
inline |
Gets the number of used (measured) bits.
- Returns
- Number of used (measured) bits.
◆ used_bytes()
auto nalchi::bit_stream_measurer::used_bytes |
( |
| ) |
const -> size_type |
Gets the number of used (measured) bytes.
- Returns
- Number of used (measured) bytes.
◆ write() [1/7]
template<character CharT>
Fake-writes a null-terminated string to the bit stream.
- Template Parameters
-
CharT | Character type of the null-terminated string. |
- Parameters
-
- Returns
- The stream itself.
◆ write() [2/7]
template<character CharT, typename CharTraits , typename Allocator >
auto nalchi::bit_stream_measurer::write |
( |
const std::basic_string< CharT, CharTraits, Allocator > & | str | ) |
-> bit_stream_measurer&
|
|
inline |
Fake-writes a string to the bit stream.
- Template Parameters
-
CharT | Underlying character type of std::basic_string . |
CharTraits | Char traits for CharT . |
Allocator | Underlying allocator for std::basic_string . |
- Parameters
-
- Returns
- The stream itself.
◆ write() [3/7]
Fake-writes some arbitrary data to the bit stream.
- Parameters
-
data | Pointer to the arbitrary data. |
size | Size in bytes of the data. |
- Returns
- The stream itself.
◆ write() [4/7]
Fake-writes a double value to the bit stream.
- Parameters
-
- Returns
- The stream itself.
◆ write() [5/7]
Fake-writes a float value to the bit stream.
- Parameters
-
- Returns
- The stream itself.
◆ write() [6/7]
template<std::integral Int>
auto nalchi::bit_stream_measurer::write |
( |
Int | data, |
|
|
Int | min = std::numeric_limits<Int>::min(), |
|
|
Int | max = std::numeric_limits<Int>::max() ) -> bit_stream_measurer&
|
|
inline |
Fake-writes an integral value to the bit stream.
- Template Parameters
-
- Parameters
-
data | Data to fake-write. |
min | Minimum value allowed for data . |
max | Maximum value allowed for data . |
- Returns
- The stream itself.
◆ write() [7/7]
template<character CharT, typename CharTraits >
auto nalchi::bit_stream_measurer::write |
( |
std::basic_string_view< CharT, CharTraits > | str | ) |
-> bit_stream_measurer&
|
|
inline |
Fake-writes a string view to the bit stream.
- Template Parameters
-
CharT | Underlying character type of std::basic_string_view . |
CharTraits | Char traits for CharT . |
- Parameters
-
- Returns
- The stream itself.
The documentation for this class was generated from the following file: