]> git.stg.codes - stg.git/blobdiff - stargazer/plugins/configuration/sgconfig/parser_tariffs.cpp
Remove std::list from tariffs.
[stg.git] / stargazer / plugins / configuration / sgconfig / parser_tariffs.cpp
index 9c75267480e9591544e920ddb2b28788ff3f08ac..ae22cf044d656fbe6c276371752323be10a9836f 100644 (file)
@@ -51,7 +51,7 @@ std::string AOS2String(const A & array, size_t size, const F C::* field, F multi
     {
         if (!res.empty())
             res += "/";
     {
         if (!res.empty())
             res += "/";
-        res += x2str((array[i].*field) * multiplier);
+        res += std::to_string((array[i].*field) * multiplier);
     }
     return res;
 }
     }
     return res;
 }
@@ -90,17 +90,17 @@ void GET_TARIFFS::CreateAnswer()
 {
     m_answer = "<Tariffs>";
 
 {
     m_answer = "<Tariffs>";
 
-    std::list<TARIFF_DATA> dataList;
+    std::vector<TARIFF_DATA> dataList;
     m_tariffs.GetTariffsData(&dataList);
     m_tariffs.GetTariffsData(&dataList);
-    std::list<TARIFF_DATA>::const_iterator it = dataList.begin();
+    auto it = dataList.begin();
     for (; it != dataList.end(); ++it)
         {
         m_answer += "<tariff name=\"" + it->tariffConf.name + "\">";
 
         for (size_t i = 0; i < DIR_NUM; i++)
     for (; it != dataList.end(); ++it)
         {
         m_answer += "<tariff name=\"" + it->tariffConf.name + "\">";
 
         for (size_t i = 0; i < DIR_NUM; i++)
-            m_answer += "<Time" + x2str(i) + " value=\"" +
-                x2str(it->dirPrice[i].hDay)   + ":" + x2str(it->dirPrice[i].mDay)   + "-" +
-                x2str(it->dirPrice[i].hNight) + ":" + x2str(it->dirPrice[i].mNight) + "\"/>";
+            m_answer += "<Time" + std::to_string(i) + " value=\"" +
+                std::to_string(it->dirPrice[i].hDay)   + ":" + std::to_string(it->dirPrice[i].mDay)   + "-" +
+                std::to_string(it->dirPrice[i].hNight) + ":" + std::to_string(it->dirPrice[i].mNight) + "\"/>";
 
         m_answer += "<PriceDayA value=\"" + AOS2String(it->dirPrice, DIR_NUM, &DIRPRICE_DATA::priceDayA, pt_mega) + "\"/>" +
                   "<PriceDayB value=\"" + AOS2String(it->dirPrice, DIR_NUM, &DIRPRICE_DATA::priceDayB, pt_mega) + "\"/>" +
 
         m_answer += "<PriceDayA value=\"" + AOS2String(it->dirPrice, DIR_NUM, &DIRPRICE_DATA::priceDayA, pt_mega) + "\"/>" +
                   "<PriceDayB value=\"" + AOS2String(it->dirPrice, DIR_NUM, &DIRPRICE_DATA::priceDayB, pt_mega) + "\"/>" +
@@ -109,13 +109,13 @@ void GET_TARIFFS::CreateAnswer()
                   "<Threshold value=\"" + AOS2String(it->dirPrice, DIR_NUM, &DIRPRICE_DATA::threshold, 1) + "\"/>" +
                   "<SinglePrice value=\"" + AOS2String(it->dirPrice, DIR_NUM, &DIRPRICE_DATA::singlePrice, 1) + "\"/>" +
                   "<NoDiscount value=\"" + AOS2String(it->dirPrice, DIR_NUM, &DIRPRICE_DATA::noDiscount, 1) + "\"/>" +
                   "<Threshold value=\"" + AOS2String(it->dirPrice, DIR_NUM, &DIRPRICE_DATA::threshold, 1) + "\"/>" +
                   "<SinglePrice value=\"" + AOS2String(it->dirPrice, DIR_NUM, &DIRPRICE_DATA::singlePrice, 1) + "\"/>" +
                   "<NoDiscount value=\"" + AOS2String(it->dirPrice, DIR_NUM, &DIRPRICE_DATA::noDiscount, 1) + "\"/>" +
-                  "<Fee value=\"" + x2str(it->tariffConf.fee) + "\"/>" +
-                  "<PassiveCost value=\"" + x2str(it->tariffConf.passiveCost) + "\"/>" +
-                  "<Free value=\"" + x2str(it->tariffConf.free) + "\"/>" +
+                  "<Fee value=\"" + std::to_string(it->tariffConf.fee) + "\"/>" +
+                  "<PassiveCost value=\"" + std::to_string(it->tariffConf.passiveCost) + "\"/>" +
+                  "<Free value=\"" + std::to_string(it->tariffConf.free) + "\"/>" +
                   "<TraffType value=\"" + TARIFF::TraffTypeToString(it->tariffConf.traffType) + "\"/>" +
                   "<Period value=\"" + TARIFF::PeriodToString(it->tariffConf.period) + "\"/>" +
                   "<ChangePolicy value=\"" + TARIFF::ChangePolicyToString(it->tariffConf.changePolicy) + "\"/>" +
                   "<TraffType value=\"" + TARIFF::TraffTypeToString(it->tariffConf.traffType) + "\"/>" +
                   "<Period value=\"" + TARIFF::PeriodToString(it->tariffConf.period) + "\"/>" +
                   "<ChangePolicy value=\"" + TARIFF::ChangePolicyToString(it->tariffConf.changePolicy) + "\"/>" +
-                  "<ChangePolicyTimeout value=\"" + x2str(it->tariffConf.changePolicyTimeout) + "\"/>" +
+                  "<ChangePolicyTimeout value=\"" + std::to_string(it->tariffConf.changePolicyTimeout) + "\"/>" +
                   "</tariff>";
         }
 
                   "</tariff>";
         }