CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
25 namespace catapult {
namespace utils {
34 template<
typename TContainer>
36 if (2 * outputContainer.size() != dataSize)
39 for (
auto i = 0u; i < dataSize; i += 2) {
40 if (!
TryParseByte(pHexData[i], pHexData[i + 1], outputContainer[i / 2]))
48 template<
typename TContainer>
51 if (2 * outputContainer.size() != dataSize)
54 for (
auto i = 0u; i < dataSize; i += 2)
55 outputContainer[i / 2] =
ParseByte(pHexData[i], pHexData[i + 1]);
59 template<
typename TByteArray>
uint8_t ParseByte(char ch1, char ch2)
Parses two characters (ch1 and ch2) into a byte.
Definition: HexParser.cpp:41
TByteArray ParseByteArray(const std::string &hexString)
Parses a hex string (hexString) into a byte array.
Definition: HexParser.h:60
bool TryParseByte(char ch1, char ch2, uint8_t &by)
Tries to parse two characters (ch1 and ch2) into a byte (by).
Definition: HexParser.cpp:51
#define CATAPULT_THROW_INVALID_ARGUMENT_1(MESSAGE, PARAM1)
Macro used to throw a catapult invalid argument with a single parameter.
Definition: exceptions.h:183
bool TryParseHexStringIntoContainer(const char *const pHexData, size_t dataSize, TContainer &outputContainer)
Tries to parse a hex string (pHexData with size dataSize) into outputContainer.
Definition: HexParser.h:35
void ParseHexStringIntoContainer(const char *const pHexData, size_t dataSize, TContainer &outputContainer)
Parses a hex string (pHexData with size dataSize) into outputContainer.
Definition: HexParser.h:49
Definition: AddressExtractionExtension.cpp:28