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

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

Issue 1968623002: Mojo C++ bindings: expose public <struct>DataView and StringDataView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@25_totally_new
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {% from "enum_macros.tmpl" import enum_decl -%} 1 {% from "enum_macros.tmpl" import enum_decl -%}
2 2
3 class {{struct.name}} { 3 class {{struct.name}} {
4 public: 4 public:
5 using Data_ = internal::{{struct.name}}_Data; 5 using Data_ = internal::{{struct.name}}_Data;
6
7 // TODO(yzshen): Remove Reader.
6 using Reader = {{struct.name}}_Reader; 8 using Reader = {{struct.name}}_Reader;
7 9
8 {#--- Enums #} 10 {#--- Enums #}
9 {%- for enum in struct.enums -%} 11 {%- for enum in struct.enums -%}
10 {{enum_decl(enum)|indent(2)}} 12 {{enum_decl(enum)|indent(2)}}
11 {%- endfor %} 13 {%- endfor %}
12 14
13 {#--- Constants #} 15 {#--- Constants #}
14 {%- for constant in struct.constants %} 16 {%- for constant in struct.constants %}
15 {%- if constant.kind|is_integral_kind %} 17 {%- if constant.kind|is_integral_kind %}
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 {% for field in struct.fields %} 57 {% for field in struct.fields %}
56 {%- set type = field.kind|cpp_wrapper_type %} 58 {%- set type = field.kind|cpp_wrapper_type %}
57 {%- set name = field.name %} 59 {%- set name = field.name %}
58 {{type}} {{name}}; 60 {{type}} {{name}};
59 {%- endfor %} 61 {%- endfor %}
60 }; 62 };
61 63
62 {# TODO(yzshen): Redo the Reader interface. #} 64 {# TODO(yzshen): Redo the Reader interface. #}
63 {# NOTE: Generated Reader instances are intentionally cheap to copy and devoid 65 {# NOTE: Generated Reader instances are intentionally cheap to copy and devoid
64 of heap allocations. They should stay this way. #} 66 of heap allocations. They should stay this way. #}
67 // TODO(yzshen): Remove this.
65 class {{struct.name}}_Reader { 68 class {{struct.name}}_Reader {
66 public: 69 public:
67 {{struct.name}}_Reader(internal::{{struct.name}}_Data* data, 70 {{struct.name}}_Reader(internal::{{struct.name}}_Data* data,
68 mojo::internal::SerializationContext* context); 71 mojo::internal::SerializationContext* context);
69 72
70 {%- for pf in struct.packed.packed_fields_in_ordinal_order %} 73 {%- for pf in struct.packed.packed_fields_in_ordinal_order %}
71 {%- set kind = pf.field.kind -%} 74 {%- set kind = pf.field.kind -%}
72 {%- set name = pf.field.name -%} 75 {%- set name = pf.field.name -%}
73 {%- if kind|is_nullable_kind %} 76 {%- if kind|is_nullable_kind %}
74 bool has_{{name}}() const; 77 bool has_{{name}}() const;
(...skipping 20 matching lines...) Expand all
95 } 98 }
96 {%- else %} 99 {%- else %}
97 {{kind|cpp_result_type}} {{name}}() const { return data_->{{name}}; } 100 {{kind|cpp_result_type}} {{name}}() const { return data_->{{name}}; }
98 {%- endif %} 101 {%- endif %}
99 {%- endfor %} 102 {%- endfor %}
100 103
101 private: 104 private:
102 internal::{{struct.name}}_Data* data_; 105 internal::{{struct.name}}_Data* data_;
103 mojo::internal::SerializationContext* context_; 106 mojo::internal::SerializationContext* context_;
104 }; 107 };
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698