aboutsummaryrefslogtreecommitdiff
path: root/zencore/include
diff options
context:
space:
mode:
Diffstat (limited to 'zencore/include')
-rw-r--r--zencore/include/zencore/string.h12
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)