roll skia to 4276
[chromium-blink-merge.git] / base / nullable_string16.h
blob070254905e7877a0bbf22b8c7d14b91d14f3bbfc
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_NULLABLE_STRING16_H_
6 #define BASE_NULLABLE_STRING16_H_
7 #pragma once
9 #include "base/string16.h"
11 // This class is a simple wrapper for string16 which also contains a null
12 // state. This should be used only where the difference between null and
13 // empty is meaningful.
14 class NullableString16 {
15 public:
16 NullableString16() : is_null_(false) { }
17 explicit NullableString16(bool is_null) : is_null_(is_null) { }
18 NullableString16(const string16& string, bool is_null)
19 : string_(string), is_null_(is_null) {
22 const string16& string() const { return string_; }
23 bool is_null() const { return is_null_; }
25 private:
26 string16 string_;
27 bool is_null_;
30 #endif // BASE_NULLABLE_STRING16_H_