OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/base/ip_address.h" | 5 #include "net/base/ip_address.h" |
6 | 6 |
7 #include "net/base/ip_address_number.h" | 7 #include "net/base/ip_address_number.h" |
8 #include "url/gurl.h" | 8 #include "url/gurl.h" |
9 #include "url/url_canon_ip.h" | 9 #include "url/url_canon_ip.h" |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 return false; | 54 return false; |
55 | 55 |
56 std::swap(number, ip_address->ip_address_); | 56 std::swap(number, ip_address->ip_address_); |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 bool IPAddress::operator==(const IPAddress& that) const { | 60 bool IPAddress::operator==(const IPAddress& that) const { |
61 return ip_address_ == that.ip_address_; | 61 return ip_address_ == that.ip_address_; |
62 } | 62 } |
63 | 63 |
| 64 bool IPAddress::operator!=(const IPAddress& that) const { |
| 65 return ip_address_ != that.ip_address_; |
| 66 } |
| 67 |
64 bool IPAddress::operator<(const IPAddress& that) const { | 68 bool IPAddress::operator<(const IPAddress& that) const { |
65 // Sort IPv4 before IPv6. | 69 // Sort IPv4 before IPv6. |
66 if (ip_address_.size() != that.ip_address_.size()) { | 70 if (ip_address_.size() != that.ip_address_.size()) { |
67 return ip_address_.size() < that.ip_address_.size(); | 71 return ip_address_.size() < that.ip_address_.size(); |
68 } | 72 } |
69 | 73 |
70 return ip_address_ < that.ip_address_; | 74 return ip_address_ < that.ip_address_; |
71 } | 75 } |
72 | 76 |
73 } // namespace net | 77 } // namespace net |
OLD | NEW |