From 40d6bc4eb474e1e34c769ac247e63a127181e7f5 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Thu, 29 May 2014 17:36:02 +0300 Subject: [PATCH] Show info about period. --- stglibs/srvconf.lib/parsers/get_tariff.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/stglibs/srvconf.lib/parsers/get_tariff.cpp b/stglibs/srvconf.lib/parsers/get_tariff.cpp index 9ab61638..1bb9d0db 100644 --- a/stglibs/srvconf.lib/parsers/get_tariff.cpp +++ b/stglibs/srvconf.lib/parsers/get_tariff.cpp @@ -90,6 +90,21 @@ else return true; } +template +bool GetPeriod(const char ** attr, T & value, const std::string & attrName) +{ +if (!CheckValue(attr, attrName)) + return false; +std::string type(attr[1]); +if (type == "day") + value = TARIFF::DAY; +else if (type == "month") + value = TARIFF::MONTH; +else + return false; +return true; +} + template bool GetSlashedValue(const char ** attr, A & array, T A::value_type:: * field) { @@ -122,6 +137,7 @@ GET_TARIFF::PARSER::PARSER(CALLBACK f, void * d) AddParser(propertyParsers, "passiveCost", info.tariffConf.passiveCost); AddParser(propertyParsers, "free", info.tariffConf.free); AddParser(propertyParsers, "traffType", info.tariffConf.traffType, GetTraffType); + AddParser(propertyParsers, "period", info.tariffConf.period, GetPeriod); for (size_t i = 0; i < DIR_NUM; ++i) AddParser(propertyParsers, "time" + unsigned2str(i), info.dirPrice[i], GetTimeSpan); AddAOSParser(propertyParsers, "priceDayA", info.dirPrice, &DIRPRICE_DATA::priceDayA, GetSlashedValue); -- 2.43.2