From c9bc9423b91e897284057ea053b83c9cf86383ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Omn=C3=A8s?= Date: Fri, 15 Sep 2023 15:29:24 +0200 Subject: [PATCH] Clean up parameters.cpp (#1623) --- src/libs/antares/study/parameters.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/libs/antares/study/parameters.cpp b/src/libs/antares/study/parameters.cpp index ae739f3e25..60a3028d1c 100644 --- a/src/libs/antares/study/parameters.cpp +++ b/src/libs/antares/study/parameters.cpp @@ -33,8 +33,8 @@ #include // std::list #include // std::stringstream -#include "../constants.h" #include "parameters.h" +#include #include #include #include "load-options.h" @@ -951,8 +951,6 @@ bool Parameters::loadFromINI(const IniFile& ini, uint version, const StudyLoadOp // Reset inner data reset(); // A temporary buffer, used for the values in lowercase - String value; - String sectionName; using Callback = bool (*)( Parameters&, // [out] Parameter object to load the data into const String&, // [in] Key, comes left to the '=' sign in the .ini file @@ -975,7 +973,7 @@ bool Parameters::loadFromINI(const IniFile& ini, uint version, const StudyLoadOp // Foreach section on the ini file... for (auto* section = ini.firstSection; section; section = section->next) { - sectionName = section->name; + String sectionName = section->name; sectionName.toLower(); try { @@ -996,7 +994,7 @@ bool Parameters::loadFromINI(const IniFile& ini, uint version, const StudyLoadOp if (!firstKeyLetterIsValid(p->key)) continue; // We convert the key and the value into the lower case format - value = p->value; + String value = p->value; value.toLower(); // Deal with the current property @@ -1506,8 +1504,8 @@ void Parameters::saveToINI(IniFile& ini) const } // Calendar - section->add("horizon ", horizon); - section->add("nbYears ", nbYears); + section->add("horizon", horizon); + section->add("nbYears", nbYears); section->add("simulation.start", simulationDays.first + 1); // starts from 1 section->add("simulation.end", simulationDays.end); // starts from 1 section->add("january.1st", Date::DayOfTheWeekToString(dayOfThe1stJanuary)); @@ -1527,11 +1525,11 @@ void Parameters::saveToINI(IniFile& ini) const // Time series ParametersSaveTimeSeries(section, "generate", timeSeriesToGenerate); - section->add("nbTimeSeriesLoad ", nbTimeSeriesLoad); - section->add("nbTimeSeriesHydro ", nbTimeSeriesHydro); - section->add("nbTimeSeriesWind ", nbTimeSeriesWind); - section->add("nbTimeSeriesThermal ", nbTimeSeriesThermal); - section->add("nbTimeSeriesSolar ", nbTimeSeriesSolar); + section->add("nbTimeSeriesLoad", nbTimeSeriesLoad); + section->add("nbTimeSeriesHydro", nbTimeSeriesHydro); + section->add("nbTimeSeriesWind", nbTimeSeriesWind); + section->add("nbTimeSeriesThermal", nbTimeSeriesThermal); + section->add("nbTimeSeriesSolar", nbTimeSeriesSolar); // Refresh ParametersSaveTimeSeries(section, "refreshTimeSeries", timeSeriesToRefresh);