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" |
| 10 |
9 namespace service_manager { | 11 namespace service_manager { |
10 | 12 |
11 InterfaceProviderSpec::InterfaceProviderSpec() {} | 13 InterfaceProviderSpec::InterfaceProviderSpec() {} |
12 InterfaceProviderSpec::InterfaceProviderSpec( | 14 InterfaceProviderSpec::InterfaceProviderSpec( |
13 const InterfaceProviderSpec& other) = default; | 15 const InterfaceProviderSpec& other) = default; |
14 InterfaceProviderSpec::~InterfaceProviderSpec() {} | 16 InterfaceProviderSpec::~InterfaceProviderSpec() {} |
15 | 17 |
16 bool InterfaceProviderSpec::operator==( | 18 bool InterfaceProviderSpec::operator==( |
17 const InterfaceProviderSpec& other) const { | 19 const InterfaceProviderSpec& other) const { |
18 return other.provides == provides && other.requires == requires; | 20 return other.provides == provides && other.requires == requires; |
19 } | 21 } |
20 | 22 |
21 bool InterfaceProviderSpec::operator<( | 23 bool InterfaceProviderSpec::operator<( |
22 const InterfaceProviderSpec& other) const { | 24 const InterfaceProviderSpec& other) const { |
23 return std::tie(provides, requires) < | 25 return std::tie(provides, requires) < |
24 std::tie(other.provides, other.requires); | 26 std::tie(other.provides, other.requires); |
25 } | 27 } |
26 | 28 |
| 29 bool GetInterfaceProviderSpec(const std::string& spec_name, |
| 30 const InterfaceProviderSpecMap& map, |
| 31 InterfaceProviderSpec* spec) { |
| 32 DCHECK(spec); |
| 33 auto it = map.find(spec_name); |
| 34 if (it != map.end()) { |
| 35 *spec = it->second; |
| 36 return true; |
| 37 } |
| 38 return false; |
| 39 } |
| 40 |
27 } // namespace service_manager | 41 } // namespace service_manager |
OLD | NEW |