OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_COMMON_COMMON_TYPE_CONVERTERS_H_ | 5 #ifndef MOJO_COMMON_COMMON_TYPE_CONVERTERS_H_ |
6 #define MOJO_COMMON_COMMON_TYPE_CONVERTERS_H_ | 6 #define MOJO_COMMON_COMMON_TYPE_CONVERTERS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 18 matching lines...) Expand all Loading... | |
29 template <> | 29 template <> |
30 struct MOJO_COMMON_EXPORT TypeConverter<String, base::string16> { | 30 struct MOJO_COMMON_EXPORT TypeConverter<String, base::string16> { |
31 static String Convert(const base::string16& input); | 31 static String Convert(const base::string16& input); |
32 }; | 32 }; |
33 | 33 |
34 template <> | 34 template <> |
35 struct MOJO_COMMON_EXPORT TypeConverter<base::string16, String> { | 35 struct MOJO_COMMON_EXPORT TypeConverter<base::string16, String> { |
36 static base::string16 Convert(const String& input); | 36 static base::string16 Convert(const String& input); |
37 }; | 37 }; |
38 | 38 |
39 // TODO(erg): In the very long term, we will want to remove conversion between | |
40 // std::strings and arrays of unsigned bytes. However, there is too much code | |
41 // across chrome which uses std::string as a bag of bytes that we probably | |
42 // don't want to roll this function at each callsite. | |
43 template <> | 39 template <> |
44 struct MOJO_COMMON_EXPORT TypeConverter<std::string, Array<uint8_t> > { | 40 struct MOJO_COMMON_EXPORT TypeConverter<std::string, Array<uint8_t> > { |
45 static std::string Convert(const Array<uint8_t>& input); | 41 static std::string Convert(const Array<uint8_t>& input); |
46 }; | 42 }; |
47 | 43 |
48 template <> | 44 template <> |
49 struct MOJO_COMMON_EXPORT TypeConverter<Array<uint8_t>, std::string> { | 45 struct MOJO_COMMON_EXPORT TypeConverter<Array<uint8_t>, std::string> { |
50 static Array<uint8_t> Convert(const std::string& input); | 46 static Array<uint8_t> Convert(const std::string& input); |
51 }; | 47 }; |
52 | 48 |
49 template <> | |
50 struct MOJO_COMMON_EXPORT TypeConverter<base::string16, Array<uint8_t> > { | |
dcheng
2016/03/18 06:35:29
Nit: >>
jam
2016/03/18 16:48:33
Done.
| |
51 static base::string16 Convert(const Array<uint8_t>& input); | |
52 }; | |
53 | |
54 template <> | |
55 struct MOJO_COMMON_EXPORT TypeConverter<Array<uint8_t>, base::string16> { | |
56 static Array<uint8_t> Convert(const base::string16& input); | |
57 }; | |
58 | |
53 } // namespace mojo | 59 } // namespace mojo |
54 | 60 |
55 #endif // MOJO_COMMON_COMMON_TYPE_CONVERTERS_H_ | 61 #endif // MOJO_COMMON_COMMON_TYPE_CONVERTERS_H_ |
OLD | NEW |