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

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

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 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/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
deleted file mode 100644
index 1b976cf7088adad9e8694dfd30c533918ae33ca4..0000000000000000000000000000000000000000
--- a/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl
+++ /dev/null
@@ -1,77 +0,0 @@
-{% from "enum_macros.tmpl" import enum_decl -%}
-class {{struct.name}} {
- public:
- using Data_ = internal::{{struct.name}}_Data;
-
-{#--- Enums #}
-{%- for enum in struct.enums -%}
- {{enum_decl(enum, is_static=true)|indent(2)}}
-{%- endfor %}
-
-{#--- Constants #}
-{%- for constant in struct.constants %}
-{%- if constant.kind|is_integral_kind %}
- static const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|constant_value}};
-{%- else %}
- static const {{constant.kind|cpp_pod_type}} {{constant.name}};
-{%- endif %}
-{%- endfor %}
-
- static {{struct.name}}Ptr New();
-
- template <typename U>
- static {{struct.name}}Ptr From(const U& u) {
- return mojo::TypeConverter<{{struct.name}}Ptr, U>::Convert(u);
- }
-
- template <typename U>
- U To() const {
- return mojo::TypeConverter<U, {{struct.name}}>::Convert(*this);
- }
-
- {{struct.name}}();
- ~{{struct.name}}();
-
- // Returns the number of bytes it would take to serialize this struct's data.
- size_t GetSerializedSize() const;
-
- // Returns true on successful serialization. On failure, part of the data may
- // be serialized, until the point of failure. This API does not support
- // serializing handles. If not null, |bytes_written| is set to the number of
- // bytes written to |buf|, even if this function return false.
- //
- // TODO(vardhan): For now, we return true for success. Should we define a
- // public error type for serialization? Should we open up
- // internal::ValidationError?
- bool Serialize(void* buf, size_t buf_size, size_t* bytes_written = nullptr);
-
- // Deserializes the given |buf| of size |buf_size| representing a serialized
- // version of this struct. The buffer is validated before it is deserialized.
- // Returns true on successful deserialization.
- // TODO(vardhan): Recover the validation error if there is one?
- bool Deserialize(void* buf, size_t buf_size);
-
- // Deserializes the given |buf| representing a serialized version of this
- // struct. The buffer is NOT validated before it is deserialized, so the user
- // must be confident of its validity and that |buf| points to enough data to
- // finish deserializing.
- void DeserializeWithoutValidation(void* buf);
-
-{% if struct|is_cloneable_kind %}
- {{struct.name}}Ptr Clone() const;
-{%- endif %}
- bool Equals(const {{struct.name}}& other) const;
-
-{#--- Struct members #}
-{% for field in struct.fields %}
-{%- set type = field.kind|cpp_wrapper_type %}
-{%- set name = field.name %}
- {{type}} {{name}};
-{%- endfor %}
-};
-
-{#--- Enum Operators #}
-{% from "enum_macros.tmpl" import global_enum_operators_decl -%}
-{%- for enum in struct.enums %}
- {{global_enum_operators_decl(enum, class_name=struct.name)}}
-{%- endfor %}

Powered by Google App Engine
This is Rietveld 408576698