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

Side by Side Diff: base/strings/nullable_string16.h

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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 | « base/strings/latin1_string_conversions.cc ('k') | base/strings/nullable_string16.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef BASE_STRINGS_NULLABLE_STRING16_H_
6 #define BASE_STRINGS_NULLABLE_STRING16_H_
7
8 #include <iosfwd>
9
10 #include "base/base_export.h"
11 #include "base/strings/string16.h"
12
13 namespace base {
14
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) {
23 }
24
25 const string16& string() const { return string_; }
26 bool is_null() const { return is_null_; }
27
28 private:
29 string16 string_;
30 bool is_null_;
31 };
32
33 inline bool operator==(const NullableString16& a, const NullableString16& b) {
34 return a.is_null() == b.is_null() && a.string() == b.string();
35 }
36
37 inline bool operator!=(const NullableString16& a, const NullableString16& b) {
38 return !(a == b);
39 }
40
41 BASE_EXPORT std::ostream& operator<<(std::ostream& out,
42 const NullableString16& value);
43
44 } // namespace base
45
46 #endif // BASE_STRINGS_NULLABLE_STRING16_H_
OLDNEW
« no previous file with comments | « base/strings/latin1_string_conversions.cc ('k') | base/strings/nullable_string16.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698