Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Side by Side Diff: device/bluetooth/bluetooth_uuid.cc

Issue 1200053004: Move more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/bluetooth/bluetooth_device.cc ('k') | device/udev_linux/udev.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "device/bluetooth/bluetooth_uuid.h" 5 #include "device/bluetooth/bluetooth_uuid.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 10
(...skipping 22 matching lines...) Expand all
33 uuid = uuid.substr(2); 33 uuid = uuid.substr(2);
34 34
35 if (!(uuid.size() == 4 || uuid.size() == 8 || uuid.size() == 36)) 35 if (!(uuid.size() == 4 || uuid.size() == 8 || uuid.size() == 36))
36 return; 36 return;
37 37
38 for (size_t i = 0; i < uuid.size(); ++i) { 38 for (size_t i = 0; i < uuid.size(); ++i) {
39 if (i == 8 || i == 13 || i == 18 || i == 23) { 39 if (i == 8 || i == 13 || i == 18 || i == 23) {
40 if (uuid[i] != '-') 40 if (uuid[i] != '-')
41 return; 41 return;
42 } else { 42 } else {
43 if (!IsHexDigit(uuid[i])) 43 if (!base::IsHexDigit(uuid[i]))
44 return; 44 return;
45 uuid[i] = base::ToLowerASCII(uuid[i]); 45 uuid[i] = base::ToLowerASCII(uuid[i]);
46 } 46 }
47 } 47 }
48 48
49 canonical->assign(uuid); 49 canonical->assign(uuid);
50 if (uuid.size() == 4) { 50 if (uuid.size() == 4) {
51 canonical_128->assign(kCommonUuidPrefix + uuid + kCommonUuidPostfix); 51 canonical_128->assign(kCommonUuidPrefix + uuid + kCommonUuidPostfix);
52 *format = BluetoothUUID::kFormat16Bit; 52 *format = BluetoothUUID::kFormat16Bit;
53 } else if (uuid.size() == 8) { 53 } else if (uuid.size() == 8) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 bool BluetoothUUID::operator!=(const BluetoothUUID& uuid) const { 87 bool BluetoothUUID::operator!=(const BluetoothUUID& uuid) const {
88 return canonical_value_ != uuid.canonical_value_; 88 return canonical_value_ != uuid.canonical_value_;
89 } 89 }
90 90
91 void PrintTo(const BluetoothUUID& uuid, std::ostream* out) { 91 void PrintTo(const BluetoothUUID& uuid, std::ostream* out) {
92 *out << uuid.canonical_value(); 92 *out << uuid.canonical_value();
93 } 93 }
94 94
95 } // namespace device 95 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device.cc ('k') | device/udev_linux/udev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698