Provides utility functions for data.
More...
|
| bool | fromHex (std::string in, void *data) |
| | Converts a hexadecimal string to a binary data buffer.
|
| std::string | toHex (const void *data, const size_t dataLength) |
| | Converts binary data to a hexadecimal string.
|
| template<typename T> |
| std::string | toHex (const T &data) |
| | Converts a binary representation of a type T to a hexadecimal string.
|
| template<size_t rowSize = 8, bool showASCII = true> |
| std::string | hexDump (const void *address, size_t len) |
| | Hex dumps the memory block at the specified address.
|
Provides utility functions for data.
◆ fromHex()
| bool KittyUtils::Data::fromHex |
( |
std::string | in, |
|
|
void * | data ) |
Converts a hexadecimal string to a binary data buffer.
- Note
- data buffer must be large enough to fit.
- Parameters
-
| in | The hexadecimal string to convert. |
| data | Pointer to the destination buffer where the binary data will be stored. |
- Returns
- True if the conversion was successful, false otherwise.
◆ hexDump()
template<size_t rowSize = 8, bool showASCII = true>
| std::string KittyUtils::Data::hexDump |
( |
const void * | address, |
|
|
size_t | len ) |
Hex dumps the memory block at the specified address.
- Template Parameters
-
| rowSize | The size of each row in the hex dump. Default is 8 bytes. |
| showASCII | Whether to include ASCII representation of the memory block. Defult is true. |
- Parameters
-
| address | Pointer to the start of the memory block to dump. |
| len | Length of the memory block to dump. |
- Returns
- A string containing the hex dump of the memory block.
This function generates a human-readable hex dump of a memory block. It prints the address, hexadecimal values, and ASCII representation of the block. The dump is formatted into rows of specified size, and each row includes the offset, byte values, and ASCII characters. The ASCII representation only includes printable characters, and non-printable characters are represented by '.'.
◆ toHex() [1/2]
template<typename T>
| std::string KittyUtils::Data::toHex |
( |
const T & | data | ) |
|
Converts a binary representation of a type T to a hexadecimal string.
- Template Parameters
-
| T | The type of the binary data. |
- Parameters
-
| data | The instance of type T to convert. |
- Returns
- A hexadecimal string representation of the binary data.
◆ toHex() [2/2]
| std::string KittyUtils::Data::toHex |
( |
const void * | data, |
|
|
const size_t | dataLength ) |
Converts binary data to a hexadecimal string.
- Parameters
-
| data | Pointer to the source binary data. |
| dataLength | Length of the binary data. |
- Returns
- A hexadecimal string representation of the binary data.