X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/03f1c4e01b98531d28f040e47974750537b05c2f..bb0f5269e5987bcd09eaa0afc74d08dcd5dd29b7:/projects/stargazer/plugins/configuration/sgconfig/parser_tariff.cpp?ds=inline diff --git a/projects/stargazer/plugins/configuration/sgconfig/parser_tariff.cpp b/projects/stargazer/plugins/configuration/sgconfig/parser_tariff.cpp index 9bac0294..a4531703 100644 --- a/projects/stargazer/plugins/configuration/sgconfig/parser_tariff.cpp +++ b/projects/stargazer/plugins/configuration/sgconfig/parser_tariff.cpp @@ -29,7 +29,7 @@ return -1; //----------------------------------------------------------------------------- void PARSER_GET_TARIFFS::CreateAnswer() { -string s; +std::string s; char vs[100]; int hd, hn, md, mn; @@ -145,6 +145,8 @@ for (; it != dataList.end(); ++it) break; } + answerList->push_back("tariffConf.period) + "\"/>"); + answerList->push_back(""); } answerList->push_back(""); @@ -186,7 +188,7 @@ if (tariffs->Add(tariffToAdd, currAdmin) == 0) } else { - string s; + std::string s; strprintf(&s, "", tariffs->GetStrError().c_str()); answerList->push_back(s); } @@ -222,7 +224,7 @@ answerList->erase(answerList->begin(), answerList->end()); if (users->TariffInUse(tariffToDel)) { - string s; + std::string s; strprintf(&s, "", tariffToDel.c_str()); answerList->push_back(s); return; @@ -234,7 +236,7 @@ if (tariffs->Del(tariffToDel, currAdmin) == 0) } else { - string s; + std::string s; strprintf(&s, "", tariffs->GetStrError().c_str()); answerList->push_back(s); } @@ -244,7 +246,7 @@ else // CHG TARIFF //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int PARSER_CHG_TARIFF::ParseSlashedIntParams(int paramsNum, const string & s, int * params) +int PARSER_CHG_TARIFF::ParseSlashedIntParams(int paramsNum, const std::string & s, int * params) { char * str = new char[s.size() + 1]; char * p; @@ -272,7 +274,7 @@ delete[] str; return 0; } //----------------------------------------------------------------------------- -int PARSER_CHG_TARIFF::ParseSlashedDoubleParams(int paramsNum, const string & s, double * params) +int PARSER_CHG_TARIFF::ParseSlashedDoubleParams(int paramsNum, const std::string & s, double * params) { char * str = new char[s.size() + 1]; char * p; @@ -302,7 +304,6 @@ return 0; //----------------------------------------------------------------------------- int PARSER_CHG_TARIFF::ParseStart(void *, const char * el, const char ** attr) { -char st[50]; double price[DIR_NUM]; int t[DIR_NUM]; depth++; @@ -317,7 +318,7 @@ if (depth == 1) } else { - string s; + std::string s; if (strcasecmp(el, "PriceDayA") == 0) { @@ -385,6 +386,7 @@ else for (int j = 0; j < DIR_NUM; j++) { + char st[50]; snprintf(st, 50, "Time%d", j); if (strcasecmp(el, st) == 0) { @@ -451,6 +453,12 @@ else } return 0; } + + if (strcasecmp(el, "Period") == 0) + { + td.tariffConf.period = TARIFF::StringToPeriod(attr[1]); + return 0; + } } return -1; } @@ -485,7 +493,7 @@ if (!td.tariffConf.name.data().empty()) } else { - string s; + std::string s; strprintf(&s, "", tariffs->GetStrError().c_str()); answerList->push_back(s); return;