|
NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
|
带边界检查的字节游标,用于协议解析 更多...
#include <byte_cursor.hpp>
Public 成员函数 | |
| byte_cursor () noexcept=default | |
| 构造空游标 | |
| byte_cursor (const byte_t *data, size_t size) noexcept | |
| 从原始指针和长度构造 | |
| byte_cursor (cbyte_view view) noexcept | |
| 从 cbyte_view 构造 | |
| size_t | remaining () const noexcept |
| 剩余可读字节数 | |
| size_t | consumed_bytes () const noexcept |
| 已消费的字节数 | |
| bool | exhausted () const noexcept |
| 是否已读完所有数据 | |
| const byte_t * | data () const noexcept |
| 获取底层数据指针 | |
| size_t | size () const noexcept |
| 获取底层缓冲区总大小 | |
| optional< byte_t > | try_read_byte () noexcept |
| 尝试读取一个字节 | |
| optional< byte_t > | peek_byte () const noexcept |
| 查看当前字节而不消费 | |
| optional< uint16_t > | try_read_be16 () noexcept |
| 尝试读取大端序 16 位无符号整数 | |
| optional< uint32_t > | try_read_be24 () noexcept |
| 尝试读取大端序 24 位无符号整数 | |
| optional< uint32_t > | try_read_be32 () noexcept |
| 尝试读取大端序 32 位无符号整数 | |
| optional< uint64_t > | try_read_be64 () noexcept |
| 尝试读取大端序 64 位无符号整数 | |
| optional< uint16_t > | try_read_le16 () noexcept |
| 尝试读取小端序 16 位无符号整数 | |
| optional< uint32_t > | try_read_le32 () noexcept |
| 尝试读取小端序 32 位无符号整数 | |
| optional< uint64_t > | try_read_le64 () noexcept |
| 尝试读取小端序 64 位无符号整数 | |
| optional< cbyte_view > | try_read_bytes (size_t count) noexcept |
| 尝试读取指定长度的字节块 | |
| bool | skip (size_t count) noexcept |
| 跳过指定数量的字节 | |
| void | reset (const byte_t *data, size_t size) noexcept |
| 重置游标到新的缓冲区 | |
| optional< uint64_t > | try_read_bits (uint8_t n) noexcept |
| 尝试读取指定位数(用于 HPACK Huffman 解码) | |
| optional< uint64_t > | try_peek_bits (uint8_t n) const noexcept |
| 预读指定位数而不消费 | |
| void | skip_bits (uint8_t n) noexcept |
| 跳过指定位数 | |
| size_t | bits_remaining () const noexcept |
| 位缓冲区中剩余的可读位数 | |
| bool | refill_bits () noexcept |
| 从字节缓冲区中补充位缓冲区 | |
|
inlinenoexcept |
|
inlinenoexcept |
跳过指定数量的字节
| count | 要跳过的字节数 |
在文件 byte_cursor.hpp 第 199 行定义.
引用了 neforce::count().
|
inlinenoexcept |
|
inlinenodiscardnoexcept |
预读指定位数而不消费
| n | 要预读的位数(最多 64) |
在文件 byte_cursor.hpp 第 247 行定义.
引用了 neforce::numeric_traits< T, Dummy >::max() , 以及 neforce::none.
尝试读取大端序 16 位无符号整数
在文件 byte_cursor.hpp 第 93 行定义.
引用了 neforce::none , 以及 neforce::endian::read_be16().
尝试读取大端序 24 位无符号整数
在文件 byte_cursor.hpp 第 106 行定义.
引用了 neforce::none , 以及 neforce::endian::read_be24().
尝试读取大端序 32 位无符号整数
在文件 byte_cursor.hpp 第 119 行定义.
引用了 neforce::none , 以及 neforce::endian::read_be32().
尝试读取大端序 64 位无符号整数
在文件 byte_cursor.hpp 第 132 行定义.
引用了 neforce::none , 以及 neforce::endian::read_be64().
尝试读取指定位数(用于 HPACK Huffman 解码)
| n | 要读取的位数(最多 64) |
在文件 byte_cursor.hpp 第 225 行定义.
引用了 neforce::numeric_traits< T, Dummy >::max(), neforce::none , 以及 try_read_byte().
尝试读取一个字节
在文件 byte_cursor.hpp 第 71 行定义.
引用了 neforce::none.
被这些函数引用 try_read_bits().
|
inlinenodiscardnoexcept |
尝试读取指定长度的字节块
| count | 要读取的字节数 |
在文件 byte_cursor.hpp 第 185 行定义.
引用了 neforce::count() , 以及 neforce::none.
尝试读取小端序 16 位无符号整数
在文件 byte_cursor.hpp 第 145 行定义.
引用了 neforce::none , 以及 neforce::endian::read_le16().
尝试读取小端序 32 位无符号整数
在文件 byte_cursor.hpp 第 158 行定义.
引用了 neforce::none , 以及 neforce::endian::read_le32().
尝试读取小端序 64 位无符号整数
在文件 byte_cursor.hpp 第 171 行定义.
引用了 neforce::none , 以及 neforce::endian::read_le64().