X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/49ac42e64c982c16ca4421a50d15f36574ca0c10..5014a9d76df7cbe75b175d635908049ccd702c81:/projects/sgconf/tariffs.cpp?ds=inline diff --git a/projects/sgconf/tariffs.cpp b/projects/sgconf/tariffs.cpp index 663536fb..3d63d2a8 100644 --- a/projects/sgconf/tariffs.cpp +++ b/projects/sgconf/tariffs.cpp @@ -40,17 +40,17 @@ switch (period) return "unknown"; } -std::string TraffTypeToString(int traffType) +std::string TraffTypeToString(TARIFF::TRAFF_TYPE traffType) { switch (traffType) { - case TRAFF_UP: + case TARIFF::TRAFF_UP: return "upload"; - case TRAFF_DOWN: + case TARIFF::TRAFF_DOWN: return "download"; - case TRAFF_UP_DOWN: + case TARIFF::TRAFF_UP_DOWN: return "upload + download"; - case TRAFF_MAX: + case TARIFF::TRAFF_MAX: return "max(upload, download)"; } return "unknown"; @@ -67,18 +67,18 @@ else throw SGCONF::ACTION::ERROR("Period should be 'daily' or 'monthly'. Got: '" + value + "'"); } -void ConvTraffType(const std::string & value, RESETABLE & res) +void ConvTraffType(const std::string & value, RESETABLE & res) { std::string lowered = ToLower(value); lowered.erase(std::remove(lowered.begin(), lowered.end(), ' '), lowered.end()); if (lowered == "upload") - res = TRAFF_UP; + res = TARIFF::TRAFF_UP; else if (lowered == "download") - res = TRAFF_DOWN; + res = TARIFF::TRAFF_DOWN; else if (lowered == "upload+download") - res = TRAFF_UP_DOWN; + res = TARIFF::TRAFF_UP_DOWN; else if (lowered.substr(0, 3) == "max") - res = TRAFF_MAX; + res = TARIFF::TRAFF_MAX; else throw SGCONF::ACTION::ERROR("Traff type should be 'upload', 'download', 'upload + download' or 'max'. Got: '" + value + "'"); }