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_NULLABLE_STRING16_H_ 6#define BASE_NULLABLE_STRING16_H_ 7#pragma once 8 9#include "base/string16.h" 10 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. 14class 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) { 20 } 21 22 const string16& string() const { return string_; } 23 bool is_null() const { return is_null_; } 24 25 private: 26 string16 string_; 27 bool is_null_; 28}; 29 30#endif // BASE_NULLABLE_STRING16_H_ 31