OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_STRING_TRAITS_STRING16_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_STRING_TRAITS_STRING16_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_STRING_TRAITS_STRING16_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_STRING_TRAITS_STRING16_H_ |
7 | 7 |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "mojo/public/cpp/bindings/bindings_export.h" |
9 #include "mojo/public/cpp/bindings/string_traits.h" | 10 #include "mojo/public/cpp/bindings/string_traits.h" |
10 | 11 |
11 namespace mojo { | 12 namespace mojo { |
12 | 13 |
13 template <> | 14 template <> |
14 struct StringTraits<base::string16> { | 15 struct MOJO_CPP_BINDINGS_EXPORT StringTraits<base::string16> { |
15 static bool IsNull(const base::string16& input) { | 16 static bool IsNull(const base::string16& input) { |
16 // base::string16 is always converted to non-null mojom string. | 17 // base::string16 is always converted to non-null mojom string. |
17 return false; | 18 return false; |
18 } | 19 } |
19 | 20 |
20 static void SetToNull(base::string16* output) { | 21 static void SetToNull(base::string16* output) { |
21 // Convert null to an "empty" base::string16. | 22 // Convert null to an "empty" base::string16. |
22 output->clear(); | 23 output->clear(); |
23 } | 24 } |
24 | 25 |
25 static void* SetUpContext(const base::string16& input); | 26 static void* SetUpContext(const base::string16& input); |
26 static void TearDownContext(const base::string16& input, void* context); | 27 static void TearDownContext(const base::string16& input, void* context); |
27 | 28 |
28 static size_t GetSize(const base::string16& input, void* context); | 29 static size_t GetSize(const base::string16& input, void* context); |
29 static const char* GetData(const base::string16& input, void* context); | 30 static const char* GetData(const base::string16& input, void* context); |
30 | 31 |
31 static bool Read(StringDataView input, base::string16* output); | 32 static bool Read(StringDataView input, base::string16* output); |
32 }; | 33 }; |
33 | 34 |
34 } // namespace mojo | 35 } // namespace mojo |
35 | 36 |
36 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRING_TRAITS_STRING16_H_ | 37 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRING_TRAITS_STRING16_H_ |
OLD | NEW |