ParseJson():

Minor: some reformatting of source code.
This commit is contained in:
Gerhard Hoffmann 2024-09-02 16:55:48 +02:00
parent 58d8f16681
commit c6b8a37263

View File

@ -384,7 +384,7 @@ bool Configuration::ParseJson(Configuration* cfg, const char* json)
ATBPaymentRate PaymentRate;
ATBSpecialDaysWorktime SpecialDaysWorktime;
ATBSpecialDays SpecialDays;
ATBWeekDays WeekDays;
//ATBWeekDay WeekDay;
ATBWeekDaysWorktime WeekDaysWorktime;
ATBPeriodYear YearPeriod;
ATBDailyTicket DailyTicket;
@ -400,29 +400,29 @@ bool Configuration::ParseJson(Configuration* cfg, const char* json)
MemberType mb_type = MemberType::UnknownType;
this->currentPaymentOptions.clear();
// Get all JSON object members
// This code should run only once (to load JSON variables into memory)
for (auto i = document.MemberBegin(); i != document.MemberEnd(); i++)
{
// Get name of all general members of JSON, don't print name if NULL
const char* mb_name = i->name.GetString();
if (mb_name == NULL) continue;
// Get all JSON object members
// This code should run only once (to load JSON variables into memory)
for (auto i = document.MemberBegin(); i != document.MemberEnd(); i++)
{
// Get name of all general members of JSON, don't print name if NULL
const char* mb_name = i->name.GetString();
if (mb_name == NULL) continue;
if (document[mb_name].IsString()) {
QString const _mb_name(mb_name);
if (_mb_name.startsWith("Project", Qt::CaseInsensitive)) {
cfg->project.project = document[mb_name].GetString();
continue;
}
if (_mb_name.startsWith("Version", Qt::CaseInsensitive)) {
cfg->project.version = document[mb_name].GetString();
continue;
if (document[mb_name].IsString()) {
QString const _mb_name(mb_name);
if (_mb_name.startsWith("Project", Qt::CaseInsensitive)) {
cfg->project.project = document[mb_name].GetString();
continue;
}
if (_mb_name.startsWith("Version", Qt::CaseInsensitive)) {
cfg->project.version = document[mb_name].GetString();
continue;
}
if (_mb_name.startsWith("Info", Qt::CaseInsensitive)) {
cfg->project.info = document[mb_name].GetString();
continue;
}
}
if (_mb_name.startsWith("Info", Qt::CaseInsensitive)) {
cfg->project.info = document[mb_name].GetString();
continue;
}
}
// ... everything else should be an array
if (!document[mb_name].IsArray()) {