X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/d084d9ae9f7bcd7f7d1926e7eeae921dbad49273..80270bc96f3fd1d1f14b3ef539b73ad2eb0017de:/projects/traffcounter/utils.cpp diff --git a/projects/traffcounter/utils.cpp b/projects/traffcounter/utils.cpp deleted file mode 100644 index ac8634c8..00000000 --- a/projects/traffcounter/utils.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include -#include - -#include -#include -#include - -#include - -#include "utils.h" - -using namespace std; - -string STG::ToLower(const string & val, const locale & loc) -{ - std::string res; - transform(val.begin(), - val.end(), - back_inserter(res), - STG::ToLowerHelper(loc)); - return res; -} - -string STG::ToUpper(const string & val, const locale & loc) -{ - std::string res; - transform(val.begin(), - val.end(), - back_inserter(res), - STG::ToUpperHelper(loc)); - return res; -} - -string STG::Trim(const string & val, const locale & loc) -{ - if (val.empty()) - return std::string(); - string::const_iterator first(find_if( - val.begin(), - val.end(), - STG::IsNotSpace(loc))); - string::const_reverse_iterator last(find_if( - val.rbegin(), - val.rend(), - STG::IsNotSpace(loc))); - if (first == val.end()) - return std::string(); - return std::string(first, last.base()); -} -std::string inet_ntostring(uint32_t ip) -{ - char buf[INET_ADDRSTRLEN + 1]; - - return inet_ntop(AF_INET, &ip, buf, INET_ADDRSTRLEN); -}