mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 05:47:14 +02:00
Merge branch 'developer' into mysocket
This commit is contained in:
@ -24,9 +24,7 @@ IpAddr::IpAddr(const std::string &address) {
|
||||
inet_pton(AF_INET, address.c_str(), &addr_);
|
||||
}
|
||||
|
||||
IpAddr::IpAddr(const char *address) {
|
||||
inet_pton(AF_INET, address, &addr_);
|
||||
}
|
||||
IpAddr::IpAddr(const char *address) { inet_pton(AF_INET, address, &addr_); }
|
||||
|
||||
std::string IpAddr::str() const {
|
||||
char ipstring[INET_ADDRSTRLEN]{};
|
||||
@ -35,9 +33,9 @@ std::string IpAddr::str() const {
|
||||
}
|
||||
std::string IpAddr::hex() const {
|
||||
std::ostringstream ss;
|
||||
ss << std::hex << std::setfill('0');
|
||||
for (int i = 0; i != 4; ++i) {
|
||||
ss << std::hex << std::setfill('0') << std::setw(2)
|
||||
<< ((addr_ >> i * 8) & 0xFF);
|
||||
ss << std::setw(2) << ((addr_ >> i * 8) & 0xFF);
|
||||
}
|
||||
return ss.str();
|
||||
}
|
||||
@ -60,18 +58,14 @@ std::string MacAddr::to_hex(const char delimiter) const {
|
||||
for (int i = 32; i >= 0; i -= 8) {
|
||||
if (delimiter)
|
||||
ss << delimiter;
|
||||
ss << ((addr_ >> i) & 0xFF);
|
||||
ss << std::setw(2) << ((addr_ >> i) & 0xFF);
|
||||
}
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::string MacAddr::str() const {
|
||||
return to_hex(':');
|
||||
}
|
||||
std::string MacAddr::str() const { return to_hex(':'); }
|
||||
|
||||
std::string MacAddr::hex() const {
|
||||
return to_hex();
|
||||
}
|
||||
std::string MacAddr::hex() const { return to_hex(); }
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const IpAddr &addr) {
|
||||
return out << addr.str();
|
||||
|
Reference in New Issue
Block a user