OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/policy/core/common/policy_namespace.h" | 5 #include "components/policy/core/common/policy_namespace.h" |
6 | 6 |
| 7 #include <tuple> |
| 8 |
7 namespace policy { | 9 namespace policy { |
8 | 10 |
9 PolicyNamespace::PolicyNamespace() {} | 11 PolicyNamespace::PolicyNamespace() {} |
10 | 12 |
11 PolicyNamespace::PolicyNamespace(PolicyDomain domain, | 13 PolicyNamespace::PolicyNamespace(PolicyDomain domain, |
12 const std::string& component_id) | 14 const std::string& component_id) |
13 : domain(domain), | 15 : domain(domain), |
14 component_id(component_id) {} | 16 component_id(component_id) {} |
15 | 17 |
16 PolicyNamespace::PolicyNamespace(const PolicyNamespace& other) | 18 PolicyNamespace::PolicyNamespace(const PolicyNamespace& other) |
17 : domain(other.domain), | 19 : domain(other.domain), |
18 component_id(other.component_id) {} | 20 component_id(other.component_id) {} |
19 | 21 |
20 PolicyNamespace::~PolicyNamespace() {} | 22 PolicyNamespace::~PolicyNamespace() {} |
21 | 23 |
22 PolicyNamespace& PolicyNamespace::operator=(const PolicyNamespace& other) { | 24 PolicyNamespace& PolicyNamespace::operator=(const PolicyNamespace& other) { |
23 domain = other.domain; | 25 domain = other.domain; |
24 component_id = other.component_id; | 26 component_id = other.component_id; |
25 return *this; | 27 return *this; |
26 } | 28 } |
27 | 29 |
28 bool PolicyNamespace::operator<(const PolicyNamespace& other) const { | 30 bool PolicyNamespace::operator<(const PolicyNamespace& other) const { |
29 return domain < other.domain || | 31 return std::tie(domain, component_id) < |
30 (domain == other.domain && component_id < other.component_id); | 32 std::tie(other.domain, other.component_id); |
31 } | 33 } |
32 | 34 |
33 bool PolicyNamespace::operator==(const PolicyNamespace& other) const { | 35 bool PolicyNamespace::operator==(const PolicyNamespace& other) const { |
34 return domain == other.domain && component_id == other.component_id; | 36 return domain == other.domain && component_id == other.component_id; |
35 } | 37 } |
36 | 38 |
37 bool PolicyNamespace::operator!=(const PolicyNamespace& other) const { | 39 bool PolicyNamespace::operator!=(const PolicyNamespace& other) const { |
38 return !(*this == other); | 40 return !(*this == other); |
39 } | 41 } |
40 | 42 |
41 } // namespace policy | 43 } // namespace policy |
OLD | NEW |