style: aplicar checks modernize-* (215 fixes)

Cambios aplicados:
- [[nodiscard]] añadido a funciones que retornan valores
- .starts_with() en lugar de .find() == 0
- Inicializadores designados {.x=0, .y=0}
- auto en castings obvios
- = default para constructores triviales
- Funciones deleted movidas a public
- std::numbers::pi_v<float> (C++20)

Checks excluidos:
- use-trailing-return-type: Estilo controversial
- avoid-c-arrays: Arrays C aceptables en ciertos contextos
This commit is contained in:
2025-12-18 20:16:46 +01:00
parent fdfb84170f
commit 7f6af6dd00
42 changed files with 178 additions and 178 deletions

View File

@@ -11,7 +11,7 @@
namespace Graphics {
Shape::Shape(const std::string& filepath)
: centre_({0.0F, 0.0F}),
: centre_({.x = 0.0F, .y = 0.0F}),
escala_defecte_(1.0F),
nom_("unnamed") {
carregar(filepath);
@@ -106,7 +106,7 @@ bool Shape::starts_with(const std::string& str,
if (str.length() < prefix.length()) {
return false;
}
return str.compare(0, prefix.length(), prefix) == 0;
return str.starts_with(prefix);
}
// Helper: extract value after ':'
@@ -128,7 +128,7 @@ void Shape::parse_center(const std::string& value) {
centre_.y = std::stof(trim(val.substr(comma + 1)));
} catch (...) {
std::cerr << "[Shape] Warning: centre invàlid, usant (0,0)" << std::endl;
centre_ = {0.0F, 0.0F};
centre_ = {.x = 0.0F, .y = 0.0F};
}
}
}