Index: mojo/public/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl |
diff --git a/mojo/public/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl b/mojo/public/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl |
deleted file mode 100644 |
index e43146e166760e44684a9e0f3ea9913276cce8c1..0000000000000000000000000000000000000000 |
--- a/mojo/public/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl |
+++ /dev/null |
@@ -1,87 +0,0 @@ |
-class {{struct.name}} { |
- public: |
- typedef internal::{{struct.name}}_Data Data; |
- |
-{#--- Enums #} |
-{%- for enum in struct.enums -%} |
-{% macro enum_def() %}{% include "enum_declaration.tmpl" %}{% endmacro %} |
- {{enum_def()|indent(2)}} |
-{%- endfor %} |
- |
- {{struct.name}}() : data_(NULL) { |
- } |
- |
- template <typename U> |
- {{struct.name}}(const U& u, mojo::Buffer* buf = mojo::Buffer::current()) { |
- *this = mojo::TypeConverter<{{struct.name}},U>::ConvertFrom(u, buf); |
- } |
- |
- template <typename U> |
- {{struct.name}}& operator=(const U& u) { |
- *this = mojo::TypeConverter<{{struct.name}},U>::ConvertFrom(u, mojo::Buffer::current()); |
- return *this; |
- } |
- |
- template <typename U> |
- operator U() const { |
- return To<U>(); |
- } |
- |
- template <typename U> |
- U To() const { |
- return mojo::TypeConverter<{{struct.name}},U>::ConvertTo(*this); |
- } |
- |
- bool is_null() const { return !data_; } |
- |
-{#--- Getters #} |
-{% for packed_field in struct.packed.packed_fields %} |
-{%- set type = packed_field.field.kind|cpp_wrapper_type %} |
-{%- set name = packed_field.field.name %} |
-{%- if packed_field.field.kind|is_object_kind %} |
- const {{type}} {{name}}() const { {# |
- #}return mojo::internal::Wrap(data_->{{name}}()); } |
-{%- elif packed_field.field.kind|is_handle_kind %} |
- {{type}} {{name}}() const { return mojo::MakePassable(data_->{{name}}()); } |
-{%- elif packed_field.field.kind|is_enum_kind %} |
- {{type}} {{name}}() const { return static_cast<{{type}}>(data_->{{name}}()); } |
-{%- else %} |
- {{type}} {{name}}() const { return data_->{{name}}(); } |
-{%- endif %} |
-{%- endfor %} |
- |
- class Builder { |
- public: |
- explicit Builder(mojo::Buffer* buf = mojo::Buffer::current()); |
- |
-{#--- Setters #} |
-{% for packed_field in struct.packed.packed_fields %} |
-{%- set type = packed_field.field.kind|cpp_const_wrapper_type %} |
-{%- set name = packed_field.field.name %} |
-{%- if packed_field.field.kind|is_object_kind %} |
- void set_{{name}}({{type}} {{name}}) { {# |
- #}data_->set_{{name}}(mojo::internal::Unwrap({{name}})); } |
-{%- elif packed_field.field.kind|is_handle_kind %} |
- void set_{{name}}({{type}} {{name}}) { {# |
- #}data_->set_{{name}}({{name}}.release()); } |
-{%- else %} |
- void set_{{name}}({{type}} {{name}}) { {# |
- #}data_->set_{{name}}({{name}}); } |
-{%- endif %} |
-{%- endfor %} |
- |
- {{struct.name}} Finish(); |
- |
- private: |
- {{struct.name}}::Data* data_; |
- MOJO_DISALLOW_COPY_AND_ASSIGN(Builder); |
- }; |
- |
- private: |
- friend class mojo::internal::WrapperHelper<{{struct.name}}>; |
- |
- struct Wrap {}; |
- {{struct.name}}(Wrap, const Data* data) : data_(data) {} |
- |
- const Data* data_; |
-}; |