| OLD | NEW |
| 1 {%- set mojom_type = enum|get_qualified_name_for_kind %} | 1 {%- set mojom_type = enum|get_qualified_name_for_kind %} |
| 2 | 2 |
| 3 template <> | 3 template <> |
| 4 struct EnumTraits<{{mojom_type}}, {{mojom_type}}> { | 4 struct {{export_attribute}} EnumTraits<{{mojom_type}}, {{mojom_type}}> { |
| 5 static {{mojom_type}} ToMojom({{mojom_type}} input) { return input; } | 5 static {{mojom_type}} ToMojom({{mojom_type}} input) { return input; } |
| 6 static bool FromMojom({{mojom_type}} input, {{mojom_type}}* output) { | 6 static bool FromMojom({{mojom_type}} input, {{mojom_type}}* output) { |
| 7 *output = input; | 7 *output = input; |
| 8 return true; | 8 return true; |
| 9 } | 9 } |
| 10 }; | 10 }; |
| 11 | 11 |
| 12 namespace internal { | 12 namespace internal { |
| 13 | 13 |
| 14 template <typename MaybeConstUserType> | 14 template <typename MaybeConstUserType> |
| 15 struct Serializer<{{mojom_type}}, MaybeConstUserType> { | 15 struct Serializer<{{mojom_type}}, MaybeConstUserType> { |
| 16 using UserType = typename std::remove_const<MaybeConstUserType>::type; | 16 using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| 17 using Traits = EnumTraits<{{mojom_type}}, UserType>; | 17 using Traits = EnumTraits<{{mojom_type}}, UserType>; |
| 18 | 18 |
| 19 static void Serialize(UserType input, int32_t* output) { | 19 static void Serialize(UserType input, int32_t* output) { |
| 20 *output = static_cast<int32_t>(Traits::ToMojom(input)); | 20 *output = static_cast<int32_t>(Traits::ToMojom(input)); |
| 21 } | 21 } |
| 22 | 22 |
| 23 static bool Deserialize(int32_t input, UserType* output) { | 23 static bool Deserialize(int32_t input, UserType* output) { |
| 24 return Traits::FromMojom(static_cast<{{mojom_type}}>(input), output); | 24 return Traits::FromMojom(static_cast<{{mojom_type}}>(input), output); |
| 25 } | 25 } |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 } // namespace internal | 28 } // namespace internal |
| OLD | NEW |