OLD | NEW |
1 {# TODO(yzshen): Make these templates more readable. #} | 1 {# TODO(yzshen): Make these templates more readable. #} |
2 | 2 |
3 {# Computes the serialized size for the specified struct. | 3 {# Computes the serialized size for the specified struct. |
4 |struct| is the struct definition. | 4 |struct| is the struct definition. |
5 |input_field_pattern| should be a pattern that contains one string | 5 |input_field_pattern| should be a pattern that contains one string |
6 placeholder, for example, "input->%s", "p_%s". The placeholder will be | 6 placeholder, for example, "input->%s", "p_%s". The placeholder will be |
7 substituted with struct field names to refer to the input fields. | 7 substituted with struct field names to refer to the input fields. |
8 This macro is expanded to compute seriailized size for both: | 8 This macro is expanded to compute seriailized size for both: |
9 - user-defined structs: the input is an instance of the corresponding struct | 9 - user-defined structs: the input is an instance of the corresponding struct |
10 wrapper class. | 10 wrapper class. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 {%- elif kind|is_associated_kind %} | 141 {%- elif kind|is_associated_kind %} |
142 // TODO(yzshen): add deserialization logic for associated kinds. | 142 // TODO(yzshen): add deserialization logic for associated kinds. |
143 {%- elif kind|is_enum_kind %} | 143 {%- elif kind|is_enum_kind %} |
144 {{output_field}} = static_cast<{{kind|cpp_wrapper_type}}>({{input}}->{{name}
}); | 144 {{output_field}} = static_cast<{{kind|cpp_wrapper_type}}>({{input}}->{{name}
}); |
145 {%- else %} | 145 {%- else %} |
146 {{output_field}} = {{input}}->{{name}}; | 146 {{output_field}} = {{input}}->{{name}}; |
147 {%- endif %} | 147 {%- endif %} |
148 {%- endfor %} | 148 {%- endfor %} |
149 } while (false); | 149 } while (false); |
150 {%- endmacro %} | 150 {%- endmacro %} |
OLD | NEW |