Skip to content

weather/dwd: Code Style improvements

Ismael Asensio requested to merge work/iasensio/dwd-codestyle into master

This is a set of code refactor changes with the purpose of improving the code style, simplify some logic and reduce the line count in the DWD weather provider. In some cases (pass arguments by const ref) there is also an effeciency gain.

It is a part of a series with a couple more MRs with the final goal of bringing the code together with the other providers, so it's easier to extract common patterns and eventually port them out of the dataengine interface. This has been lingering in my local hard drive for a while, but the changes were a bit massive for a single review, so let's hope this first split is kind enough with the potential reviewer/s.

Test plan

This is a pure refactor MR. The dwd provider for the weather applet still works as expected

Original commit message(s)

  • weather/dwd: Simplify dataengine source parsing
  • weather/dwd: Improve struct handling
    • Initialize struct fields directly on header
    • Do not store pointers to structs, which gets messy with ease, but let QList handle the memory instead.
  • weather/dwd: Pass arguments by const ref and mark helper methods const
  • weather/dwd: Use ranged for instead of iterators
  • weather/dwd: Code Style improvements
    • Port to string literals suffixes
    • Use constexpr for API URLs instead of #define
    • Always use braces for if statements
    • Remove unnecessary lines and symbols

Merge request reports

Loading