xtd - Reference Guide
0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
|
#include <bit_converter.h>
Converts base data types to an std::vector of bytes, and an std::vector of bytes to base data types.
Type | To byte_t conversion | From byte_t conversion |
---|---|---|
bool | xtd::bit_converter::get_bytes(bool) | xtd::bit_converter::to_boolean(const std::vector< byte_t >&, int32_t) |
char32_t | xtd::bit_converter::get_bytes(char32_t) | xtd::bit_converter::to_char(const std::vector< byte_t >&, int32_t) |
double | xtd::bit_converter::get_bytes(double) - or - double_to_int64_bits(double) | xtd::bit_converter::to_double(const std::vector< byte_t >&, int32_t) - or - int64_bits_to_double(int64_t) |
int16_t | xtd::bit_converter::get_bytes(int16_t) | xtd::bit_converter::to_int16(const std::vector< byte_t >&, int32_t) |
int32_t | xtd::bit_converter::get_bytes(int32_t) | xtd::bit_converter::to_int32(const std::vector< byte_t >&, int32_t) |
int64_t | xtd::bit_converter::get_bytes(int64_t) | xtd::bit_converter::to_int64(const std::vector< byte_t >&, int32_t) |
float | xtd::bit_converter::get_bytes(float) - or - single_to_int32_bits(float) | xtd::bit_converter::to_single(const std::vector< byte_t >&, int32_t) - or - int32_bits_to_single(int32_t) |
uint16_t | xtd::bit_converter::get_bytes(uint16_t) | xtd::bit_converter::to_uint16(const std::vector< byte_t >&, int32_t) |
uint32_t | xtd::bit_converter::get_bytes(uint32_t) | xtd::bit_converter::to_uint32(const std::vector< byte_t >&, int32_t) |
uint64_t | xtd::bit_converter::get_bytes(uint64_t) | xtd::bit_converter::to_uint64(const std::vector< byte_t >&, int32_t) |
Little-endian | D2-02-96-49 |
Big-endian | 49-96-02-D2 |
Inherits xtd::static_object.
Static Public Attributes | |
static const bool | is_little_endian |
Indicates the byte_t order ("endianness") in which data is stored in this computer architecture. More... | |
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< byte_t > | get_bytes (bool value) |
Returns the specified Boolean value as an std::vector of bytes. More... | |
static std::vector< byte_t > | get_bytes (char value) |
Returns the specified Char value as an std::vector of bytes. More... | |
static std::vector< byte_t > | get_bytes (char16_t value) |
Returns the specified Char value as an std::vector of bytes. More... | |
static std::vector< byte_t > | get_bytes (char32_t value) |
Returns the specified Char value as an std::vector of bytes. More... | |
static std::vector< byte_t > | get_bytes (double value) |
Returns the specified double value as an std::vector of bytes. More... | |
static std::vector< byte_t > | get_bytes (float value) |
Returns the specified single value as an std::vector of bytes. More... | |
static std::vector< byte_t > | get_bytes (int16_t value) |
Returns the specified int16_t value as an std::vector of bytes. More... | |
static std::vector< byte_t > | get_bytes (int32_t value) |
Returns the specified int32_t value as an std::vector of bytes. More... | |
static std::vector< byte_t > | get_bytes (int64_t value) |
Returns the specified int64_t value as an std::vector of bytes. More... | |
static std::vector< byte_t > | get_bytes (uint16_t value) |
Returns the specified uint16_t value as an std::vector of bytes. More... | |
static std::vector< byte_t > | get_bytes (uint32_t value) |
Returns the specified uint32_t value as an std::vector of bytes. More... | |
static std::vector< byte_t > | get_bytes (uint64_t value) |
Returns the specified uint64_t value as an std::vector of bytes. More... | |
static std::vector< byte_t > | get_bytes (wchar_t value) |
Returns the specified Char value as an std::vector of bytes. 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< byte_t > &value, size_t start_index) |
Returns a Boolean value converted from one byte_t at a specified position in a byte_t std::vector. More... | |
static char32_t | to_char (const std::vector< byte_t > &value, size_t start_index) |
Returns a char32_t converted from two bytes at a specified position in a byte_t std::vector. More... | |
static double | to_double (const std::vector< byte_t > &value, size_t start_index) |
Returns a double-precision floating point number converted from eight bytes at a specified position in a byte_t std::vector. More... | |
static int16_t | to_int16 (const std::vector< byte_t > &value, size_t start_index) |
Returns a 16-bit signed integer converted from two bytes at a specified position in a byte_t std::vector. More... | |
static int32_t | to_int32 (const std::vector< byte_t > &value, size_t start_index) |
Returns a 32-bit signed integer converted from two bytes at a specified position in a byte_t std::vector. More... | |
static int64_t | to_int64 (const std::vector< byte_t > &value, size_t start_index) |
Returns a 64-bit signed integer converted from two bytes at a specified position in a byte_t std::vector. More... | |
static float | to_single (const std::vector< byte_t > &value, size_t start_index) |
Returns a single-precision floating point number converted from eight bytes at a specified position in a byte_t std::vector. More... | |
static xtd::ustring | to_string (const std::vector< byte_t > &value) |
Converts the numeric value of each element of a specified std::vector of bytes to its equivalent hexadecimal xtd::ustring representation. More... | |
static xtd::ustring | to_string (const std::vector< byte_t > &value, size_t start_index) |
Converts the numeric value of each element of a specified sub std::vector of bytes to its equivalent hexadecimal xtd::ustring representation. More... | |
static xtd::ustring | to_string (const std::vector< byte_t > &value, size_t start_index, size_t length) |
Converts the numeric value of each element of a specified sub std::vector of bytes to its equivalent hexadecimal xtd::ustring representation. More... | |
static uint16_t | to_uint16 (const std::vector< byte_t > &value, size_t start_index) |
Returns a 16-bit unsigned integer converted from two bytes at a specified position in a byte_t std::vector. More... | |
static uint32_t | to_uint32 (const std::vector< byte_t > &value, size_t start_index) |
Returns a 32-bit signed integer converted from two bytes at a specified position in a byte_t std::vector. More... | |
static uint64_t | to_uint64 (const std::vector< byte_t > &value, size_t start_index) |
Returns a 64-bit unsigned integer converted from two bytes at a specified position in a byte_t std::vector. More... | |
|
static |
Converts the specified double-precision floating point number to a 64-bit signed integer.
value | The number to convert. |
|
static |
Returns the specified Boolean value as an std::vector of bytes.
value | A Boolean value. |
|
static |
Returns the specified Char value as an std::vector of bytes.
value | A Char value. |
|
static |
Returns the specified Char value as an std::vector of bytes.
value | A Char value. |
|
static |
Returns the specified Char value as an std::vector of bytes.
value | A Char value. |
|
static |
Returns the specified double value as an std::vector of bytes.
value | A double value. |
|
static |
Returns the specified single value as an std::vector of bytes.
value | A single value. |
|
static |
Returns the specified int16_t value as an std::vector of bytes.
value | A int16_t value. |
|
static |
Returns the specified int32_t value as an std::vector of bytes.
value | A int32_t value. |
|
static |
Returns the specified int64_t value as an std::vector of bytes.
value | A int64_t value. |
|
static |
Returns the specified uint16_t value as an std::vector of bytes.
value | A uint16_t value. |
|
static |
Returns the specified uint32_t value as an std::vector of bytes.
value | A uint32_t value. |
|
static |
Returns the specified uint64_t value as an std::vector of bytes.
value | A uint64_t value. |
|
static |
Returns the specified Char value as an std::vector of bytes.
value | A Char value. |
|
static |
Converts the specified 32-bit signed integer to a single-precision floating point number.
value | The number to convert. |
|
static |
Converts the specified 64-bit signed integer to a double-precision floating point number.
value | The number to convert. |
|
static |
Converts the specified single-precision floating point number to a 32-bit signed integer.
value | The number to convert. |
|
static |
Returns a Boolean value converted from one byte_t at a specified position in a byte_t std::vector.
value | An std::vector of bytes. |
start_index | The starting position within value. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a char32_t converted from two bytes at a specified position in a byte_t std::vector.
value | An std::vector of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a double-precision floating point number converted from eight bytes at a specified position in a byte_t std::vector.
value | An std::vector of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a 16-bit signed integer converted from two bytes at a specified position in a byte_t std::vector.
value | An std::vector of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a 32-bit signed integer converted from two bytes at a specified position in a byte_t std::vector.
value | An std::vector of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a 64-bit signed integer converted from two bytes at a specified position in a byte_t std::vector.
value | An std::vector of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a single-precision floating point number converted from eight bytes at a specified position in a byte_t std::vector.
value | An std::vector of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Converts the numeric value of each element of a specified std::vector of bytes to its equivalent hexadecimal xtd::ustring representation.
value | An std::vector of bytes. |
argument_null_exception | value is null. |
|
static |
Converts the numeric value of each element of a specified sub std::vector of bytes to its equivalent hexadecimal xtd::ustring representation.
value | An std::vector of bytes. |
start_index | The starting position within value. |
argument_null_exception | value is null. |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Converts the numeric value of each element of a specified sub std::vector of bytes to its equivalent hexadecimal xtd::ustring representation.
value | An std::vector of bytes. |
start_index | The starting position within value. |
length | The number of std::vector elements in value to convert. |
argument_null_exception | value is null. |
argument_out_of_range_exception | start_index or length is less than zero. -or- start_index is greater than zero and is greater than or equal to the length of value. |
argument_exception | The combination of start_index and length does not specify a position within value; that is, the start_index parameter is greater than the length of value minus the length parameter. |
|
static |
Returns a 16-bit unsigned integer converted from two bytes at a specified position in a byte_t std::vector.
value | An std::vector of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a 32-bit signed integer converted from two bytes at a specified position in a byte_t std::vector.
value | An std::vector of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a 64-bit unsigned integer converted from two bytes at a specified position in a byte_t std::vector.
value | An std::vector of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Indicates the byte_t order ("endianness") in which data is stored in this computer architecture.