}
#endif
//---------------------------------------------------------------------------
-const std::string & x2str(uint32_t x, std::string & s)
-{
-return unsigned2str(x, s);
-}
-//---------------------------------------------------------------------------
-const std::string & x2str(uint64_t x, std::string & s)
-{
-return unsigned2str(x, s);
-}
-//---------------------------------------------------------------------------
-const std::string & x2str(double x, std::string & s)
-{
-char buf[256];
-snprintf(buf, sizeof(buf), "%f", x);
-s = buf;
-return s;
-}
-//---------------------------------------------------------------------------
std::string & TrimL(std::string & val)
{
size_t pos = val.find_first_not_of(" \t");
if (std::isprint(src[i]))
dest += src[i];
else
- dest += "\\" + x2str(src[i]);
+ dest += "\\" + std::to_string(src[i]);
return dest;
}
int str2x(const std::string & str, uint64_t & x);
#endif
//-----------------------------------------------------------------------------
-const std::string & x2str(uint32_t x, std::string & s);
-const std::string & x2str(uint64_t x, std::string & s);
-//-----------------------------------------------------------------------------
-const std::string & x2str(double x, std::string & s);
-//-----------------------------------------------------------------------------
template <typename varT>
int str2x(const std::string & str, varT & x);
-template <typename varT>
-const std::string & x2str(varT x, std::string & s);
-template <typename varT>
-std::string x2str(varT x) { std::string s; return x2str(x, s); }
-template <typename varT>
-const std::string & unsigned2str(varT x, std::string & s);
-template <typename varT>
-std::string unsigned2str(varT x) { std::string s; return unsigned2str(x, s); }
//-----------------------------------------------------------------------------
template <typename varT>
return 0;
}
//-----------------------------------------------------------------------------
-template <typename varT>
-inline
-const std::string & x2str(varT x, std::string & s)
-{
- varT xx = x;
- int pos = 1;
-
- x /= 10;
- while (x != 0)
- {
- x /= 10;
- pos++;
- }
-
- if (xx < 0)
- {
- pos++;
- s.resize(pos, 0);
- s[0] = '-';
- }
- else if (xx > 0)
- {
- s.resize(pos, 0);
- }
- else
- {
- s.resize(1, 0);
- s[0] = '0';
- return s;
- }
-
- x = xx;
-
- while (x != 0)
- {
- if (x < 0)
- s[--pos] = -(x % 10) + '0';
- else
- s[--pos] = x % 10 + '0';
-
- x /= 10;
- }
-
- return s;
-}
-//-----------------------------------------------------------------------------
-template <typename varT>
-inline
-const std::string & unsigned2str(varT x, std::string & s)
-{
- varT xx = x;
- int pos = 1;
-
- x /= 10;
- while (x != 0)
- {
- x /= 10;
- pos++;
- }
-
- if (xx > 0)
- {
- s.resize(pos, 0);
- }
- else
- {
- s.resize(1, 0);
- s[0] = '0';
- return s;
- }
-
- x = xx;
-
- while (x != 0)
- {
- s[--pos] = x % 10 + '0';
-
- x /= 10;
- }
-
- return s;
-}
-//-----------------------------------------------------------------------------
char * stg_strptime(const char *, const char *, struct tm *);
time_t stg_timegm(struct tm *);
public:
explicit NumberGen(const std::string& value) : m_value(value) {}
template <typename T>
- explicit NumberGen(const T& value) : m_value(x2str(value)) {}
+ explicit NumberGen(const T& value) : m_value(std::to_string(value)) {}
virtual void run(yajl_gen_t* handle) const;
private:
std::string m_value;
{
uint32_t ip = iter->first;
time_t t = iter->second;
- std::string s;
- x2str(t, s);
+ std::string s = std::to_string(t);
printf("ip = %s, time = %9s\n", inet_ntostring(ip).c_str(), s.c_str());
++iter;
}
if (!conf.password.empty())
params += " password=\"" + conf.password.data() + "\"";
if (!conf.priv.empty())
- params += " priv=\"" + unsigned2str(conf.priv.data().ToInt()) + "\"";
+ params += " priv=\"" + std::to_string(conf.priv.data().ToInt()) + "\"";
return params;
}
return;
if (!res.empty())
res += "/";
- res += x2str((array[i].*field).data());
+ res += std::to_string((array[i].*field).data());
}
stream << "<" << name << " value=\"" << res << "\"/>";
}
AddParser(propertyParsers, "changePolicy", info.tariffConf.changePolicy, GetChangePolicy);
AddParser(propertyParsers, "changePolicyTimeout", info.tariffConf.changePolicyTimeout);
for (size_t i = 0; i < DIR_NUM; ++i)
- AddParser(propertyParsers, "time" + unsigned2str(i), info.dirPrice[i], GetTimeSpan);
+ AddParser(propertyParsers, "time" + std::to_string(i), info.dirPrice[i], GetTimeSpan);
AddAOSParser(propertyParsers, "priceDayA", info.dirPrice, &DIRPRICE_DATA::priceDayA, GetSlashedValue);
AddAOSParser(propertyParsers, "priceDayB", info.dirPrice, &DIRPRICE_DATA::priceDayB, GetSlashedValue);
AddAOSParser(propertyParsers, "priceNightA", info.dirPrice, &DIRPRICE_DATA::priceNightA, GetSlashedValue);
std::map<std::string, long long *> props;
for (size_t i = 0; i < DIR_NUM; ++i)
{
- props.insert(std::pair<std::string, long long *>("su" + unsigned2str(i), &value.su[i]));
- props.insert(std::pair<std::string, long long *>("sd" + unsigned2str(i), &value.sd[i]));
- props.insert(std::pair<std::string, long long *>("mu" + unsigned2str(i), &value.mu[i]));
- props.insert(std::pair<std::string, long long *>("md" + unsigned2str(i), &value.md[i]));
+ props.insert(std::pair<std::string, long long *>("su" + std::to_string(i), &value.su[i]));
+ props.insert(std::pair<std::string, long long *>("sd" + std::to_string(i), &value.sd[i]));
+ props.insert(std::pair<std::string, long long *>("mu" + std::to_string(i), &value.mu[i]));
+ props.insert(std::pair<std::string, long long *>("md" + std::to_string(i), &value.md[i]));
}
size_t pos = 0;
while (attr[pos])
AddParser(propertyParsers, "lastActivityTime", info.lastActivityTime);
for (size_t i = 0; i < USERDATA_NUM; ++i)
- AddParser(propertyParsers, "userData" + unsigned2str(i), info.userData[i], "koi8-ru", GetEncodedValue);
+ AddParser(propertyParsers, "userData" + std::to_string(i), info.userData[i], "koi8-ru", GetEncodedValue);
}
//-----------------------------------------------------------------------------
GET_USER::PARSER::~PARSER()
AddParser(propertyParsers, "tariff_num", info.tariffNum);
for (size_t i = 0; i < DIR_NUM; i++)
- AddParser(propertyParsers, "dir_name_" + unsigned2str(i), info.dirName[i], GetEncodedValue);
+ AddParser(propertyParsers, "dir_name_" + std::to_string(i), info.dirName[i], GetEncodedValue);
}
//-----------------------------------------------------------------------------
int SERVER_INFO::PARSER::ParseStart(const char *el, const char **attr)
inline
std::string PARAM_ACTION<T>::DefaultDescription() const
{
-return m_hasDefault ? " (default: '" + x2str(m_defaltValue) + "')"
+return m_hasDefault ? " (default: '" + std::to_string(m_defaltValue) + "')"
: "";
}
if (!server.empty())
res += "server: '" + server.data() + "'\n";
if (!port.empty())
- res += "port: " + x2str(port.data()) + "\n";
+ res += "port: " + std::to_string(port.data()) + "\n";
if (!localAddress.empty())
res += "local address: '" + localAddress.data() + "'\n";
if (!localPort.empty())
- res += "local port: " + x2str(localPort.data()) + "\n";
+ res += "local port: " + std::to_string(localPort.data()) + "\n";
if (!userName.empty())
res += "userName: '" + userName.data() + "'\n";
if (!userPass.empty())
value.erase(std::remove(value.begin(), value.end(), ' '), value.end());
std::vector<TRAFF> traff(Split<std::vector<TRAFF> >(value, ',', ConvTraff));
if (traff.size() != DIR_NUM)
- throw SGCONF::ACTION::ERROR("There should be prcisely " + x2str(DIR_NUM) + " records of session traffic.");
+ throw SGCONF::ACTION::ERROR("There should be prcisely " + std::to_string(DIR_NUM) + " records of session traffic.");
for (size_t i = 0; i < DIR_NUM; ++i)
{
res.sessionUp[i] = traff[i].up;
value.erase(std::remove(value.begin(), value.end(), ' '), value.end());
std::vector<TRAFF> traff(Split<std::vector<TRAFF> >(value, ',', ConvTraff));
if (traff.size() != DIR_NUM)
- throw SGCONF::ACTION::ERROR("There should be prcisely " + x2str(DIR_NUM) + " records of month traffic.");
+ throw SGCONF::ACTION::ERROR("There should be prcisely " + std::to_string(DIR_NUM) + " records of month traffic.");
for (size_t i = 0; i < DIR_NUM; ++i)
{
res.monthUp[i] = traff[i].up;
queueHandle = nfq_create_queue(nfqHandle, queueNumber, &Callback, this);
if (queueHandle == NULL)
{
- errorStr = "Failed to create queue " + x2str(queueNumber) + ".";
+ errorStr = "Failed to create queue " + std::to_string(queueNumber) + ".";
logger(errorStr);
return -1;
}
if (nfq_set_mode(queueHandle, NFQNL_COPY_PACKET, 0xffFF) < 0)
{
- errorStr = "Failed to set queue " + x2str(queueNumber) + " mode.";
+ errorStr = "Failed to set queue " + std::to_string(queueNumber) + " mode.";
logger(errorStr);
return -1;
}
for (int j = 0; j < DIR_NUM; j++)
{
- std::string value;
- x2str(upload[j], value);
- mu[j] = xmlrpc_c::value_string(value);
- x2str(download[j], value);
- md[j] = xmlrpc_c::value_string(value);
- x2str(supload[j], value);
- su[j] = xmlrpc_c::value_string(value);
- x2str(sdownload[j], value);
- sd[j] = xmlrpc_c::value_string(value);
+ mu[j] = xmlrpc_c::value_string(std::to_string(upload[j]));
+ md[j] = xmlrpc_c::value_string(std::to_string(download[j]));
+ su[j] = xmlrpc_c::value_string(std::to_string(supload[j]));
+ sd[j] = xmlrpc_c::value_string(std::to_string(sdownload[j]));
}
traffInfo["mu"] = xmlrpc_c::value_array(mu);
uint32_t IP() const { return *(uint32_t *)(&m_addr.sin_addr); }
uint16_t Port() const { return ntohs(m_addr.sin_port); }
- std::string endpoint() const { return inet_ntostring(IP()) + ":" + x2str(Port()); }
+ std::string endpoint() const { return inet_ntostring(IP()) + ":" + std::to_string(Port()); }
bool Read();
std::string twoDigit(int value) const
{
- std::string res = x2str(value);
+ std::string res = std::to_string(value);
if (res.length() < 2)
res = "0" + res;
return res;
}
};
-} // namespace Caster
+} // namespace STG
#endif
(ac.priv.userAddDel << 8) +
(ac.priv.adminChg << 10) +
(ac.priv.tariffChg << 12);
- m_answer += "<admin login=\"" + ac.login + "\" priv=\"" + x2str(p) + "\"/>";
+ m_answer += "<admin login=\"" + ac.login + "\" priv=\"" + std::to_string(p) + "\"/>";
}
m_admins.CloseSearch(h);
m_answer += "</Admins>";
utsn.nodename;
m_answer = std::string("<ServerInfo><version value=\"") + SERVER_VERSION + "\"/>" +
- "<tariff_num value=\"" + x2str(m_tariffs.Count()) + "\"/>" +
+ "<tariff_num value=\"" + std::to_string(m_tariffs.Count()) + "\"/>" +
"<tariff value=\"2\"/>" +
- "<user_num value=\"" + x2str(m_users.Count()) + "\"/>" +
+ "<user_num value=\"" + std::to_string(m_users.Count()) + "\"/>" +
"<uname value=\"" + name + "\"/>" +
- "<dir_num value=\"" + x2str(DIR_NUM) + "\"/>" +
- "<day_fee value=\"" + x2str(m_settings.GetDayFee()) + "\"/>";
+ "<dir_num value=\"" + std::to_string(DIR_NUM) + "\"/>" +
+ "<day_fee value=\"" + std::to_string(m_settings.GetDayFee()) + "\"/>";
for (size_t i = 0; i< DIR_NUM; i++)
- m_answer += "<dir_name_" + x2str(i) + " value=\"" + Encode12str(m_settings.GetDirName(i)) + "\"/>";
+ m_answer += "<dir_name_" + std::to_string(i) + " value=\"" + Encode12str(m_settings.GetDirName(i)) + "\"/>";
m_answer += "</ServerInfo>";
}
{
m_answer += "<Service name=\"" + conf.name +
"\" comment=\"" + Encode12str(conf.comment) +
- "\" cost=\"" + x2str(conf.cost) +
- "\" payDay=\"" + x2str(conf.payDay) + "\"/>";
+ "\" cost=\"" + std::to_string(conf.cost) +
+ "\" payDay=\"" + std::to_string(conf.payDay) + "\"/>";
}
m_services.CloseSearch(h);
m_answer += "</Services>";
else
m_answer += "<" + m_tag + " name=\"" + conf.name +
"\" comment=\"" + Encode12str(conf.comment) +
- "\" cost=\"" + x2str(conf.cost) +
- "\" payDay=\"" + x2str(conf.payDay) + "\"/>";
+ "\" cost=\"" + std::to_string(conf.cost) +
+ "\" payDay=\"" + std::to_string(conf.payDay) + "\"/>";
}
int ADD_SERVICE::Start(void *, const char * el, const char ** attr)
{
if (!res.empty())
res += "/";
- res += x2str((array[i].*field) * multiplier);
+ res += std::to_string((array[i].*field) * multiplier);
}
return res;
}
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) + "\"/>" +
"<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) + "\"/>" +
- "<ChangePolicyTimeout value=\"" + x2str(it->tariffConf.changePolicyTimeout) + "\"/>" +
+ "<ChangePolicyTimeout value=\"" + std::to_string(it->tariffConf.changePolicyTimeout) + "\"/>" +
"</tariff>";
}
return;
}
- m_answer = "<UserInfo lastAuthTime=\"" + x2str(u->GetAuthorizedModificationTime()) + "\"" +
- " lastDisconnectTime=\"" + x2str(u->GetConnectedModificationTime()) + "\"" +
+ m_answer = "<UserInfo lastAuthTime=\"" + std::to_string(u->GetAuthorizedModificationTime()) + "\"" +
+ " lastDisconnectTime=\"" + std::to_string(u->GetConnectedModificationTime()) + "\"" +
" connected=\"" + (u->GetConnected() ? "true" : "false") + "\"" +
" lastDisconnectReason=\"" + u->GetLastDisconnectReason() + "\">";
std::vector<std::string> list(u->GetAuthorizers());
}
if (user.GetProperty().cash.ModificationTime() > lastTime)
- answer += "<Cash value=\"" + x2str(user.GetProperty().cash.Get()) + "\"/>";
+ answer += "<Cash value=\"" + std::to_string(user.GetProperty().cash.Get()) + "\"/>";
if (user.GetProperty().freeMb.ModificationTime() > lastTime)
- answer += "<FreeMb value=\"" + x2str(user.GetProperty().freeMb.Get()) + "\"/>";
+ answer += "<FreeMb value=\"" + std::to_string(user.GetProperty().freeMb.Get()) + "\"/>";
if (user.GetProperty().credit.ModificationTime() > lastTime)
- answer += "<Credit value=\"" + x2str(user.GetProperty().credit.Get()) + "\"/>";
+ answer += "<Credit value=\"" + std::to_string(user.GetProperty().credit.Get()) + "\"/>";
if (user.GetProperty().nextTariff.Get() != "")
{
for (size_t i = 0; i < userdata.size(); i++)
if (userdata[i]->ModificationTime() > lastTime)
- answer += "<UserData" + x2str(i) + " value=\"" + Encode12str(userdata[i]->Get()) + "\" />";
+ answer += "<UserData" + std::to_string(i) + " value=\"" + Encode12str(userdata[i]->Get()) + "\" />";
if (user.GetProperty().realName.ModificationTime() > lastTime)
answer += "<Name value=\"" + Encode12str(user.GetProperty().realName) + "\"/>";
if (user.GetCurrIPModificationTime() > lastTime)
answer += "<CurrIP value=\"" + inet_ntostring(user.GetCurrIP()) + "\"/>";
if (user.GetPingTime() > lastTime)
- answer += "<PingTime value=\"" + x2str(user.GetPingTime()) + "\"/>";
+ answer += "<PingTime value=\"" + std::to_string(user.GetPingTime()) + "\"/>";
if (user.GetProperty().ips.ModificationTime() > lastTime)
answer += "<IP value=\"" + user.GetProperty().ips.Get().GetIpStr() + "\"/>";
const DIR_TRAFF & download(user.GetProperty().down.Get());
if (user.GetProperty().up.ModificationTime() > lastTime)
for (size_t j = 0; j < DIR_NUM; j++)
- answer += " MU" + x2str(j) + "=\"" + x2str(upload[j]) + "\"";
+ answer += " MU" + std::to_string(j) + "=\"" + std::to_string(upload[j]) + "\"";
if (user.GetProperty().down.ModificationTime() > lastTime)
for (size_t j = 0; j < DIR_NUM; j++)
- answer += " MD" + x2str(j) + "=\"" + x2str(download[j]) + "\"";
+ answer += " MD" + std::to_string(j) + "=\"" + std::to_string(download[j]) + "\"";
if (user.GetSessionUploadModificationTime() > lastTime)
for (size_t j = 0; j < DIR_NUM; j++)
- answer += " SU" + x2str(j) + "=\"" + x2str(user.GetSessionUpload()[j]) + "\"";
+ answer += " SU" + std::to_string(j) + "=\"" + std::to_string(user.GetSessionUpload()[j]) + "\"";
if (user.GetSessionDownloadModificationTime() > lastTime)
for (size_t j = 0; j < DIR_NUM; j++)
- answer += " SD" + x2str(j) + "=\"" + x2str(user.GetSessionDownload()[j]) + "\"";
+ answer += " SD" + std::to_string(j) + "=\"" + std::to_string(user.GetSessionDownload()[j]) + "\"";
answer += "/>";
if (user.GetProperty().disabled.ModificationTime() > lastTime)
if (user.GetProperty().passive.ModificationTime() > lastTime)
answer += std::string("<Passive value=\"") + (user.GetProperty().passive.Get() ? "1" : "0") + "\"/>";
if (user.GetProperty().lastCashAdd.ModificationTime() > lastTime)
- answer += "<LastCash value=\"" + x2str(user.GetProperty().lastCashAdd.Get()) + "\"/>";
+ answer += "<LastCash value=\"" + std::to_string(user.GetProperty().lastCashAdd.Get()) + "\"/>";
if (user.GetProperty().lastCashAddTime.ModificationTime() > lastTime)
- answer += "<LastTimeCash value=\"" + x2str(user.GetProperty().lastCashAddTime.Get()) + "\"/>";
+ answer += "<LastTimeCash value=\"" + std::to_string(user.GetProperty().lastCashAddTime.Get()) + "\"/>";
if (user.GetProperty().lastActivityTime.ModificationTime() > lastTime)
- answer += "<LastActivityTime value=\"" + x2str(user.GetProperty().lastActivityTime.Get()) + "\"/>";
+ answer += "<LastActivityTime value=\"" + std::to_string(user.GetProperty().lastActivityTime.Get()) + "\"/>";
if (user.GetProperty().creditExpire.ModificationTime() > lastTime)
- answer += "<CreditExpire value=\"" + x2str(user.GetProperty().creditExpire.Get()) + "\"/>";
+ answer += "<CreditExpire value=\"" + std::to_string(user.GetProperty().creditExpire.Get()) + "\"/>";
if (lastTime == 0)
{
assert(h);
if (m_lastUserUpdateTime > 0)
- m_answer = "<Users LastUpdate=\"" + x2str(time(NULL)) + "\">";
+ m_answer = "<Users LastUpdate=\"" + std::to_string(time(NULL)) + "\">";
else
m_answer = "<Users>";
error(message)
{}
ParserError(size_t pos, const std::string& message)
- : runtime_error("Parsing error at position " + x2str(pos) + ". " + message),
+ : runtime_error("Parsing error at position " + std::to_string(pos) + ". " + message),
position(pos),
error(message)
{}
m_logger(m_error);
return;
}
- std::string remote = inet_ntostring(addr.sin_addr.s_addr) + ":" + x2str(ntohs(addr.sin_port));
+ std::string remote = inet_ntostring(addr.sin_addr.s_addr) + ":" + std::to_string(ntohs(addr.sin_port));
printfd(__FILE__, "New TCP connection: '%s'\n", remote.c_str());
m_conns.push_back(new Conn(*m_users, m_logger, *this, m_config, res, remote));
}
users.CloseSearch(handle);
-std::string res;
-x2str(count, res);
-return res;
+return std::to_string(count);
}
#endif
#ifdef DEBUG
std::string ToString() const
- { std::string res; x2str(users.Count(), res); return res; }
+ { std::string res; std::to_string(users.Count(), res); return res; }
#endif
private:
#ifdef DEBUG
std::string ToString() const
- { std::string res; x2str(tariffs.Count(), res); return res; }
+ { std::string res; std::to_string(tariffs.Count(), res); return res; }
#endif
private:
#ifdef DEBUG
std::string ToString() const
- { std::string res; x2str(admins.Count(), res); return res; }
+ { std::string res; std::to_string(admins.Count(), res); return res; }
#endif
private:
#ifdef DEBUG
std::string ToString() const
- { std::string res; x2str(services.Count(), res); return res; }
+ { std::string res; std::to_string(services.Count(), res); return res; }
#endif
private:
#ifdef DEBUG
std::string ToString() const
- { std::string res; x2str(corporations.Count(), res); return res; }
+ { std::string res; std::to_string(corporations.Count(), res); return res; }
#endif
private:
#ifdef DEBUG
std::string ToString() const
- { std::string res; x2str(traffcounter.RulesCount(), res); return res; }
+ { std::string res; std::to_string(traffcounter.RulesCount(), res); return res; }
#endif
private:
#ifdef DEBUG
std::string ToString() const
- { std::string res; x2str(value, res); return res; }
+ { std::string res; std::to_string(value, res); return res; }
#endif
private:
while (stIter != statTree.end())
{
- std::string u, d;
- x2str(stIter->second.up, u);
- x2str(stIter->second.down, d);
+ const auto u = std::to_string(stIter->second.up);
+ const auto d = std::to_string(stIter->second.down);
#ifdef TRAFF_STAT_WITH_PORTS
if (fprintf(statFile, "%17s:%hu\t%15d\t%15s\t%15s\t%f\n",
inet_ntostring(stIter->first.ip).c_str(),
if (access(fileName.c_str(), F_OK) != 0)
{
- std::string idstr;
- x2str(msg.header.id, idstr);
STG_LOCKER lock(&mutex);
errorStr = "Message for user \'";
errorStr += login + "\' with ID \'";
- errorStr += idstr + "\' does not exist.";
+ errorStr += std::to_string(msg.header.id) + "\' does not exist.";
printfd(__FILE__, "FILES_STORE::EditMessage - %s\n", errorStr.c_str());
return -1;
}
std::string query = "INSERT INTO users SET login='" + login + "',Note='',NAS=''";
for (int i = 0; i < USERDATA_NUM; i++)
- query += ",Userdata" + x2str(i) + "=''";
+ query += ",Userdata" + std::to_string(i) + "=''";
if(MysqlSetQuery(query.c_str()))
{