50 std::memcpy(_addr.bytes, octets, 4);
69 std::memcpy(_addr.bytes, octets, 4);
87 operator uint32_t()
const {
return _addr.dword; }
90 explicit operator bool()
const {
return _addr.dword != 0; }
97 return _addr.dword == other._addr.
dword;
101 return !(*
this == other);
108 return std::memcmp(_addr.bytes, octets, 4) == 0;
114 std::snprintf(buf,
sizeof(buf),
"%u.%u.%u.%u",
115 _addr.bytes[0], _addr.bytes[1],
116 _addr.bytes[2], _addr.bytes[3]);
123 if (!str)
return false;
125 if (std::sscanf(str,
"%u.%u.%u.%u", &a, &b, &c, &d) != 4)
return false;
126 if (a > 255 || b > 255 || c > 255 || d > 255)
return false;