OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/service_manager/public/cpp/interface_provider_spec.h" | 5 #include "services/service_manager/public/cpp/interface_provider_spec.h" |
6 | 6 |
7 #include <tuple> | 7 #include <tuple> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 | 10 |
11 namespace service_manager { | 11 namespace service_manager { |
12 | 12 |
13 InterfaceProviderSpec::InterfaceProviderSpec() {} | 13 InterfaceProviderSpec::InterfaceProviderSpec() {} |
14 InterfaceProviderSpec::InterfaceProviderSpec( | 14 InterfaceProviderSpec::InterfaceProviderSpec( |
15 const InterfaceProviderSpec& other) = default; | 15 const InterfaceProviderSpec& other) = default; |
16 InterfaceProviderSpec::~InterfaceProviderSpec() {} | 16 InterfaceProviderSpec::~InterfaceProviderSpec() {} |
17 | 17 |
18 bool InterfaceProviderSpec::operator==( | 18 bool InterfaceProviderSpec::operator==( |
19 const InterfaceProviderSpec& other) const { | 19 const InterfaceProviderSpec& other) const { |
20 return other.provides == provides && other.requires == requires; | 20 return other.provides == provides && other.requires == requires; |
21 } | 21 } |
22 | 22 |
23 bool InterfaceProviderSpec::operator<( | 23 bool InterfaceProviderSpec::operator<( |
24 const InterfaceProviderSpec& other) const { | 24 const InterfaceProviderSpec& other) const { |
25 return std::tie(provides, requires) < | 25 return std::tie(provides, requires) < |
26 std::tie(other.provides, other.requires); | 26 std::tie(other.provides, other.requires); |
27 } | 27 } |
28 | 28 |
29 bool GetInterfaceProviderSpec(const std::string& spec_name, | 29 bool GetInterfaceProviderSpec(const std::string& spec_name, |
30 const InterfaceProviderSpecMap& map, | 30 const InterfaceProviderSpecMap& map, |
31 InterfaceProviderSpec* spec) { | 31 InterfaceProviderSpec* spec) { |
32 DCHECK(spec); | 32 DCHECK(spec); |
33 auto it = map.find(spec_name); | 33 auto it = map.find(spec_name); |
34 if (it != map.end()) { | 34 if (it != map.end()) { |
35 *spec = it->second; | 35 *spec = it->second; |
36 return true; | 36 return true; |
37 } | 37 } |
38 return false; | 38 return false; |
39 } | 39 } |
40 | 40 |
41 } // namespace service_manager | 41 } // namespace service_manager |
OLD | NEW |