From 3829fda4078489c674b3761f296f17cc13cd82d0 Mon Sep 17 00:00:00 2001 From: Elena Mamontova Date: Wed, 13 Jul 2016 14:00:17 +0300 Subject: [PATCH] Ticket. GetChangePolicy() function added. --- stglibs/srvconf.lib/parsers/get_tariff.cpp | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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) { -- 2.44.2