Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: mojo/public/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl

Issue 226263002: Mojo: Move mojo/public/bindings to mojo/public/tools/bindings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_;
-};

Powered by Google App Engine
This is Rietveld 408576698