/* ******************************************************************************* * INCLUDE ******************************************************************************* */ #include "HexBinaryCodec.h" #include #include namespace Util { /* ******************************************************************************* * CLASS DEFINE ******************************************************************************* */ std::string HexBinaryCodec::encode(const void* data, unsigned size, bool uppercase) { std::ostringstream ostr; Poco::HexBinaryEncoder encoder(ostr); encoder.rdbuf()->setUppercase(uppercase); uint8_t* pBytes = (uint8_t*)data; for (unsigned i = 0; i < size; i++) encoder << pBytes[i]; encoder.close(); return ostr.str(); } }