HexStringDecoder
INCLUDE FILE
#include "HexStringDecoder.h"
class HexStringDecoder
A helper class to decode hexadecimal strings.
DEFINITION
class HexStringDecoder;
method decode
Decode a single hexadecimal character, ignoring whitespace characters.
DEFINITION
| void decode | ( | char character | ); |
| PARAMETER | DESCRIPTION |
|---|---|
character |
The character to decode. |
| THROWS | DESCRIPTION |
|---|---|
Exception |
If the character is not a valid character. |
method decode
Decode a partial hexadecimal string, ignoring whitespace characters.
DEFINITION
| void decode | ( | const std::string & string | ); |
| PARAMETER | DESCRIPTION |
|---|---|
string |
The string to decode. |
| THROWS | DESCRIPTION |
|---|---|
Exception |
If the string contains an invalid character. |
method end
Finish decoding and return the resulting string.
DEFINITION
| std::string end | ( | ); |
| RETURNS | DESCRIPTION |
|---|---|
std::string |
The decoded string. |
| THROWS | DESCRIPTION |
|---|---|
Exception |
If there is a partial hexadecimal left. |
method valuestatic private
Get the numeric value of a hexadecimal digit.
DEFINITION
| static uint8_t value | ( | char digit | ); |
| PARAMETER | DESCRIPTION |
|---|---|
digit |
The hexadecimal digit. |
| RETURNS | DESCRIPTION |
|---|---|
uint8_t |
The numeric value of the digit. |
member partialprivate
The partial value of the last decoded hexadecimal digit, if any.
DEFINITION
std::optional< uint8_t > partial;
member stringprivate
The decoded string so far.
DEFINITION
std::string string;