Core/ByteArray: Move ToHex implementation to .cpp

This commit is contained in:
Jérôme Leclercq
2016-11-08 16:14:56 +01:00
parent a8d4e44669
commit 8ed34d22fb
3 changed files with 17 additions and 17 deletions

View File

@@ -15,6 +15,22 @@ namespace Nz
* \brief Core class that represents an array of bytes
*/
/*!
* \brief Gives a string representation in base 16
* \return String in base 16
*/
String ByteArray::ToHex() const
{
std::size_t length = m_array.size() * 2;
String hexOutput(length, '\0');
for (std::size_t i = 0; i < m_array.size(); ++i)
std::sprintf(&hexOutput[i * 2], "%02x", m_array[i]);
return hexOutput;
}
/*!
* \brief Output operator
* \return The stream