| 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..df17833b17dccd6f454831352fc1022045c9ea0c 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_DIRECT_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_DIRECT_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_DIRECT_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 #}
|
|
|