• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IntToString函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中IntToString函数的典型用法代码示例。如果您正苦于以下问题:C++ IntToString函数的具体用法?C++ IntToString怎么用?C++ IntToString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了IntToString函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
    }
}
开发者ID:davidand36,项目名称:libEpsilonDelta,代码行数:16,代码来源:MySQLLibrary.cpp


示例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);
}
开发者ID:HiPiH,项目名称:Oreka,代码行数:47,代码来源:Iax2Session.cpp


示例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;
   }
}
开发者ID:BackupTheBerlios,项目名称:enetwork,代码行数:17,代码来源:Msg_SQ.cpp


示例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;
}
开发者ID:rocky2shi,项目名称:NoteSrv,代码行数:47,代码来源:Page_Download.cpp


示例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;
    }    
}
开发者ID:ARSrabon,项目名称:phpdesktop,代码行数:17,代码来源:file_utils.cpp


示例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;
}
开发者ID:Dabil,项目名称:puNES,代码行数:17,代码来源:NsisIn.cpp


示例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);
}
开发者ID:HiPiH,项目名称:Oreka,代码行数:17,代码来源:Iax2Session.cpp


示例8: AlgorithmName

DecodingResult TF_DecryptorBase::Decrypt(RandomNumberGenerator &rng, const byte *ciphertext, size_t ciphertextLength, byte *plaintext, const NameValuePairs &parameters) 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);
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:17,代码来源:pubkey.cpp


示例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_;
}
开发者ID:dhk-room101,项目名称:da2ue4,代码行数:17,代码来源:plot_h.cpp


示例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_++;
	
}
开发者ID:carl0967,项目名称:Densan,代码行数:17,代码来源:Player.cpp


示例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;
}
开发者ID:zatoichi666,项目名称:Project4,代码行数:46,代码来源:Sockets.cpp


示例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

	}
}
开发者ID:achen889,项目名称:Warlockery_Engine,代码行数:45,代码来源:NetworkSession.cpp


示例13: BenchMarkByName2

void BenchMarkByName2(const char *factoryName, size_t keyLength = 0, const char *displayName=NULLPTR, const NameValuePairs &params = 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)));
}
开发者ID:KayEss,项目名称:fost-crypto,代码行数:18,代码来源:bench1.cpp


示例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
}
开发者ID:304471720,项目名称:spring,代码行数:18,代码来源:Misc.cpp


示例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;
}
开发者ID:davidand36,项目名称:libEpsilonDelta,代码行数:44,代码来源:PostgreSQLDatabase.cpp


示例16: MHDog

bool TDogUnit::ReadDogSN(long * Info)
{
	long CurrentNo;
	pmhp->Command = 5;

	iRetValue = MHDog(pmhp);
	CurrentNo = *(long *)pmhp->DogData;

	if ( iRetValue != 0 )
	{
		LOG4CXX_ERROR(LOG.rootLog, ("GetCurrentNo function return code is " + IntToString(iRetValue)).c_str());
		return false;
	}
	else
	{
		*Info = CurrentNo;
		return true;
	}
}
开发者ID:neohan,项目名称:Alcatel-SMSNoty-BL,代码行数:19,代码来源:DogUnit.cpp


示例17: PrintObject

void CBaseObject::ValidateInitCalled(void)
{
	CChars	szObject;

	if (miPreInits != miPostInits)
	{
		szObject.Init();
		PrintObject(&szObject, IsEmbedded());
		gcLogger.Error2(__METHOD__, " Object {", szObject.Text(), "} has pre-inits [", IntToString(miPreInits), "] not equal to post inits [", IntToString(miPostInits), "].", NULL);
		szObject.Kill();
	}
	else if (miPreInits == 0)
	{
		szObject.Init();
		PrintObject(&szObject, IsEmbedded());
		gcLogger.Error2(__METHOD__, " Object {", szObject.Text(), "} has a pre-init of zero.", NULL);
		szObject.Kill();
	}
}
开发者ID:chrisjaquet,项目名称:Codaphela.Library,代码行数:19,代码来源:BaseObject.cpp


示例18: if

void CObject::SetPointedTosDistToRoot(int iDistToRoot)
{
	int				i;
	CBaseObject*	pcPointedTo;
	CPointer**		ppPointer;
	int				iNumPointers;
	CBaseObject*	pcContainer;

	if (iDistToRoot >= ROOT_DIST_TO_ROOT)
	{
		iNumPointers = mapPointers.NumElements();

		for (i = 0; i < iNumPointers; i++)
		{
			ppPointer = mapPointers.Get(i);
			pcPointedTo = (**ppPointer).BaseObject();
			if (pcPointedTo)
			{
				pcContainer = pcPointedTo->GetEmbeddingContainer();
				pcContainer->SetExpectedDistToRoot(iDistToRoot + 1);
			}
		}
	}
	else if (iDistToRoot == UNATTACHED_DIST_TO_ROOT)
	{
		iNumPointers = mapPointers.NumElements();

		for (i = 0; i < iNumPointers; i++)
		{
			ppPointer = mapPointers.Get(i);
			pcPointedTo = (**ppPointer).BaseObject();
			if (pcPointedTo)
			{
				pcContainer = pcPointedTo->GetEmbeddingContainer();
				pcContainer->SetCalculatedDistToRoot();
			}
		}
	}
	else
	{
		gcLogger.Error2(__METHOD__, "Don't know how to set dist to root to [", IntToString(iDistToRoot), "].", NULL);
	}
}
开发者ID:andrewpaterson,项目名称:Codaphela.Library,代码行数:43,代码来源:Object.cpp


示例19: is

string Area::get_directory() {
  string filename = (*this).conference_path + "/data/paths.dat";
  ifstream is(filename.c_str(), ios::in);
    
  if(is.fail()) {
    throw runtime_error("Cannot read " + filename);
  }
    
  char buf[256];
  for(int i = 1; i <= (*this).directory; ++i) {
    is.getline(buf, 256);
     
    if(is.fail() || is.eof()) {
      throw runtime_error("Cannot find dir for " + (*this).conference_path + " " + IntToString(i));
    }
  }
  
  return buf;
}
开发者ID:ryanfantus,项目名称:daydream,代码行数:19,代码来源:cfg.cpp


示例20: IntToString

void Shape::collectOrb(PhysicsActor* orb) {
  String orb_name = orb->GetName();
  sysLog.Log("Collected Orb: " + orb_name);
  _inventory->add_orb();

  int num_orbs = _inventory->total_orbs();

  String s = "Total orbs: " + IntToString(num_orbs);
  sysLog.Log(s);

  theSound.PlaySound(_orbSound, 1.0f);

  if (num_orbs == 6) {
    TextActor* t = new TextActor("Console", "You beat the game!", TXT_Center);
    Vector2 blocky_pos = GetPosition();
    t->SetPosition(blocky_pos.X, blocky_pos.Y + 5.0f);
    theWorld.Add(t, 2);
  }
}
开发者ID:nofxboy1234,项目名称:sa,代码行数:19,代码来源:Shape.cpp



注:本文中的IntToString函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IntType函数代码示例发布时间:2022-05-30
下一篇:
C++ IntSize函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap