Index: mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl |
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl |
index 7c429c01b4661424d45eda449d21072d815e8d03..f367227a047640cb93a96badb068fd49dda97e11 100644 |
--- a/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl |
+++ b/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl |
@@ -13,17 +13,20 @@ class {{struct.name}} { |
template <typename U> |
{{struct.name}}(const U& u, mojo::Buffer* buf = mojo::Buffer::current()) { |
+ MOJO_INTERNAL_CHECK_ALLOW_IMPLICIT_TYPE_CONVERSION({{struct.name}}, U); |
*this = mojo::TypeConverter<{{struct.name}},U>::ConvertFrom(u, buf); |
} |
template <typename U> |
{{struct.name}}& operator=(const U& u) { |
+ MOJO_INTERNAL_CHECK_ALLOW_IMPLICIT_TYPE_CONVERSION({{struct.name}}, U); |
*this = mojo::TypeConverter<{{struct.name}},U>::ConvertFrom(u, mojo::Buffer::current()); |
return *this; |
} |
template <typename U> |
operator U() const { |
+ MOJO_INTERNAL_CHECK_ALLOW_IMPLICIT_TYPE_CONVERSION({{struct.name}}, U); |
return To<U>(); |
} |
@@ -32,6 +35,11 @@ class {{struct.name}} { |
return mojo::TypeConverter<{{struct.name}},U>::ConvertTo(*this); |
} |
+ template <typename U> |
+ static {{struct.name}} From(const U& u, mojo::Buffer* buf = mojo::Buffer::current()) { |
+ return mojo::TypeConverter<{{struct.name}},U>::ConvertFrom(u, buf); |
+ } |
+ |
bool is_null() const { return !data_; } |
{#--- Getters #} |