Skip to content

Commit

Permalink
fix compilation warnings
Browse files Browse the repository at this point in the history
reorder warning in entities
missing override in repository interfaces
  • Loading branch information
jacquetc committed Mar 14, 2024
1 parent ee334a8 commit 0b659f6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions tools/qleany/generator/entities_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ def determine_relationships(
relationships = []

# add other informations to fields

has_foreign_and_lazy_fields = False

for field in fields:
field["name_pascal"] = stringcase.pascalcase(field["name"])
field["is_primary_key"] = False
Expand All @@ -275,6 +278,7 @@ def determine_relationships(
if isListOrSetForeignEntity(field["type"]) or isUniqueForeignEntity(
field["type"]
):
has_foreign_and_lazy_fields = True
field["need_lazy_loader"] = True
field["is_linked_to_another_entity"] = True
else:
Expand Down Expand Up @@ -393,6 +397,7 @@ def determine_relationships(
export_header_file=export_header_file,
fields_init_values=fields_init_values,
parent_init_values=parent_init_values,
has_foreign_and_lazy_fields=has_foreign_and_lazy_fields,
relationships=relationships,
application_cpp_domain_name=application_cpp_domain_name,
)
Expand Down
2 changes: 1 addition & 1 deletion tools/qleany/generator/temp/manifest_temp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ entities:
name: Entity
parent: CommonParent
front_ends:
kf6_kirigami:
qml_imports_integration:
folder_path: src/ui/kirigami/
global:
application_cpp_domain_name: QleanyEditor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class {{ name }} : public {{ parent }}
this->{{ field.name }}Loaded = other.{{ field.name }}Loaded;
{% endif -%}
{%- endfor %}
{% if not has_foreign_and_lazy_fields -%}
Q_UNUSED(other);
{%- endif %}

}

Expand All @@ -44,6 +47,8 @@ class {{ name }} : public {{ parent }}
bool {{ field.name }}Loaded = false;
{% endif %}
{% endfor %}

// Getters for the fields' metadata. Normal fields are always set, but lazy-loaded fields may not be
bool getSet(const QString &fieldName) const
{
{% for field in fields -%}
Expand All @@ -56,9 +61,11 @@ class {{ name }} : public {{ parent }}
{% endif -%}
}
{%- endfor %}
// If the field is not found, we delegate to the parent class
return m_entity->{{ parent }}::metaData().getSet(fieldName);
}

// Getters for the fields' metadata. Normal fields are always set, but lazy-loaded fields may not be
bool getLoaded(const QString &fieldName) const
{
{% for field in fields %}
Expand All @@ -71,6 +78,7 @@ class {{ name }} : public {{ parent }}
{% endif -%}
}
{%- endfor %}
// If the field is not found, we delegate to the parent class
return m_entity->{{ parent }}::metaData().getLoaded(fieldName);
}
private:
Expand All @@ -87,7 +95,7 @@ class {{ name }} : public {{ parent }}
}

{{ name }}( {% for field in parent_fields %} const {{ field.type }} &{{ field.name }}, {% endfor %} {% for field in fields %}{% if field.type in ['int', 'double', 'float', 'bool'] %} {{ field.type }} {{ field.name }}{% else %} const {{ field.type }} &{{ field.name }}{% endif %}{% if not loop.last %}, {% endif %} {% endfor %})
: {{ parent }}({{ parent_fields | map(attribute='name') | join(", ")}}), m_metaData(this), {% for field in fields %}m_{{ field.name }}({{ field.name }}){% if not loop.last %}, {% endif %}{% endfor %}
: {{ parent }}({{ parent_fields | map(attribute='name') | join(", ")}}), m_metaData(this), {% for field in fields %}m_{{ field.name }}({{ field.name }}){% if not loop.last %}, {% endif %}{% endfor %}
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class {{ contracts_export }} Interface{{ name }}Repository
{
}
{% if foreign_entities %}
virtual Result<{{ application_cpp_domain_name }}::Entities::{{ name }}> update({{ application_cpp_domain_name }}::Entities::{{ name }} &&entity) = 0;
virtual Result<{{ application_cpp_domain_name }}::Entities::{{ name }}> update({{ application_cpp_domain_name }}::Entities::{{ name }} &&entity) override = 0;
virtual Result<{{ application_cpp_domain_name }}::Entities::{{ name }}> getWithDetails(int entityId) = 0;
{% endif %}
{% for loader_function in loader_function_list_for_interface %}
Expand Down

0 comments on commit 0b659f6

Please sign in to comment.