]> git.stg.codes - stg.git/commitdiff
Ticket. GetChangePolicy() function added.
authorElena Mamontova <helenh463@gmail.com>
Wed, 13 Jul 2016 11:00:17 +0000 (14:00 +0300)
committerElena Mamontova <helenh463@gmail.com>
Wed, 13 Jul 2016 11:00:17 +0000 (14:00 +0300)
stglibs/srvconf.lib/parsers/get_tariff.cpp

index 0804b269ac3d8980ae20b33b84c6d0375e3750d8..a24f287d7eb4767a3eb464b120917769c4710dd0 100644 (file)
@@ -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 <typename A, typename T>
 bool GetSlashedValue(const char ** attr, A & array, T A::value_type:: * field)
 {