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
3 // found in the LICENSE file.
4 
5 #include "components/policy/core/common/policy_namespace.h"
6 
7 #include <tuple>
8 
9 namespace policy {
10 
PolicyNamespace()11 PolicyNamespace::PolicyNamespace() {}
12 
PolicyNamespace(PolicyDomain domain,const std::string & component_id)13 PolicyNamespace::PolicyNamespace(PolicyDomain domain,
14                                  const std::string& component_id)
15     : domain(domain),
16       component_id(component_id) {}
17 
PolicyNamespace(const PolicyNamespace & other)18 PolicyNamespace::PolicyNamespace(const PolicyNamespace& other)
19     : domain(other.domain),
20       component_id(other.component_id) {}
21 
~PolicyNamespace()22 PolicyNamespace::~PolicyNamespace() {}
23 
operator =(const PolicyNamespace & other)24 PolicyNamespace& PolicyNamespace::operator=(const PolicyNamespace& other) {
25   domain = other.domain;
26   component_id = other.component_id;
27   return *this;
28 }
29 
operator <(const PolicyNamespace & other) const30 bool PolicyNamespace::operator<(const PolicyNamespace& other) const {
31   return std::tie(domain, component_id) <
32          std::tie(other.domain, other.component_id);
33 }
34 
operator ==(const PolicyNamespace & other) const35 bool PolicyNamespace::operator==(const PolicyNamespace& other) const {
36   return domain == other.domain && component_id == other.component_id;
37 }
38 
operator !=(const PolicyNamespace & other) const39 bool PolicyNamespace::operator!=(const PolicyNamespace& other) const {
40   return !(*this == other);
41 }
42 
43 }  // namespace policy
44