| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_utils.h" | 5 #include "device/bluetooth/bluetooth_utils.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 *format = UUID::kFormat128Bit; | 72 *format = UUID::kFormat128Bit; |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace | 75 } // namespace |
| 76 | 76 |
| 77 | 77 |
| 78 UUID::UUID(const std::string& uuid) { | 78 UUID::UUID(const std::string& uuid) { |
| 79 GetCanonicalUuid(uuid, &value_, &canonical_value_, &format_); | 79 GetCanonicalUuid(uuid, &value_, &canonical_value_, &format_); |
| 80 } | 80 } |
| 81 | 81 |
| 82 UUID::UUID() : format_(kFormatInvalid) { | |
| 83 } | |
| 84 | |
| 85 UUID::~UUID() { | 82 UUID::~UUID() { |
| 86 } | 83 } |
| 87 | 84 |
| 88 bool UUID::IsValid() const { | 85 bool UUID::IsValid() const { |
| 89 return format_ != kFormatInvalid; | 86 return format_ != kFormatInvalid; |
| 90 } | 87 } |
| 91 | 88 |
| 92 bool UUID::operator<(const UUID& uuid) const { | 89 bool UUID::operator<(const UUID& uuid) const { |
| 93 return canonical_value_ < uuid.canonical_value_; | 90 return canonical_value_ < uuid.canonical_value_; |
| 94 } | 91 } |
| 95 | 92 |
| 96 bool UUID::operator==(const UUID& uuid) const { | 93 bool UUID::operator==(const UUID& uuid) const { |
| 97 return canonical_value_ == uuid.canonical_value_; | 94 return canonical_value_ == uuid.canonical_value_; |
| 98 } | 95 } |
| 99 | 96 |
| 100 bool UUID::operator!=(const UUID& uuid) const { | 97 bool UUID::operator!=(const UUID& uuid) const { |
| 101 return canonical_value_ != uuid.canonical_value_; | 98 return canonical_value_ != uuid.canonical_value_; |
| 102 } | 99 } |
| 103 | 100 |
| 104 std::string CanonicalUuid(std::string uuid) { | 101 std::string CanonicalUuid(std::string uuid) { |
| 105 std::string value; | 102 std::string value; |
| 106 std::string canonical_value; | 103 std::string canonical_value; |
| 107 UUID::Format format; | 104 UUID::Format format; |
| 108 GetCanonicalUuid(uuid, &value, &canonical_value, &format); | 105 GetCanonicalUuid(uuid, &value, &canonical_value, &format); |
| 109 return canonical_value; | 106 return canonical_value; |
| 110 } | 107 } |
| 111 | 108 |
| 112 } // namespace bluetooth_utils | 109 } // namespace bluetooth_utils |
| 113 } // namespace device | 110 } // namespace device |
| OLD | NEW |