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

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

Issue 2112093002: Mojo C++ bindings: Merge EncodePointers/DecodePointers into Serialize/Deserialize, respectively. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@61_array_fix
Patch Set: . Created 4 years, 5 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
OLDNEW
1 {%- set class_name = struct.name ~ "_Data" -%} 1 {%- set class_name = struct.name ~ "_Data" -%}
2 2
3 class {{class_name}} { 3 class {{class_name}} {
4 public: 4 public:
5 static {{class_name}}* New(mojo::internal::Buffer* buf); 5 static {{class_name}}* New(mojo::internal::Buffer* buf);
6 6
7 static bool Validate(const void* data, 7 static bool Validate(const void* data,
8 mojo::internal::ValidationContext* validation_context); 8 mojo::internal::ValidationContext* validation_context);
9 9
10 void EncodePointers();
11 void DecodePointers();
12
13 {% from "enum_macros.tmpl" import enum_data_decl -%} 10 {% from "enum_macros.tmpl" import enum_data_decl -%}
14 {#--- Enums #} 11 {#--- Enums #}
15 {%- for enum in struct.enums -%} 12 {%- for enum in struct.enums -%}
16 {%- if enum|is_native_only_kind %} 13 {%- if enum|is_native_only_kind %}
17 using {{enum.name}}_Data = mojo::internal::NativeEnum_Data; 14 using {{enum.name}}_Data = mojo::internal::NativeEnum_Data;
18 {%- else %} 15 {%- else %}
19 {{enum_data_decl(enum)|indent(2)}} 16 {{enum_data_decl(enum)|indent(2)}}
20 {%- endif %} 17 {%- endif %}
21 {%- endfor %} 18 {%- endfor %}
22 19
(...skipping 24 matching lines...) Expand all
47 uint8_t padfinal_[{{pad}}]; 44 uint8_t padfinal_[{{pad}}];
48 {%- endif %} 45 {%- endif %}
49 {%- endif %} 46 {%- endif %}
50 47
51 private: 48 private:
52 {{class_name}}(); 49 {{class_name}}();
53 ~{{class_name}}() = delete; 50 ~{{class_name}}() = delete;
54 }; 51 };
55 static_assert(sizeof({{class_name}}) == {{struct.versions[-1].num_bytes}}, 52 static_assert(sizeof({{class_name}}) == {{struct.versions[-1].num_bytes}},
56 "Bad sizeof({{class_name}})"); 53 "Bad sizeof({{class_name}})");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698