当前位置: 首页>>代码示例>>C++>>正文


C++ BBWinNet::Message方法代码示例

本文整理汇总了C++中BBWinNet::Message方法的典型用法代码示例。如果您正苦于以下问题:C++ BBWinNet::Message方法的具体用法?C++ BBWinNet::Message怎么用?C++ BBWinNet::Message使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BBWinNet的用法示例。


在下文中一共展示了BBWinNet::Message方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: myfile

void 	UploadMessage(int argc, char *argv[], BBWinNet & bbobj)
{
	cout << "Uploading message ...\n";
	try {
		string res;
		ostringstream 	tosend;
        string line;

		ifstream myfile ( argv[3] );

		if (myfile.is_open())
		{
			while (! myfile.eof() )
			{
				getline (myfile,line);
				tosend << line << endl;
			}
			myfile.close();
		}
		else cout << "Unable to open file"; 

		bbobj.Message(tosend.str(), res);
		cout << "Uploading message done !" ;
		cout << "\n" << res << "\n\n";
		
	} catch (BBWinNetException ex) {
		cout << "Error : " << ex.getMessage() << "\n";
	}
}
开发者ID:CodeAndLoathing,项目名称:bbwin,代码行数:29,代码来源:BBWinCmd.cpp

示例2: catch

void 	Message(int argc, char *argv[], BBWinNet & bbobj)
{
	cout << "Sending message ...\n";
	try {
		string res;
		
		bbobj.Message(argv[3], res);
		cout << "\n" << res << "\n\n";
	} catch (BBWinNetException ex) {
		cout << "Error : " << ex.getMessage() << "\n";
	}
}
开发者ID:CodeAndLoathing,项目名称:bbwin,代码行数:12,代码来源:BBWinCmd.cpp

示例3: iss

void		BBWinAgentManager::Message(LPCTSTR message, LPTSTR dest, DWORD size) {
	bbdisplay_t::iterator			itr;
	BBWinNet	hobNet;
	string		result;

	assert(message != NULL);
	assert(dest != NULL);
	if (m_usepager == true && m_bbpager.size() > 0) { // extract the information needed to send pager notification
		string		tmp, type, testName, color, text, lifeTime;
		size_t		pos = 0;

		tmp = message;
		istringstream iss(tmp);
		std::getline( iss, tmp);
		size_t res = tmp.find_first_of(" ");
		if (res > 0 && res < tmp.length()) {
			
			type = tmp.substr(0, res);
			res = type.find_first_of("status");
			if (res >= 0 && res < tmp.length()) {
				size_t	end;
				
				tmp = tmp.substr(type.length() + 1);
				pos += type.length() + 1;
				res = type.find_first_of("+");
				if (res > 0 && res < type.length()) {
					lifeTime = type.substr(res + 1);
				}
				res = tmp.find_first_of(".");
				end = tmp.find_first_of(" ");
				testName = tmp.substr(res + 1, end - (res + 1));
				tmp = tmp.substr(end + 1);
				pos += end + 1;
				end = tmp.find_first_of(" ");
				color = tmp.substr(0, end);
				if (tmp.length() > (end + 2)) {
					pos += end + 2;
					text = message;
					text = text.substr(pos);
					Pager(testName.c_str(), color.c_str(), text.c_str(), lifeTime.c_str());
				}
			}
		}
	}
	for ( itr = m_bbdisplay.begin(); itr != m_bbdisplay.end(); ++itr) {
		hobNet.SetBBDisplay((*itr));
		PrepareBBWinNetObj(hobNet);
		try {
			hobNet.Message(message, result);
		} catch (BBWinNetException ex) {
			if (m_logReportFailure) {
				string mes;
			
				mes = "Sending report to " + (*itr) + " failed.";
				LPCTSTR		arg[] = {m_agentName.c_str(), mes.c_str(), NULL};
				m_log->reportWarnEvent(BBWIN_AGENT, EVENT_MESSAGE_AGENT, 2, arg);
			}
			continue ; 
		}
	}
	try
	{
		if (dest != NULL && size != 0)
			strncpy(dest, result.c_str(), size);
	}
	catch (...)
	{
		// Failed to write
	}
}
开发者ID:tjyang,项目名称:abmon,代码行数:70,代码来源:BBWinAgentManager.cpp


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