X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/e9ae1f101b5418c0ba2e6c9d86b23c12f0140982..8bfc0bdce2bf4f53ac2c072e7a44e9a7d3b3cca8:/libs/srvconf/parsers/chg_tariff.cpp
diff --git a/libs/srvconf/parsers/chg_tariff.cpp b/libs/srvconf/parsers/chg_tariff.cpp
index 63c2b1fd..fc81dd52 100644
--- a/libs/srvconf/parsers/chg_tariff.cpp
+++ b/libs/srvconf/parsers/chg_tariff.cpp
@@ -40,11 +40,11 @@ void appendSlashedResetable(std::ostream& stream, const std::string& name, const
std::string res;
for (typename A::size_type i = 0; i < array.size(); ++i)
{
- if ((array[i].*field).empty()) // All values must be set
+ if (!(array[i].*field)) // All values must be set
return;
if (!res.empty())
res += "/";
- res += std::to_string((array[i].*field).data());
+ res += std::to_string((array[i].*field).value());
}
stream << "<" << name << " value=\"" << res << "\"/>";
}
@@ -59,18 +59,18 @@ std::string ChgTariff::serialize(const TariffDataOpt& data, const std::string& /
appendResetableTag(stream, "passiveCost", data.tariffConf.passiveCost);
appendResetableTag(stream, "free", data.tariffConf.free);
- if (!data.tariffConf.traffType.empty())
- stream << "";
+ if (data.tariffConf.traffType)
+ stream << "";
- if (!data.tariffConf.period.empty())
- switch (data.tariffConf.period.data())
+ if (data.tariffConf.period)
+ switch (data.tariffConf.period.value())
{
case Tariff::DAY: stream << ""; break;
case Tariff::MONTH: stream << ""; break;
}
- if (!data.tariffConf.changePolicy.empty())
- switch (data.tariffConf.changePolicy.data())
+ if (data.tariffConf.changePolicy)
+ switch (data.tariffConf.changePolicy.value())
{
case Tariff::ALLOW: stream << ""; break;
case Tariff::TO_CHEAP: stream << ""; break;
@@ -80,14 +80,14 @@ std::string ChgTariff::serialize(const TariffDataOpt& data, const std::string& /
appendResetableTag(stream, "changePolicyTimeout", data.tariffConf.changePolicyTimeout);
for (size_t i = 0; i < DIR_NUM; ++i)
- if (!data.dirPrice[i].hDay.empty() &&
- !data.dirPrice[i].mDay.empty() &&
- !data.dirPrice[i].hNight.empty() &&
- !data.dirPrice[i].mNight.empty())
- stream << "";
+ if (data.dirPrice[i].hDay ||
+ data.dirPrice[i].mDay ||
+ data.dirPrice[i].hNight ||
+ data.dirPrice[i].mNight)
+ stream << "";
appendSlashedResetable(stream, "priceDayA", data.dirPrice, &DirPriceDataOpt::priceDayA);
appendSlashedResetable(stream, "priceDayB", data.dirPrice, &DirPriceDataOpt::priceDayB);