Add handling for TimeStepConfig.
This commit is contained in:
parent
0b901954aa
commit
7f8ed9165d
@ -1,6 +1,7 @@
|
||||
#include "configuration.h"
|
||||
#include "tariff_timebase.h"
|
||||
#include "time_range_header.h"
|
||||
#include "tariff_timestep_config.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QDebug>
|
||||
@ -22,6 +23,7 @@ MemberType Configuration::IdentifyJsonMember(const char* member_name)
|
||||
if (strcmp(member_name, "TimeBase") == 0) return MemberType::TimeBaseType;
|
||||
if (strcmp(member_name, "Customer") == 0) return MemberType::CustomerType;
|
||||
if (strcmp(member_name, "TimeRange") == 0) return MemberType::TimeRangeType;
|
||||
if (strcmp(member_name, "TimeStepConfig") == 0) return MemberType::TimeStepConfigType;
|
||||
else return MemberType::UnknownType;
|
||||
}
|
||||
|
||||
@ -91,6 +93,7 @@ bool Configuration::ParseJson(Configuration* cfg, const char* json)
|
||||
ATBTimeBase TimeBase;
|
||||
ATBCustomer Customer;
|
||||
ATBTimeRange TimeRange;
|
||||
ATBTimeStepConfig TimeStepConfig;
|
||||
|
||||
MemberType mb_type = MemberType::UnknownType;
|
||||
|
||||
@ -188,6 +191,18 @@ bool Configuration::ParseJson(Configuration* cfg, const char* json)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MemberType::TimeStepConfigType:
|
||||
if (QString(inner_obj_name) == QString("tsconfig_id")) {
|
||||
if (k->value.IsInt()) {
|
||||
TimeStepConfig.tsconfig_id = k->value.GetInt();
|
||||
}
|
||||
} else
|
||||
if (QString(inner_obj_name) == QString("tsconfig_label")) {
|
||||
if (k->value.IsString()) {
|
||||
TimeStepConfig.tsconfig_label = QString::fromStdString(k->value.GetString());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MemberType::DailyTicketType:
|
||||
if (QString(inner_obj_name) == QString("daily_ticket_payment_option_id")) {
|
||||
if (k->value.IsInt()) {
|
||||
@ -396,6 +411,11 @@ bool Configuration::ParseJson(Configuration* cfg, const char* json)
|
||||
break;
|
||||
case MemberType::TimeRangeType:
|
||||
qCritical() << TimeRange;
|
||||
cfg->TimeRange.insert(pair<int, ATBTimeRange>(TimeRange.time_range_id, TimeRange));
|
||||
break;
|
||||
case MemberType::TimeStepConfigType:
|
||||
qCritical() << TimeStepConfig;
|
||||
cfg->TimeStepConfig.insert(pair<int, ATBTimeStepConfig>(TimeStepConfig.tsconfig_id, TimeStepConfig));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user