![]() |
xtd - Reference Guide
0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
|
Converts base data types to an std::vector of uint8_ts, and an std::vector of uint8_ts to base data types. More...
#include <bit_converter.h>
Static Public Member Functions | |
static int64_t | double_to_int64_bits (double value) |
Converts the specified double-precision floating point number to a 64-bit signed integer. More... | |
static std::vector< uint8_t > | get_bytes (bool value) |
Returns the specified Boolean value as an std::vector of uint8_ts. More... | |
static std::vector< uint8_t > | get_bytes (char value) |
Returns the specified Char value as an std::vector of uint8_ts. More... | |
static std::vector< uint8_t > | get_bytes (char16_t value) |
Returns the specified Char value as an std::vector of uint8_ts. More... | |
static std::vector< uint8_t > | get_bytes (char32_t value) |
Returns the specified Char value as an std::vector of uint8_ts. More... | |
static std::vector< uint8_t > | get_bytes (wchar_t value) |
Returns the specified Char value as an std::vector of uint8_ts. More... | |
static std::vector< uint8_t > | get_bytes (double value) |
Returns the specified double value as an std::vector of uint8_ts. More... | |
static std::vector< uint8_t > | get_bytes (int16_t value) |
Returns the specified int16_t value as an std::vector of uint8_ts. More... | |
static std::vector< uint8_t > | get_bytes (int32_t value) |
Returns the specified int32_t value as an std::vector of uint8_ts. More... | |
static std::vector< uint8_t > | get_bytes (int64_t value) |
Returns the specified int64_t value as an std::vector of uint8_ts. More... | |
static std::vector< uint8_t > | get_bytes (float value) |
Returns the specified single value as an std::vector of uint8_ts. More... | |
static std::vector< uint8_t > | get_bytes (uint16_t value) |
Returns the specified uint16_t value as an std::vector of uint8_ts. More... | |
static std::vector< uint8_t > | get_bytes (uint32_t value) |
Returns the specified uint32_t value as an std::vector of uint8_ts. More... | |
static std::vector< uint8_t > | get_bytes (uint64_t value) |
Returns the specified uint64_t value as an std::vector of uint8_ts. More... | |
static float | int32_bits_to_single (int32_t value) |
Converts the specified 32-bit signed integer to a single-precision floating point number. More... | |
static double | int64_bits_to_double (int64_t value) |
Converts the specified 64-bit signed integer to a double-precision floating point number. More... | |
static int32_t | single_to_int32_bits (float value) |
Converts the specified single-precision floating point number to a 32-bit signed integer. More... | |
static bool | to_boolean (const std::vector< uint8_t > &value, size_t start_index) |
Returns a Boolean value converted from one uint8_t at a specified position in a uint8_t std::vector. More... | |
static char32_t | to_char (const std::vector< uint8_t > &value, size_t start_index) |
Returns a char32_t converted from two uint8_ts at a specified position in a uint8_t std::vector. More... | |
static double | to_double (const std::vector< uint8_t > &value, size_t start_index) |
Returns a double-precision floating point number converted from eight uint8_ts at a specified position in a uint8_t std::vector. More... | |
static int16_t | to_int16 (const std::vector< uint8_t > &value, size_t start_index) |
Returns a 16-bit signed integer converted from two uint8_ts at a specified position in a uint8_t std::vector. More... | |
static int32_t | to_int32 (const std::vector< uint8_t > &value, size_t start_index) |
Returns a 32-bit signed integer converted from two uint8_ts at a specified position in a uint8_t std::vector. More... | |
static int64_t | to_int64 (const std::vector< uint8_t > &value, size_t start_index) |
Returns a 64-bit signed integer converted from two uint8_ts at a specified position in a uint8_t std::vector. More... | |
static float | to_single (const std::vector< uint8_t > &value, size_t start_index) |
Returns a single-precision floating point number converted from eight uint8_ts at a specified position in a uint8_t std::vector. More... | |
static std::string | to_string (const std::vector< uint8_t > &value) |
Converts the numeric value of each element of a specified std::vector of uint8_ts to its equivalent hexadecimal std::string representation. More... | |
static std::string | to_string (const std::vector< uint8_t > &value, size_t start_index) |
Converts the numeric value of each element of a specified substd::vector of uint8_ts to its equivalent hexadecimal std::string representation. More... | |
static std::string | to_string (const std::vector< uint8_t > &value, size_t start_index, size_t length) |
Converts the numeric value of each element of a specified substd::vector of uint8_ts to its equivalent hexadecimal std::string representation. More... | |
static uint16_t | to_uint16 (const std::vector< uint8_t > &value, size_t start_index) |
Returns a 16-bit unsigned integer converted from two uint8_ts at a specified position in a uint8_t std::vector. More... | |
static uint32_t | to_uint32 (const std::vector< uint8_t > &value, size_t start_index) |
Returns a 32-bit signed integer converted from two uint8_ts at a specified position in a uint8_t std::vector. More... | |
static uint64_t | to_uint64 (const std::vector< uint8_t > &value, size_t start_index) |
Returns a 64-bit unsigned integer converted from two uint8_ts at a specified position in a uint8_t std::vector. More... | |
Static Public Attributes | |
static const bool | is_little_endian |
Indicates the uint8_t order ("endianness") in which data is stored in this computer architecture. More... | |
Converts base data types to an std::vector of uint8_ts, and an std::vector of uint8_ts to base data types.
Type | To uint8_t conversion | From uint8_t conversion |
---|---|---|
bool | get_bytes(bool) | to_boolean(const std::vector< uint8_t >&, int32_t) |
char32_t | get_bytes(char32_t) | to_char(const std::vector< uint8_t >&, int32_t) |
double | get_bytes(double) - or - double_to_int64_bits(double) | to_double(const std::vector< uint8_t >&, int32_t) - or - int64_bits_to_double(int64_t) |
int16_t | get_bytes(int16_t) | to_int16(const std::vector< uint8_t >&, int32_t) |
int32_t | get_bytes(int32_t) | to_int32(const std::vector< uint8_t >&, int32_t) |
int64_t | get_bytes(int64_t) | to_int64(const std::vector< uint8_t >&, int32_t) |
float | get_bytes(float) - or - single_to_int32_bits(float) | to_single(const std::vector< uint8_t >&, int32_t) - or - int32_bits_to_single(int32_t) |
uint16_t | get_bytes(uint16_t) | to_uint16(const std::vector< uint8_t >&, int32_t) |
uint32_t | get_bytes(uint32_t) | to_uint32(const std::vector< uint8_t >&, int32_t) |
uint64_t | get_bytes(uint64_t) | to_uint64(const std::vector< uint8_t >&, int32_t) |
Little-endian | D2-02-96-49 |
---|---|
Big-endian | 49-96-02-D2 |
------------— | ----------— |