New StringService::toHex() overload for std::uint16_t
This commit is contained in:
@@ -54,6 +54,12 @@ namespace Services
|
|||||||
return stream.str();
|
return stream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string StringService::toHex(std::uint16_t value) {
|
||||||
|
auto stream = std::stringstream{};
|
||||||
|
stream << std::hex << std::setfill('0') << std::setw(4) << static_cast<unsigned int>(value);
|
||||||
|
return stream.str();
|
||||||
|
}
|
||||||
|
|
||||||
std::string StringService::toHex(unsigned char value) {
|
std::string StringService::toHex(unsigned char value) {
|
||||||
auto stream = std::stringstream{};
|
auto stream = std::stringstream{};
|
||||||
stream << std::hex << std::setfill('0') << std::setw(2) << static_cast<unsigned int>(value);
|
stream << std::hex << std::setfill('0') << std::setw(2) << static_cast<unsigned int>(value);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ namespace Services
|
|||||||
|
|
||||||
static std::string toHex(std::uint64_t value);
|
static std::string toHex(std::uint64_t value);
|
||||||
static std::string toHex(std::uint32_t value);
|
static std::string toHex(std::uint32_t value);
|
||||||
|
static std::string toHex(std::uint16_t value);
|
||||||
static std::string toHex(unsigned char value);
|
static std::string toHex(unsigned char value);
|
||||||
static std::string toHex(const std::vector<unsigned char>& data);
|
static std::string toHex(const std::vector<unsigned char>& data);
|
||||||
static std::string toHex(const std::string& data);
|
static std::string toHex(const std::string& data);
|
||||||
|
|||||||
Reference in New Issue
Block a user