Remove linux_chromium_gn_dbg from the chromium CQ.
[chromium-blink-merge.git] / base / strings / nullable_string16.h
blob016c25c2501f996952ab42071482e1339652de0a
1 // Copyright (c) 2010 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.
5 #ifndef BASE_STRINGS_NULLABLE_STRING16_H_
6 #define BASE_STRINGS_NULLABLE_STRING16_H_
8 #include <iosfwd>
10 #include "base/base_export.h"
11 #include "base/strings/string16.h"
13 namespace base {
15 // This class is a simple wrapper for string16 which also contains a null
16 // state. This should be used only where the difference between null and
17 // empty is meaningful.
18 class NullableString16 {
19 public:
20 NullableString16() : is_null_(true) { }
21 NullableString16(const string16& string, bool is_null)
22 : string_(string), is_null_(is_null) {
25 const string16& string() const { return string_; }
26 bool is_null() const { return is_null_; }
28 private:
29 string16 string_;
30 bool is_null_;
33 inline bool operator==(const NullableString16& a, const NullableString16& b) {
34 return a.is_null() == b.is_null() && a.string() == b.string();
37 inline bool operator!=(const NullableString16& a, const NullableString16& b) {
38 return !(a == b);
41 BASE_EXPORT std::ostream& operator<<(std::ostream& out,
42 const NullableString16& value);
44 } // namespace base
46 #endif // BASE_STRINGS_NULLABLE_STRING16_H_