From: Elena Mamontova Date: Wed, 13 Jul 2016 11:00:17 +0000 (+0300) Subject: Ticket. GetChangePolicy() function added. X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/3829fda4078489c674b3761f296f17cc13cd82d0?hp=0df921108f5a3240db63336eddd3ab46bf80f424 Ticket. GetChangePolicy() function added. --- diff --git a/stglibs/srvconf.lib/parsers/get_tariff.cpp b/stglibs/srvconf.lib/parsers/get_tariff.cpp index 0804b269..a24f287d 100644 --- a/stglibs/srvconf.lib/parsers/get_tariff.cpp +++ b/stglibs/srvconf.lib/parsers/get_tariff.cpp @@ -97,6 +97,31 @@ else return true; } +bool GetChangePolicy(const char ** attr, T & value, const std::string & attrName) +{ +if (!CheckValue(attr, attrName)) + return false; +std::string type(attr[1]); +switch (type) + { + case "allow": + value = TARIFF::ALLOW; + break; + case "to_cheap": + value = TARIFF::TO_CHEAP; + break; + case "to_expensive": + value = TARIFF::TO_EXPENSIVE; + break; + case "deny": + value = TARIFF::DENY; + break; + default: + return false; + } +return true; +} + template bool GetSlashedValue(const char ** attr, A & array, T A::value_type:: * field) {