#include "admins_impl.h"
#include "admin_impl.h"
-using namespace std;
-
//-----------------------------------------------------------------------------
ADMINS_IMPL::ADMINS_IMPL(STORE * st)
: ADMINS(),
Read();
}
//-----------------------------------------------------------------------------
-int ADMINS_IMPL::Add(const string & login, const ADMIN * admin)
+int ADMINS_IMPL::Add(const std::string & login, const ADMIN * admin)
{
STG_LOCKER lock(&mutex);
const PRIV * priv = admin->GetPriv();
if (!priv->adminChg)
{
- string s = admin->GetLogStr() + " Add administrator \'" + login + "\'. Access denied.";
+ std::string s = admin->GetLogStr() + " Add administrator \'" + login + "\'. Access denied.";
strError = "Access denied.";
WriteServLog(s.c_str());
return -1;
return -1;
}
//-----------------------------------------------------------------------------
-int ADMINS_IMPL::Del(const string & login, const ADMIN * admin)
+int ADMINS_IMPL::Del(const std::string & login, const ADMIN * admin)
{
STG_LOCKER lock(&mutex);
ADMIN_IMPL adm(0, login, "");
if (!priv->adminChg)
{
- string s = admin->GetLogStr() + " Delete administrator \'" + login + "\'. Access denied.";
+ std::string s = admin->GetLogStr() + " Delete administrator \'" + login + "\'. Access denied.";
strError = "Access denied.";
WriteServLog(s.c_str());
return -1;
return -1;
}
-map<int, const_admin_iter>::iterator si;
+std::map<int, const_admin_iter>::iterator si;
si = searchDescriptors.begin();
while (si != searchDescriptors.end())
{
if (!priv->adminChg)
{
- string s = admin->GetLogStr() + " Change administrator \'" + ac.login + "\'. Access denied.";
+ std::string s = admin->GetLogStr() + " Change administrator \'" + ac.login + "\'. Access denied.";
strError = "Access denied.";
WriteServLog(s.c_str());
return -1;
int ADMINS_IMPL::Read()
{
STG_LOCKER lock(&mutex);
-vector<string> adminsList;
+std::vector<std::string> adminsList;
if (store->GetAdminsList(&adminsList) < 0)
{
WriteServLog(store->GetStrError().c_str());
return 0;
}
//-----------------------------------------------------------------------------
-bool ADMINS_IMPL::Find(const string & l, ADMIN ** admin)
+bool ADMINS_IMPL::Find(const std::string & l, ADMIN ** admin)
{
assert(admin != NULL && "Pointer to admin is not null");
return true;
}
//-----------------------------------------------------------------------------
-bool ADMINS_IMPL::Exists(const string & login) const
+bool ADMINS_IMPL::Exists(const std::string & login) const
{
STG_LOCKER lock(&mutex);
if (data.empty())
return false;
}
//-----------------------------------------------------------------------------
-bool ADMINS_IMPL::Correct(const string & login, const std::string & password, ADMIN ** admin)
+bool ADMINS_IMPL::Correct(const std::string & login, const std::string & password, ADMIN ** admin)
{
STG_LOCKER lock(&mutex);
if (data.empty())
#include <string>
#include <vector>
-using namespace std;
-
#include "firebird_store.h"
#include "stg/ibpp.h"
#include "stg/blowfish.h"
#define adm_enc_passwd "cjeifY8m3"
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::GetAdminsList(vector<string> * adminsList) const
+int FIREBIRD_STORE::GetAdminsList(std::vector<std::string> * adminsList) const
{
STG_LOCKER lock(&mutex);
IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amRead, til, tlr);
IBPP::Statement st = IBPP::StatementFactory(db, tr);
-string login;
+std::string login;
try
{
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::RestoreAdmin(ADMIN_CONF * ac, const string & login) const
+int FIREBIRD_STORE::RestoreAdmin(ADMIN_CONF * ac, const std::string & login) const
{
STG_LOCKER lock(&mutex);
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::AddAdmin(const string & login) const
+int FIREBIRD_STORE::AddAdmin(const std::string & login) const
{
STG_LOCKER lock(&mutex);
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::DelAdmin(const string & login) const
+int FIREBIRD_STORE::DelAdmin(const std::string & login) const
{
STG_LOCKER lock(&mutex);
#include "stg/dotconfpp.h"
#include "settings_impl.h"
-using namespace std;
-
//-----------------------------------------------------------------------------
SETTINGS_IMPL::SETTINGS_IMPL()
: SETTINGS(),
{
}
//-----------------------------------------------------------------------------
-int SETTINGS_IMPL::ParseModuleSettings(const DOTCONFDocumentNode * node, vector<PARAM_VALUE> * params)
+int SETTINGS_IMPL::ParseModuleSettings(const DOTCONFDocumentNode * node, std::vector<PARAM_VALUE> * params)
{
const DOTCONFDocumentNode * childNode;
PARAM_VALUE pv;
if (node->getValue(1))
{
- strError = "Unexpected value \'" + string(node->getValue(1)) + "\'.";
+ strError = "Unexpected value \'" + std::string(node->getValue(1)) + "\'.";
return -1;
}
DOTCONFDocument conf(DOTCONFDocument::CASEINSENSITIVE);
conf.setErrorCallback(SETTINGS_IMPL::ErrorCallback, this);
conf.setRequiredOptionNames(requiredOptions);
-string confFile = confDir + "/stargazer.conf";
+std::string confFile = confDir + "/stargazer.conf";
if(conf.setContent(confFile.c_str()) != 0)
{
{
if (ParseDetailStatWritePeriod(node->getValue(0)) != 0)
{
- strError = "Incorrect DetailStatWritePeriod value: \'" + string(node->getValue(0)) + "\'";
+ strError = "Incorrect DetailStatWritePeriod value: \'" + std::string(node->getValue(0)) + "\'";
return -1;
}
}
{
if (ParseUnsignedInRange(node->getValue(0), 1, 1440, &statWritePeriod) != 0)
{
- strError = "Incorrect StatWritePeriod value: \'" + string(node->getValue(0)) + "\'";
+ strError = "Incorrect StatWritePeriod value: \'" + std::string(node->getValue(0)) + "\'";
return -1;
}
}
{
if (ParseInt(node->getValue(0), &stgExecMsgKey) != 0)
{
- strError = "Incorrect ExecMsgKey value: \'" + string(node->getValue(0)) + "\'";
+ strError = "Incorrect ExecMsgKey value: \'" + std::string(node->getValue(0)) + "\'";
return -1;
}
}
{
if (ParseUnsignedInRange(node->getValue(0), 1, 1024, &executersNum) != 0)
{
- strError = "Incorrect ExecutersNum value: \'" + string(node->getValue(0)) + "\'";
+ strError = "Incorrect ExecutersNum value: \'" + std::string(node->getValue(0)) + "\'";
return -1;
}
}
{
if (ParseUnsignedInRange(node->getValue(0), 0, 31, &dayFee) != 0)
{
- strError = "Incorrect DayFee value: \'" + string(node->getValue(0)) + "\'";
+ strError = "Incorrect DayFee value: \'" + std::string(node->getValue(0)) + "\'";
return -1;
}
}
{
if (ParseYesNo(node->getValue(0), &fullFee) != 0)
{
- strError = "Incorrect FullFee value: \'" + string(node->getValue(0)) + "\'";
+ strError = "Incorrect FullFee value: \'" + std::string(node->getValue(0)) + "\'";
return -1;
}
}
{
if (ParseUnsignedInRange(node->getValue(0), 0, 31, &dayResetTraff) != 0)
{
- strError = "Incorrect DayResetTraff value: \'" + string(node->getValue(0)) + "\'";
+ strError = "Incorrect DayResetTraff value: \'" + std::string(node->getValue(0)) + "\'";
return -1;
}
}
{
if (ParseYesNo(node->getValue(0), &spreadFee) != 0)
{
- strError = "Incorrect SpreadFee value: \'" + string(node->getValue(0)) + "\'";
+ strError = "Incorrect SpreadFee value: \'" + std::string(node->getValue(0)) + "\'";
return -1;
}
}
{
if (ParseYesNo(node->getValue(0), &freeMbAllowInet) != 0)
{
- strError = "Incorrect FreeMbAllowInet value: \'" + string(node->getValue(0)) + "\'";
+ strError = "Incorrect FreeMbAllowInet value: \'" + std::string(node->getValue(0)) + "\'";
return -1;
}
}
{
if (ParseYesNo(node->getValue(0), &dayFeeIsLastDay) != 0)
{
- strError = "Incorrect DayFeeIsLastDay value: \'" + string(node->getValue(0)) + "\'";
+ strError = "Incorrect DayFeeIsLastDay value: \'" + std::string(node->getValue(0)) + "\'";
return -1;
}
}
{
if (ParseYesNo(node->getValue(0), &writeFreeMbTraffCost) != 0)
{
- strError = "Incorrect WriteFreeMbTraffCost value: \'" + string(node->getValue(0)) + "\'";
+ strError = "Incorrect WriteFreeMbTraffCost value: \'" + std::string(node->getValue(0)) + "\'";
return -1;
}
}
{
if (ParseYesNo(node->getValue(0), &showFeeInCash) != 0)
{
- strError = "Incorrect ShowFeeInCash value: \'" + string(node->getValue(0)) + "\'";
+ strError = "Incorrect ShowFeeInCash value: \'" + std::string(node->getValue(0)) + "\'";
return -1;
}
}
{
if (ParseUnsigned(node->getValue(0), &messageTimeout) != 0)
{
- strError = "Incorrect MessageTimeout value: \'" + string(node->getValue(0)) + "\'";
+ strError = "Incorrect MessageTimeout value: \'" + std::string(node->getValue(0)) + "\'";
return -1;
}
}
{
if (ParseUnsignedInRange(node->getValue(0), 0, 3, &feeChargeType) != 0)
{
- strError = "Incorrect FeeChargeType value: \'" + string(node->getValue(0)) + "\'";
+ strError = "Incorrect FeeChargeType value: \'" + std::string(node->getValue(0)) + "\'";
return -1;
}
}
{
if (ParseYesNo(node->getValue(0), &reconnectOnTariffChange) != 0)
{
- strError = "Incorrect ReconnectOnTariffChange value: \'" + string(node->getValue(0)) + "\'";
+ strError = "Incorrect ReconnectOnTariffChange value: \'" + std::string(node->getValue(0)) + "\'";
return -1;
}
}
{
if (node->getValue(1))
{
- strError = "Unexpected \'" + string(node->getValue(1)) + "\'.";
+ strError = "Unexpected \'" + std::string(node->getValue(1)) + "\'.";
return -1;
}
{
if (node->getValue(0))
{
- strError = "Unexpected \'" + string(node->getValue(0)) + "\'.";
+ strError = "Unexpected \'" + std::string(node->getValue(0)) + "\'.";
return -1;
}
const DOTCONFDocumentNode * child = node->getChildNode();
return 0;
}
//-----------------------------------------------------------------------------
-int SETTINGS_IMPL::ParseDetailStatWritePeriod(const string & detailStatPeriodStr)
+int SETTINGS_IMPL::ParseDetailStatWritePeriod(const std::string & detailStatPeriodStr)
{
if (detailStatPeriodStr == "1")
{
return -1;
}
-//-----------------------------------------------------------------------------
\ No newline at end of file
+//-----------------------------------------------------------------------------
#include "stg/admin.h"
#include "tariffs_impl.h"
-using namespace std;
-
//-----------------------------------------------------------------------------
TARIFFS_IMPL::TARIFFS_IMPL(STORE * st)
: TARIFFS(),
{
STG_LOCKER lock(&mutex);
-vector<string> tariffsList;
+std::vector<std::string> tariffsList;
if (store->GetTariffsList(&tariffsList))
{
WriteServLog("Cannot get tariffs list.");
return tariffs.size();
}
//-----------------------------------------------------------------------------
-const TARIFF * TARIFFS_IMPL::FindByName(const string & name) const
+const TARIFF * TARIFFS_IMPL::FindByName(const std::string & name) const
{
if (name == NO_TARIFF_NAME)
return &noTariff;
STG_LOCKER lock(&mutex);
-list<TARIFF_IMPL>::const_iterator ti;
+std::list<TARIFF_IMPL>::const_iterator ti;
ti = find(tariffs.begin(), tariffs.end(), TARIFF_IMPL(name));
if (ti != tariffs.end())
if (!priv->tariffChg)
{
- string s = admin->GetLogStr() + " Change tariff \'"
+ std::string s = admin->GetLogStr() + " Change tariff \'"
+ td.tariffConf.name + "\'. Access denied.";
strError = "Access denied.";
WriteServLog(s.c_str());
STG_LOCKER lock(&mutex);
-list<TARIFF_IMPL>::iterator ti;
+std::list<TARIFF_IMPL>::iterator ti;
ti = find(tariffs.begin(), tariffs.end(), TARIFF_IMPL(td.tariffConf.name));
if (ti == tariffs.end())
if (store->SaveTariff(td, td.tariffConf.name))
{
- string error = "Tariff " + td.tariffConf.name + " writing error. " + store->GetStrError();
+ std::string error = "Tariff " + td.tariffConf.name + " writing error. " + store->GetStrError();
WriteServLog(error.c_str());
return -1;
}
return 0;
}
//-----------------------------------------------------------------------------
-int TARIFFS_IMPL::Del(const string & name, const ADMIN * admin)
+int TARIFFS_IMPL::Del(const std::string & name, const ADMIN * admin)
{
const PRIV * priv = admin->GetPriv();
if (!priv->tariffChg)
{
- string s = admin->GetLogStr() + " Delete tariff \'"
+ std::string s = admin->GetLogStr() + " Delete tariff \'"
+ name + "\'. Access denied.";
strError = "Access denied.";
WriteServLog(s.c_str());
{
STG_LOCKER lock(&mutex);
- list<TARIFF_IMPL>::iterator ti;
+ std::list<TARIFF_IMPL>::iterator ti;
ti = find(tariffs.begin(), tariffs.end(), TARIFF_IMPL(name));
if (ti == tariffs.end())
WriteServLog("%s", store->GetStrError().c_str());
return -1;
}
-
+
td = ti->GetTariffData();
tariffs.erase(ti);
return 0;
}
//-----------------------------------------------------------------------------
-int TARIFFS_IMPL::Add(const string & name, const ADMIN * admin)
+int TARIFFS_IMPL::Add(const std::string & name, const ADMIN * admin)
{
const PRIV * priv = admin->GetPriv();
if (!priv->tariffChg)
{
- string s = admin->GetLogStr() + " Add tariff \'"
+ std::string s = admin->GetLogStr() + " Add tariff \'"
+ name + "\'. Access denied.";
strError = "Access denied.";
WriteServLog(s.c_str());
{
STG_LOCKER lock(&mutex);
- list<TARIFF_IMPL>::iterator ti;
+ std::list<TARIFF_IMPL>::iterator ti;
ti = find(tariffs.begin(), tariffs.end(), TARIFF_IMPL(name));
if (ti != tariffs.end())