OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" |
| 9 |
| 10 namespace bluez { |
| 11 |
| 12 BluetoothServiceAttributeValueBlueZ::BluetoothServiceAttributeValueBlueZ( |
| 13 Type type, |
| 14 size_t size, |
| 15 std::unique_ptr<base::Value> value) |
| 16 : type_(type), size_(size), value_(std::move(value)) { |
| 17 CHECK_NE(type, SEQUENCE); |
| 18 } |
| 19 |
| 20 BluetoothServiceAttributeValueBlueZ::BluetoothServiceAttributeValueBlueZ( |
| 21 std::unique_ptr<Sequence> sequence) |
| 22 : type_(SEQUENCE), |
| 23 size_(sequence->size()), |
| 24 sequence_(std::move(sequence)) {} |
| 25 |
| 26 BluetoothServiceAttributeValueBlueZ::BluetoothServiceAttributeValueBlueZ( |
| 27 const BluetoothServiceAttributeValueBlueZ& attribute) { |
| 28 this->type_ = attribute.type_; |
| 29 this->size_ = attribute.size_; |
| 30 |
| 31 if (attribute.type_ != SEQUENCE) { |
| 32 this->value_ = base::WrapUnique(attribute.value_->DeepCopy()); |
| 33 return; |
| 34 } |
| 35 |
| 36 this->sequence_ = base::MakeUnique<Sequence>(*attribute.sequence_); |
| 37 } |
| 38 |
| 39 BluetoothServiceAttributeValueBlueZ BluetoothServiceAttributeValueBlueZ:: |
| 40 operator=(const BluetoothServiceAttributeValueBlueZ& attribute) { |
| 41 return BluetoothServiceAttributeValueBlueZ(attribute); |
| 42 } |
| 43 |
| 44 BluetoothServiceAttributeValueBlueZ::~BluetoothServiceAttributeValueBlueZ() {} |
| 45 |
| 46 } // namespace bluez |
OLD | NEW |