本文整理汇总了C++中IntToString函数的典型用法代码示例。如果您正苦于以下问题:C++ IntToString函数的具体用法?C++ IntToString怎么用?C++ IntToString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IntToString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mysql_library_init
void
MySQLLibrary::Init( )
{
if ( ! m_initialized )
{
int initRslt = mysql_library_init( 0, 0, 0 );
if ( initRslt != 0 )
{
string msg( "mysql_library_init returned " );
msg += IntToString( initRslt );
MySQLException exception( msg );
throw exception;
}
m_initialized = true;
}
}
示例2: sizeof
void Iax2Sessions::ReportIax2New(Iax2NewInfoRef& invite)
{
char szFromIax2Ip[16];
std::map<CStdString, Iax2SessionRef>::iterator pair;
ACE_OS::inet_ntop(AF_INET, (void*)&invite->m_senderIp, szFromIax2Ip, sizeof(szFromIax2Ip));
CStdString IpAndCallNo = CStdString(szFromIax2Ip) + "," + invite->m_callNo;
pair = m_bySrcIpAndCallNo.find(IpAndCallNo);
if (pair != m_bySrcIpAndCallNo.end()) {
// The session already exists, check the state
CStdString logmsg;
Iax2SessionRef session = pair->second;
if(session.get() != NULL) {
if(session->m_iax2_state == IAX2_STATE_UP) {
CStdString log_msg;
log_msg.Format("[%s] is in the UP state but we've "
"got another NEW from this same IP %s and same "
"source call number %s", session->m_trackingId,
szFromIax2Ip, invite->m_callNo);
LOG4CXX_ERROR(m_log, log_msg);
return;
}
}
/* Stop this session and proceed */
Stop(session);
}
/* Create a new session */
CStdString trackingId = m_alphaCounter.GetNext();
Iax2SessionRef session(new Iax2Session(trackingId));
session->m_srcIpAndCallNo = IpAndCallNo;
session->ReportIax2New(invite);
m_bySrcIpAndCallNo.insert(std::make_pair(session->m_srcIpAndCallNo, session));
CStdString numSessions = IntToString(m_bySrcIpAndCallNo.size());
LOG4CXX_DEBUG(m_log, CStdString("BySrcIpAndCallNo: ") + numSessions);
CStdString inviteString;
invite->ToString(inviteString);
LOG4CXX_INFO(m_log, "[" + trackingId + "] created by IAX2 NEW:" + inviteString + " for " + session->m_srcIpAndCallNo);
}
示例3: Parser
void Msg_SQ::Parser()
{
Server* ServerPtr = Network::Interface.FindServerByName(Parameters[0]);
if (NULL == ServerPtr)
{
debug << "Error: Trying to SQ server " << Parameters[0] << ". Server doesn't exist in db." << endb;
return;
}
if (Parameters[1] == IntToString(ServerPtr->GetLinkTime()) || Parameters[1] == "0")
{
if (!Network::Interface.DelServerByNumeric(ServerPtr->GetNumeric()))
debug << "Could not delete server " << Parameters[0] << endb;
}
}
示例4: FUNCTION_TRACK
// 输出http协议头部
int Page_Download::OutHead()
{
FUNCTION_TRACK(); // 函数轨迹跟综
Connect * const connect = m_request->GetConnect();
string filename = m_request->GetField("file");
string fullpath = "";
/*
* 打开用户文件,如:
* http://192.168.1.100:17890/download?file=logo.gif
*/
const string &username = m_request->GetCurrentUser();
const string &key = GetCurrentKey();
User *user = User::Get( username );
fullpath = user->AttachDir() + key + "." + filename;
LOG_DEBUG("file=[%s]", fullpath.c_str());
if( "" == filename || !m_file.Open(fullpath) )
{
Page::OutHead();
const string str = HtmlAlert("没有文件: " + filename + ",可能文件已被删除。");
LOG_ERROR("Can't open file: [%s]", fullpath.c_str());
// 发送到浏览器
connect->Send(str);
return ERR;
}
const string &size = IntToString(m_file.Size());
// 文件下载头部格式
const string html = ""
"HTTP/1.1 200 OK\n"
"Accept-Ranges: bytes\n"
"Content-Disposition: attachment; filename=\"" + FilenameDecode(filename) + "\"\n"
"Content-length: " + size + "\n"
"Connection: Keep-Alive\n"
"Content-Type: application/ms-excel\n"
"\n";
// 发送
return connect->Send(html) == html.length() ? OK : ERR;
}
示例5: IsDirectoryWritable
bool IsDirectoryWritable(std::string directory) {
int rand = random(0, 1000000);
std::string tempFile = directory.append("\\phpdesktop")\
.append(IntToString(rand)).append(".tmp");
HANDLE handle = CreateFile(Utf8ToWide(tempFile).c_str(),
GENERIC_WRITE,
(FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE),
NULL, OPEN_ALWAYS,
(FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE),
NULL);
if (handle == INVALID_HANDLE_VALUE) {
return false;
} else {
CloseHandle(handle);
return true;
}
}
示例6: IntToString
AString CInArchive::ReadStringA(UInt32 pos) const
{
AString s;
if (pos >= _size)
return IntToString((Int32)pos);
UInt32 offset = GetOffset() + _stringsPos + pos;
for (;;)
{
if (offset >= _size)
break; // throw 1;
char c = _data[offset++];
if (c == 0)
break;
s += c;
}
return s;
}
示例7: startEvent
void Iax2Session::Start()
{
CaptureEventRef startEvent(new CaptureEvent);
m_started = true;
time(&m_beginDate);
GenerateOrkUid();
startEvent->m_type = CaptureEvent::EtStart;
startEvent->m_timestamp = m_beginDate;
startEvent->m_value = m_trackingId;
CStdString timestamp = IntToString(startEvent->m_timestamp);
LOG4CXX_INFO(m_log, "[" + m_trackingId + "] " + m_capturePort + " " +
IAX2_PROTOCOL_STR + " Session start, timestamp:" + timestamp);
g_captureEventCallBack(startEvent, m_capturePort);
}
示例8: AlgorithmName
DecodingResult TF_DecryptorBase::Decrypt(RandomNumberGenerator &rng, const byte *ciphertext, size_t ciphertextLength, byte *plaintext, const NameValuePairs ¶meters) const
{
if (ciphertextLength != FixedCiphertextLength())
{
char Name[128] = "";
AlgorithmName(Name);
throw InvalidArgument(std::string(Name) + ": ciphertext length of " + IntToString(ciphertextLength) + " doesn't match the required length of " + IntToString(FixedCiphertextLength()) + " for this key");
//throw InvalidArgument(AlgorithmName() + ": ciphertext length of " + IntToString(ciphertextLength) + " doesn't match the required length of " + IntToString(FixedCiphertextLength()) + " for this key");
}
SecByteBlock paddedBlock(PaddedBlockByteLength());
Integer x = GetTrapdoorFunctionInterface().CalculateInverse(rng, Integer(ciphertext, ciphertextLength));
if (x.ByteCount() > paddedBlock.size())
x = Integer::Zero(); // don't return false here to prevent timing attack
x.Encode(paddedBlock, paddedBlock.size());
return GetMessageEncodingInterface().Unpad(paddedBlock, PaddedBlockBitLength(), plaintext, parameters);
}
示例9: SetPlotFlag
int32 SetPlotFlag(int32 plotIndex, int64 nPlotFlag, int32 nPlotValue)
{
//update the actual Plot table in Party
for (int32 j = 0; j < GetParty()->Plots[plotIndex].StatusList.Num(); j++)
{
if (GetParty()->Plots[plotIndex].StatusList[j].pNode.Flag == nPlotFlag)
{
GetParty()->Plots[plotIndex].StatusList[j].pValue = nPlotValue;
return TRUE_;
}
}
#ifdef DEBUG
LogError("SetPlotFlag: plot not found with flag " + IntToString(nPlotFlag));
#endif // DEBUG
return FALSE_;
}
示例10: NextMap
void Player::NextMap(){
//次のマップ名をstringで作成
string str=map_name_;
str.insert(8,"-");
str.insert(9,(IntToString(next_map_count_)));
//char型に変換
int len = str.length();
char* c = new char[len+1];
memcpy(c, str.c_str(), len+1);
next_map_=c;
next_map_flag_ = true;
next_map_count_++;
}
示例11: SocketSystem
bool Socket::connect(std::string url, int port, bool throwError, size_t MaxTries)
{
try {
if(isalpha(url[0]))
url = SocketSystem().getIpFromName(url);
}
catch(...)
{
if(throwError)
throw std::exception(ss_.GetLastMsg(true).c_str());
return false;
}
SOCKADDR_IN tcpAddr;
tcpAddr.sin_family = AF_INET;
tcpAddr.sin_addr.s_addr = inet_addr(url.c_str());
tcpAddr.sin_port = htons(port);
if(s_ == INVALID_SOCKET)
{
s_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
}
size_t tryCount = 0;
std::string countStr;
while(true)
{
++tryCount;
TRACE("attempt to connect #" + IntToString(tryCount));
int err = ::connect(s_, (sockaddr*)&tcpAddr, sizeof(tcpAddr));
//std::string rip = System().getRemoteIP(this);
int rport = System().getRemotePort(this);
// error return from connect does not appear to be reliable
if(err != SOCKET_ERROR && rport != -1)
break;
if(tryCount >= MaxTries)
{
if(throwError)
throw std::exception(ss_.GetLastMsg(true).c_str());
return false;
}
::Sleep(100);
}
TRACE("I believe we are connected to " + url);
return true;
}
示例12: while
void NetworkSession::UpdateIncomingInOrderTrafficForConn(NetConnection* conn, NetMessages& incomingMessages, NetSender* netSenderForPacket) {
if (conn) {
//pop messages off the order list
while (conn->m_incomingOrderedReliables.size() > 0) {
NetMessage orderedMsg = (NetMessage)conn->m_incomingOrderedReliables.top();
incomingMessages.push_back(orderedMsg);
conn->m_incomingOrderedReliables.pop();
}
//add the msgs to the in order list
for (NetMessagesIterator it = incomingMessages.begin(); it != incomingMessages.end(); ) {
NetMessage& msg = (*it);
if (msg.IsInOrder()) {
std::string inOrderDebugString;
inOrderDebugString += "conn: " + conn->GetName();
inOrderDebugString += "nextIncomingOrderID: " + IntToString(conn->m_nextIncomingOrderID);
//if match, process as normal and increment orderID
if (msg.GetOrderID() == conn->m_nextIncomingOrderID) {
conn->m_nextIncomingOrderID++;
if (conn->m_nextIncomingOrderID > BIT(16)) {
conn->m_nextIncomingOrderID = 0;
}
ProcessMessage(netSenderForPacket, msg);
it = incomingMessages.erase(it);
continue;
}
else {
//save it off to process later
conn->m_incomingOrderedReliables.push(msg);
it = incomingMessages.erase(it);
}//end of inner if/else
}//end of if
else {
++it;
}
}//end of for
}
}
示例13: BenchMarkByName2
void BenchMarkByName2(const char *factoryName, size_t keyLength = 0, const char *displayName=NULLPTR, const NameValuePairs ¶ms = g_nullNameValuePairs)
{
std::string name(factoryName ? factoryName : "");
member_ptr<T_FactoryOutput> obj(ObjectFactoryRegistry<T_FactoryOutput>::Registry().CreateObject(name.c_str()));
if (!keyLength)
keyLength = obj->DefaultKeyLength();
if (displayName)
name = displayName;
else if (keyLength)
name += " (" + IntToString(keyLength * 8) + "-bit key)";
const int blockSize = params.GetIntValueWithDefault(Name::BlockSize(), 0);
obj->SetKey(defaultKey, keyLength, CombinedNameValuePairs(params, MakeParameters(Name::IV(), ConstByteArrayParameter(defaultKey, blockSize ? blockSize : obj->IVSize()), false)));
BenchMark(name.c_str(), *static_cast<T_Interface *>(obj.get()), g_allocatedTime);
BenchMarkKeying(*obj, keyLength, CombinedNameValuePairs(params, MakeParameters(Name::IV(), ConstByteArrayParameter(defaultKey, blockSize ? blockSize : obj->IVSize()), false)));
}
示例14: IsRunningInGDB
bool IsRunningInGDB() {
#ifndef _WIN32
char buf[1024];
std::string fname = "/proc/" + IntToString(getppid(), "%d") + "/cmdline";
std::ifstream f(fname.c_str());
if (!f.good())
return false;
f.read(buf, sizeof(buf));
f.close();
return (strstr(buf, "gdb") != NULL);
#else
return false;
#endif
}
示例15: ShowTypeOids
void
ShowTypeOids( SQLDatabase * pDB )
{
const string typeNames[]
= { //integer
"smallint", "integer", "serial",
//long int
"bigint", "bigserial",
//real
"real", "double precision", "decimal", "numeric",
//text
"text", "char(10)", "varchar(100)",
//blob
"bytea",
//date
"date",
//time
"time",
//datetime
"timestamp"
};
string command = "CREATE TABLE Types ( ";
for ( int i = 0; i < ARRAYSIZE( typeNames ); ++i )
{
if ( i != 0 )
command += ", ";
command += "f" + IntToString( i ) + " " + typeNames[i];
}
command += " )";
pDB->DoCommand( command );
string query = "SELECT * FROM Types";
SQLResult * result = pDB->DoQuery( query );
cout << endl << "Type Oids:" << endl;
for ( int i = 0; i < ARRAYSIZE( typeNames ); ++i )
{
cout << typeNames[i] << ": ";
//Relies on FieldType displaying the Oid for this purpose.
result->FieldType( i );
}
cout << endl;
}