OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MOJO_COMMON_COMMON_TYPE_CONVERTERS_H_ | |
6 #define MOJO_COMMON_COMMON_TYPE_CONVERTERS_H_ | |
7 | |
8 #include <stdint.h> | |
9 #include <vector> | |
10 | |
11 #include "base/strings/string16.h" | |
12 #include "base/strings/string_piece.h" | |
13 #include "mojo/common/mojo_common_export.h" | |
14 #include "mojo/public/cpp/bindings/array.h" | |
15 #include "mojo/public/cpp/bindings/type_converter.h" | |
16 | |
17 namespace mojo { | |
18 | |
19 template <> | |
20 struct MOJO_COMMON_EXPORT TypeConverter<std::string, Array<uint8_t>> { | |
21 static std::string Convert(const Array<uint8_t>& input); | |
22 }; | |
23 | |
24 template <> | |
25 struct MOJO_COMMON_EXPORT TypeConverter<Array<uint8_t>, std::string> { | |
26 static Array<uint8_t> Convert(const std::string& input); | |
27 }; | |
28 | |
29 template <> | |
30 struct MOJO_COMMON_EXPORT TypeConverter<Array<uint8_t>, base::StringPiece> { | |
31 static Array<uint8_t> Convert(const base::StringPiece& input); | |
32 }; | |
33 | |
34 template <> | |
35 struct MOJO_COMMON_EXPORT TypeConverter<base::string16, Array<uint8_t>> { | |
36 static base::string16 Convert(const Array<uint8_t>& input); | |
37 }; | |
38 | |
39 template <> | |
40 struct MOJO_COMMON_EXPORT TypeConverter<Array<uint8_t>, base::string16> { | |
41 static Array<uint8_t> Convert(const base::string16& input); | |
42 }; | |
43 | |
44 } // namespace mojo | |
45 | |
46 #endif // MOJO_COMMON_COMMON_TYPE_CONVERTERS_H_ | |
OLD | NEW |