mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-30 13:47:10 +01:00
SF 3558085: Add formatter to MACAddress object
This commit is contained in:
@@ -48,6 +48,8 @@
|
||||
#include <ipifcons.h>
|
||||
#endif
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
|
||||
using Poco::NumberFormatter;
|
||||
@@ -55,6 +57,20 @@ using Poco::FastMutex;
|
||||
using Poco::format;
|
||||
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const Poco::Net::NetworkInterface::MACAddress& mac)
|
||||
{
|
||||
std::ios state(0);
|
||||
state.copyfmt(os);
|
||||
for (unsigned i = 0; i < mac.size(); ++i)
|
||||
{
|
||||
if (i > 0) os << Poco::Net::NetworkInterface::MAC_SEPARATOR;
|
||||
os << std::hex << std::setw(2) << std::setfill('0') << (unsigned) mac[i];
|
||||
}
|
||||
os.copyfmt(state);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user