本文整理汇总了C++中AnsiString::ToInt方法的典型用法代码示例。如果您正苦于以下问题:C++ AnsiString::ToInt方法的具体用法?C++ AnsiString::ToInt怎么用?C++ AnsiString::ToInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnsiString
的用法示例。
在下文中一共展示了AnsiString::ToInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: expression
// ---------------------------------------------------------------------------
void __fastcall TForm1::FormShow(TObject *Sender) {
// using namespace std;
/*
regex expression("\\s+href\\s*=\\s*\"([^\"]*)\"",regbase::normal|regbase::icase);
std::string ss="<a href=\"index.html\"><img src=\"logo.gif\"></a>";
std::deque<std::string> result;
regex_split(std::back_inserter(result),ss,expression);
*/
/*
copy(result.begin(),result.end(),ostream_iterator<string>(cout,"\n"));
int c;
cin>>c;
*/
// LogServerI lpLogserver;
// char* lpszRunInfo = "null";
// lpLogserver.main(0, &lpszRunInfo, "config.server");
//
AnsiString s;
s = Now().CurrentDate().DateString();
// 初始化 系统参数
AnsiString strBakLogIP;
AnsiString strBakLogDB;
AnsiString strBakLogUid;
AnsiString strBakLogPw;
WideString filename = "./monitor.xml";
TXMLDocument* xmldoc = new TXMLDocument(this);
xmldoc->FileName = filename;
xmldoc->Active = true;
_di_IXMLNode node = xmldoc->DocumentElement;
_di_IXMLNodeList nodes = node->ChildNodes;
int n;
_server.ip = "server";
System::MkDir(_server.ip);
_server.logfile = _server.ip + "/" + Now().CurrentDate().DateString()
+ ".log";
// _server.fpstore = fopen( _server.logfile.c_str(),"a+");
_server.fpstore = CreateFile(_server.logfile.c_str(), GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
for (n = 0; n < nodes->Count; n++) {
node = nodes->Nodes[n];
if (node->GetNodeName() == "server") {
s = node->GetAttribute("port");
_serverport = s.ToInt();
this->udpServer->DefaultPort = _serverport;
udpServer->Active = true;
initAlertFilter(_server.filter, node);
}
else if (node->GetNodeName() == "robot") {
_robotport = node->GetAttribute("port");
/**
* chenlsh modified on 2010-03-17
* for IOCP server initializing
*/
m_server.Init(TForm1::ProcessRecvData, _robotport);
_rebotport2 = node->GetAttribute("port2");
udpRobot2->DefaultPort = _rebotport2;
udpRobot2->Active = true;
}
else if (node->GetNodeName() == "bakLogServer") {
/**
* chenlsh modified on 2010-03-17
* for IOCP server initializing
*/
strBakLogIP = node->GetAttribute("ip");
strBakLogDB = node->GetAttribute("catalog");
strBakLogUid = node->GetAttribute("userId");
strBakLogPw = node->GetAttribute("pw");
}
else if (node->GetNodeName() == "offline_interval") {
_offline_interval = node->GetNodeValue();
}
else if (node->GetNodeName() == "buffer_lines") {
_buffer_lines = node->GetNodeValue();
}
///初始化设备清单
if (node->GetNodeName() == "robots") {
_di_IXMLNodeList nodelist;
nodelist = node->GetChildNodes();
int count = nodelist->GetCount();
for (int m = 0; m < nodelist->GetCount(); m++) {
node = nodelist->Nodes[m];
if (node->GetNodeName() == "group") {
RobotGroup group;
int ii;
group.name = node->GetAttribute("name");
_di_IXMLNodeList node_robots;
node_robots = node->GetChildNodes();
for (ii = 0; ii < node_robots->GetCount(); ii++) {
_di_IXMLNode nodeRobot;
nodeRobot = node_robots->Nodes[ii];
GtrRobot* lpRobot = new GtrRobot();
if (nodeRobot->GetNodeName() == "robot") {
lpRobot->name = nodeRobot->GetAttribute("name");
//.........这里部分代码省略.........
示例2: AnsiString
void __fastcall TFormReportBULast2::ProcessPlan(AnsiString year)
{
AnsiString query;
// зададим даты для расчета долга в предыдущем периоде 2009-2010
query = "SET @date_pre1 = '" + year + "-02-01'"; // 2009-02-01
mysql_query(mysql, query.c_str());
query = "SET @date_pre2 = '" + year + "-09-01'"; // 2009-09-01
mysql_query(mysql, query.c_str());
query = "SET @date_pre3 = '" + AnsiString(year.ToInt()+1) + "-02-01'"; // 2010-02-01
// соберем оплаты по каждой категории
mysql_query(mysql, "drop temporary table if exists old_pay");
mysql_query(mysql,
"CREATE TEMPORARY TABLE old_pay "
" ( "
" id int(11) NOT NULL AUTO_INCREMENT, "
" idstud int(11) NOT NULL, "
" idopt int(11) NOT NULL, "
" plan int(11) NOT NULL, "
" pay int(11) NOT NULL, "
" INDEX (id), "
" INDEX (idstud) "
" ) TYPE = HEAP ");
//# это обычная сентябрьская оплата
mysql_query(mysql,"INSERT old_pay (idstud, idopt, plan, pay) "
" SELECT s.idstud, s.idopt, s.commoncountmoney, SUM(COALESCE(fact.moneypay, 0)) "
" FROM ( "
" SELECT st.id as idstud, opts.id as idopt, opts.commoncountmoney "
" FROM students AS st, payoptstest as opts, voc as v "
" WHERE st.deleted = 0 AND opts.deleted = 0 AND v.deleted = 0 "
" AND v.vkey = 'grp' AND st.grpid = v.num AND opts.idgroup = st.grpid "
" AND [email protected]_pre2 AND st.cityid != 0 "
" ) as s "
" LEFT JOIN payfactstest AS fact "
" ON s.idopt = fact.idopts AND s.idstud = fact.idstud AND fact.deleted = 0 "
" GROUP BY s.idstud, s.idopt");
//# это февральские предыдущие
mysql_query(mysql,"INSERT old_pay (idstud, idopt, plan, pay) "
" SELECT s.idstud, s.idopt, s.commoncountmoney/2, SUM(COALESCE(fact.moneypay, 0)) - s.commoncountmoney/2 "
" FROM ( "
" SELECT st.id as idstud, opts.id as idopt, opts.commoncountmoney "
" FROM students AS st, payoptstest as opts, voc as v "
" WHERE st.deleted = 0 AND opts.deleted = 0 AND v.deleted = 0 "
" AND v.vkey = 'grp' AND st.grpid = v.num AND opts.idgroup = st.grpid "
" AND [email protected]_pre1 AND st.cityid != 0 "
" ) as s "
" LEFT JOIN payfactstest AS fact "
" ON s.idopt = fact.idopts AND s.idstud = fact.idstud AND fact.deleted = 0 "
" GROUP BY s.idstud, s.idopt");
//# сделаеим для них проверку что бы не было отрицательных оплат
mysql_query(mysql, "UPDATE old_pay SET old_pay.pay = 0 WHERE old_pay.pay < 0 ");
//# это февральские последующие
mysql_query(mysql,"INSERT old_pay (idstud, idopt, plan, pay) "
" SELECT s.idstud, s.idopt, s.commoncountmoney/2, SUM(COALESCE(fact.moneypay, 0)) "
" FROM ( "
" SELECT st.id as idstud, opts.id as idopt, opts.commoncountmoney "
" FROM students AS st, payoptstest as opts, voc as v "
" WHERE st.deleted = 0 AND opts.deleted = 0 AND v.deleted = 0 "
" AND v.vkey = 'grp' AND st.grpid = v.num AND opts.idgroup = st.grpid "
" AND [email protected]_pre3 AND st.cityid != 0 "
" ) as s "
" LEFT JOIN payfactstest AS fact "
" ON s.idopt = fact.idopts AND s.idstud = fact.idstud AND fact.deleted = 0 "
" GROUP BY s.idstud, s.idopt");
//# сделаеим для них проверку что бы не было оплаты больше плана
mysql_query(mysql,"UPDATE old_pay SET old_pay.pay = old_pay.plan WHERE old_pay.pay > old_pay.plan ");
// этап 2
// у стедента могут несколько категорий оплат за текущий период, то есть два сценария поведения
// 1 если хотя бы по одной было заплачено(может быть несколько), то удалить те которые без оплаты
// 2 если ни по одной не заплачено, то оставить только ту которая основная в группе
// найдем студентов у которых проблемы
mysql_query(mysql, "drop temporary table if exists bad_stud");
mysql_query(mysql,
" CREATE TEMPORARY TABLE bad_stud "
" ( "
" id int(11) NOT NULL AUTO_INCREMENT, "
" idstud int(11) NOT NULL, "
" _count int(11) NOT NULL, "
" pay int(11) NOT NULL, "
" INDEX (id), "
" INDEX (idstud) "
" ) TYPE = HEAP ");
mysql_query(mysql,"INSERT bad_stud (idstud, _count, pay) "
" SELECT idstud, COUNT(0) as c, SUM(pay) "
" FROM old_pay "
" GROUP BY idstud "
" HAVING c > 1");
// найдем котагории которые являются для проблемных студентов основными
mysql_query(mysql, "drop temporary table if exists main_opt");
mysql_query(mysql,
" CREATE TEMPORARY TABLE main_opt "
" ( "
" id int(11) NOT NULL AUTO_INCREMENT, "
//.........这里部分代码省略.........