Skip to content

Commit

Permalink
Missed indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
klingbolt committed Jan 15, 2025
1 parent cd77eae commit 76ad800
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,31 @@ void xml_attribute_to_{{attribute_name}}(
{% endif %}
{% if exclude_from_protobuf == false %}

void proto_to_{{attribute_name}}(
{{proto_field_cpp_type}} input,
ProtoReaderState*,
{{class_name}}* value,
bool* is_set) {
{{class_name}} {{attribute_name}};
{% for attribute_component in attribute_components %}
{% if attribute_component.protobuf_field != None %}
{{attribute_name}}.{{attribute_component.attribute_name}} = input.{{attribute_component.protobuf_field}}();
{% endif %}
{% endfor %}
*value = {{attribute_name}};
*is_set = true;
}
void proto_to_{{attribute_name}}(
{{proto_field_cpp_type}} input,
ProtoReaderState*,
{{class_name}}* value,
bool* is_set) {
{{class_name}} {{attribute_name}};
{% for attribute_component in attribute_components %}
{% if attribute_component.protobuf_field != None %}
{{attribute_name}}.{{attribute_component.attribute_name}} = input.{{attribute_component.protobuf_field}}();
{% endif %}
{% endfor %}
*value = {{attribute_name}};
*is_set = true;
}

void {{attribute_name}}_to_proto(
{{class_name}} value,
ProtoWriterState*,
std::function<void({{proto_field_cpp_type}}*)> setter) {
{{proto_field_cpp_type}}* proto_{{attribute_name}} = new {{proto_field_cpp_type}}();
{% for attribute_component in attribute_components %}
{% if attribute_component.protobuf_field != None %}
proto_{{attribute_name}}->set_{{attribute_component.protobuf_field}}(value.{{attribute_component.attribute_name}});
{% endif %}
{% endfor %}
setter(proto_{{attribute_name}});
}
void {{attribute_name}}_to_proto(
{{class_name}} value,
ProtoWriterState*,
std::function<void({{proto_field_cpp_type}}*)> setter) {
{{proto_field_cpp_type}}* proto_{{attribute_name}} = new {{proto_field_cpp_type}}();
{% for attribute_component in attribute_components %}
{% if attribute_component.protobuf_field != None %}
proto_{{attribute_name}}->set_{{attribute_component.protobuf_field}}(value.{{attribute_component.attribute_name}});
{% endif %}
{% endfor %}
setter(proto_{{attribute_name}});
}
{% endif %}
56 changes: 28 additions & 28 deletions xml_converter/generators/cpp_templates/attribute_template_enum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,38 +62,38 @@ string {{attribute_name}}_to_xml_attribute(
}
{% if exclude_from_protobuf == false %}

void proto_to_{{attribute_name}}(
{{proto_field_cpp_type}} input,
ProtoReaderState*,
{{class_name}}* value,
bool* is_set) {
switch (input) {
{% for attribute_component in attribute_components %}
case {{proto_field_cpp_type}}::{{attribute_component.attribute_name}}:
*value = {{class_name}}::{{attribute_component.attribute_name}};
void proto_to_{{attribute_name}}(
{{proto_field_cpp_type}} input,
ProtoReaderState*,
{{class_name}}* value,
bool* is_set) {
switch (input) {
{% for attribute_component in attribute_components %}
case {{proto_field_cpp_type}}::{{attribute_component.attribute_name}}:
*value = {{class_name}}::{{attribute_component.attribute_name}};
*is_set = true;
break;
{% endfor %}
default:
*value = {{class_name}}::{{attribute_components[0].attribute_name}};
*is_set = true;
break;
{% endfor %}
default:
*value = {{class_name}}::{{attribute_components[0].attribute_name}};
*is_set = true;
break;
}
}
}

void {{attribute_name}}_to_proto(
{{class_name}} value,
ProtoWriterState*,
std::function<void({{proto_field_cpp_type}})> setter) {
switch (value) {
{% for attribute_component in attribute_components %}
case {{class_name}}::{{attribute_component.attribute_name}}:
setter({{proto_field_cpp_type}}::{{attribute_component.attribute_name}});
void {{attribute_name}}_to_proto(
{{class_name}} value,
ProtoWriterState*,
std::function<void({{proto_field_cpp_type}})> setter) {
switch (value) {
{% for attribute_component in attribute_components %}
case {{class_name}}::{{attribute_component.attribute_name}}:
setter({{proto_field_cpp_type}}::{{attribute_component.attribute_name}});
break;
{% endfor %}
default:
setter({{proto_field_cpp_type}}::{{attribute_components[0].attribute_name}});
break;
{% endfor %}
default:
setter({{proto_field_cpp_type}}::{{attribute_components[0].attribute_name}});
break;
}
}
}
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,31 @@ string {{attribute_name}}_to_xml_attribute(
}
{% if exclude_from_protobuf == false %}

void proto_to_{{attribute_name}}(
{{proto_field_cpp_type}} input,
ProtoReaderState*,
{{class_name}}* value,
bool* is_set) {
{{class_name}} {{attribute_name}};
{% for n, attribute_component in enumerate(attribute_components) %}
{{attribute_name}}.{{attribute_component.attribute_name}} = input.{{attribute_component.attribute_name}}();
{% endfor %}
*value = {{attribute_name}};
*is_set = true;
}
void proto_to_{{attribute_name}}(
{{proto_field_cpp_type}} input,
ProtoReaderState*,
{{class_name}}* value,
bool* is_set) {
{{class_name}} {{attribute_name}};
{% for n, attribute_component in enumerate(attribute_components) %}
{{attribute_name}}.{{attribute_component.attribute_name}} = input.{{attribute_component.attribute_name}}();
{% endfor %}
*value = {{attribute_name}};
*is_set = true;
}

void {{attribute_name}}_to_proto(
{{class_name}} value,
ProtoWriterState*,
std::function<void({{proto_field_cpp_type}}*)> setter) {
{{proto_field_cpp_type}}* proto_{{attribute_name}} = new {{proto_field_cpp_type}}();
bool should_write = false;
{% for n, attribute_component in enumerate(attribute_components) %}
proto_{{attribute_name}}->set_{{attribute_component.attribute_name}}(value.{{attribute_component.attribute_name}});
should_write |= value.{{attribute_component.attribute_name}};
{% endfor %}
if (should_write) {
setter(proto_{{attribute_name}});
void {{attribute_name}}_to_proto(
{{class_name}} value,
ProtoWriterState*,
std::function<void({{proto_field_cpp_type}}*)> setter) {
{{proto_field_cpp_type}}* proto_{{attribute_name}} = new {{proto_field_cpp_type}}();
bool should_write = false;
{% for n, attribute_component in enumerate(attribute_components) %}
proto_{{attribute_name}}->set_{{attribute_component.attribute_name}}(value.{{attribute_component.attribute_name}});
should_write |= value.{{attribute_component.attribute_name}};
{% endfor %}
if (should_write) {
setter(proto_{{attribute_name}});
}
}
}
{% endif %}

0 comments on commit 76ad800

Please sign in to comment.