From: Steve Brokenshire Date: Thu, 21 Apr 2016 23:07:03 +0000 (+0100) Subject: Added the IntToHex function. X-Git-Tag: release-0.02~291 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=c7994c11113b0e4e270b34bbb8ea8521ddf4a6df;p=xestiacalendar%2F.git Added the IntToHex function. --- diff --git a/source/common/text.cpp b/source/common/text.cpp index d223993..f6549d2 100644 --- a/source/common/text.cpp +++ b/source/common/text.cpp @@ -256,4 +256,14 @@ bool HexToInt(std::string *HexString, int *Number){ return true; +} + +bool IntToHex(int *Number, std::string *HexString, int HexFill){ + + stringstream StringData; + StringData << setfill('0') << hex << setw(HexFill) << (*Number); + (*HexString) = StringData.str(); + + return true; + } \ No newline at end of file diff --git a/source/common/text.h b/source/common/text.h index f50113e..fa74d9b 100644 --- a/source/common/text.h +++ b/source/common/text.h @@ -7,6 +7,7 @@ #include #include #include +#include struct PropertyNameValue{ std::string Name; @@ -20,5 +21,6 @@ std::multimap ProcessTextVectors(std::vector SplitValues(std::string InputData); PropertyNameValue SplitNameValue(std::string InputData); bool HexToInt(std::string *HexString, int *Number); +bool IntToHex(int *Number, std::string *HexString, int HexFill); #endif \ No newline at end of file