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 <stddef.h> |
| 6 |
5 #include "chrome/common/local_discovery/service_discovery_client.h" | 7 #include "chrome/common/local_discovery/service_discovery_client.h" |
6 | 8 |
7 namespace local_discovery { | 9 namespace local_discovery { |
8 | 10 |
9 ServiceDescription::ServiceDescription() { | 11 ServiceDescription::ServiceDescription() { |
10 } | 12 } |
11 | 13 |
12 ServiceDescription::~ServiceDescription() { | 14 ServiceDescription::~ServiceDescription() { |
13 } | 15 } |
14 | 16 |
15 std::string ServiceDescription::instance_name() const { | 17 std::string ServiceDescription::instance_name() const { |
16 // TODO(noamsml): Once we have escaping working, get this to | 18 // TODO(noamsml): Once we have escaping working, get this to |
17 // parse escaped domains. | 19 // parse escaped domains. |
18 size_t first_period = service_name.find_first_of('.'); | 20 size_t first_period = service_name.find_first_of('.'); |
19 return service_name.substr(0, first_period); | 21 return service_name.substr(0, first_period); |
20 } | 22 } |
21 | 23 |
22 std::string ServiceDescription::service_type() const { | 24 std::string ServiceDescription::service_type() const { |
23 // TODO(noamsml): Once we have escaping working, get this to | 25 // TODO(noamsml): Once we have escaping working, get this to |
24 // parse escaped domains. | 26 // parse escaped domains. |
25 size_t first_period = service_name.find_first_of('.'); | 27 size_t first_period = service_name.find_first_of('.'); |
26 if (first_period == std::string::npos) | 28 if (first_period == std::string::npos) |
27 return ""; | 29 return ""; |
28 return service_name.substr(first_period+1); | 30 return service_name.substr(first_period+1); |
29 } | 31 } |
30 | 32 |
31 } // namespace local_discovery | 33 } // namespace local_discovery |
OLD | NEW |