diff options
| author | Dan Engelbrecht <[email protected]> | 2022-03-28 08:53:21 +0200 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2022-03-31 11:29:28 +0200 |
| commit | 4a79da88dd5a141293d23fda54ee5de28d25d7f3 (patch) | |
| tree | bd6f387b0bc2277b00aa4a32549179edc1ab1c84 | |
| parent | Switch from std::shared_ptr<> to Ref<> (diff) | |
| download | zen-4a79da88dd5a141293d23fda54ee5de28d25d7f3.tar.xz zen-4a79da88dd5a141293d23fda54ee5de28d25d7f3.zip | |
comments for ToHexNumber and ParseHexNumber
| -rw-r--r-- | zencore/include/zencore/string.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/zencore/include/zencore/string.h b/zencore/include/zencore/string.h index da5a50064..4dbed0fd2 100644 --- a/zencore/include/zencore/string.h +++ b/zencore/include/zencore/string.h @@ -593,6 +593,11 @@ ToHexNumber(const uint8_t* InputData, size_t ByteCount, char* OutString) } } +/// <summary> +/// Generates a hex number from a pointer to an integer type, this formats the number in the correct order for a hexadecimal number +/// </summary> +/// <param name="Value">Integer value type</param> +/// <param name="outString">Output buffer where resulting string is written</param> template<typename T> void ToHexNumber(T Value, char* OutString) @@ -601,6 +606,13 @@ ToHexNumber(T Value, char* OutString) OutString[sizeof(T) * 2] = 0; } +/// <summary> +/// Parse hex number string into a value, this formats the number in the correct order for a hexadecimal number +/// </summary> +/// <param name="string">Input string</param> +/// <param name="characterCount">Number of characters in string</param> +/// <param name="OutValue">Pointer to output value</param> +/// <returns>true if the input consisted of all valid hexadecimal characters</returns> template<typename T> bool ParseHexNumber(const std::string HexString, T& OutValue) |