OpenTTD Source 20241224-master-gee860a5c8e
|
Endian-aware buffer adapter that always reads values in little endian order. More...
#include <endian_buffer.hpp>
Public Member Functions | |
EndianBufferReader (std::span< const uint8_t > buffer) | |
void | rewind () |
EndianBufferReader & | operator>> (std::string &data) |
EndianBufferReader & | operator>> (bool &data) |
template<typename T > | |
EndianBufferReader & | operator>> (OverflowSafeInt< T > &data) |
template<typename... Targs> | |
EndianBufferReader & | operator>> (std::tuple< Targs... > &data) |
template<class T , std::enable_if_t< std::disjunction_v< std::negation< std::is_class< T > >, std::is_base_of< StrongTypedefBase, T > >, int > = 0> | |
EndianBufferReader & | operator>> (T &data) |
Static Public Member Functions | |
template<typename Tvalue > | |
static Tvalue | ToValue (std::span< const uint8_t > buffer) |
Private Member Functions | |
template<class Ttuple , size_t... Tindices> | |
void | ReadTuple (Ttuple &values, std::index_sequence< Tindices... >) |
Helper function to read a tuple from the buffer. | |
std::string | ReadStr () |
Read overload for string data. | |
template<class T > | |
T | Read () |
Fundamental read function. | |
Private Attributes | |
std::span< const uint8_t > | buffer |
Reference to storage buffer. | |
size_t | read_pos = 0 |
Current read position. | |
Endian-aware buffer adapter that always reads values in little endian order.
Definition at line 119 of file endian_buffer.hpp.
|
inline |
Definition at line 126 of file endian_buffer.hpp.
|
inline |
Definition at line 131 of file endian_buffer.hpp.
|
inline |
Definition at line 134 of file endian_buffer.hpp.
|
inline |
Definition at line 130 of file endian_buffer.hpp.
|
inline |
Definition at line 137 of file endian_buffer.hpp.
|
inline |
Definition at line 144 of file endian_buffer.hpp.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
Helper function to read a tuple from the buffer.
Definition at line 168 of file endian_buffer.hpp.
|
inline |
Definition at line 128 of file endian_buffer.hpp.
|
inlinestatic |
Definition at line 157 of file endian_buffer.hpp.
|
private |
Reference to storage buffer.
Definition at line 121 of file endian_buffer.hpp.
Referenced by ReadStr().
|
private |