[go: nahoru, domu]

blob: 076b282eb15d776c00a9578907c3048e585fa29e [file] [log] [blame]
darin@chromium.orge5e4dde62013-06-17 21:36:411// Copyright (c) 2013 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
avi@chromium.orgc3d4a0d2013-06-20 19:40:125#include "base/strings/nullable_string16.h"
darin@chromium.orge5e4dde62013-06-17 21:36:416
7#include <ostream>
Sam McNally86419ce02017-05-22 23:29:468#include <utility>
darin@chromium.orge5e4dde62013-06-17 21:36:419
10namespace base {
Sam McNally86419ce02017-05-22 23:29:4611NullableString16::NullableString16() = default;
12NullableString16::NullableString16(const NullableString16& other) = default;
13NullableString16::NullableString16(NullableString16&& other) = default;
14
15NullableString16::NullableString16(const string16& string, bool is_null) {
16 if (!is_null)
17 string_.emplace(string);
18}
19
20NullableString16::NullableString16(Optional<string16> optional_string16)
21 : string_(std::move(optional_string16)) {}
22
23NullableString16::~NullableString16() = default;
24NullableString16& NullableString16::operator=(const NullableString16& other) =
25 default;
26NullableString16& NullableString16::operator=(NullableString16&& other) =
27 default;
darin@chromium.orge5e4dde62013-06-17 21:36:4128
29std::ostream& operator<<(std::ostream& out, const NullableString16& value) {
Sam McNally86419ce02017-05-22 23:29:4630 return value.is_null() ? out << "(null)" : out << value.string();
darin@chromium.orge5e4dde62013-06-17 21:36:4131}
32
33} // namespace base