Moved toHex functions to String helper class

This commit is contained in:
Nav
2023-01-21 13:37:56 +00:00
parent 662806769e
commit 6b4d3ecb26
12 changed files with 70 additions and 51 deletions

View File

@@ -83,42 +83,6 @@ namespace Bloom::DebugServer::Gdb
return packet;
}
/**
* Converts raw data to hexadecimal form, the form in which responses are expected to be delivered from the
* server.
*
* @param data
* @return
*/
static std::string toHex(const std::vector<unsigned char>& data) {
std::stringstream stream;
stream << std::hex << std::setfill('0');
for (const auto& byte : data) {
stream << std::setw(2) << static_cast<unsigned int>(byte);
}
return stream.str();
}
/**
* Converts a string to hexadecimal form, the form in which responses are expected to be delivered from the
* server.
*
* @param data
* @return
*/
static std::string toHex(const std::string& data) {
std::stringstream stream;
stream << std::hex << std::setfill('0');
for (const auto& byte : data) {
stream << std::setw(2) << static_cast<unsigned int>(byte);
}
return stream.str();
}
/**
* Converts data in hexadecimal form to raw data.
*