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


C++ optional::message方法代码示例

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


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

示例1: run_test

void run_test(std::string const& url, int size, int status, int connected
	, boost::optional<error_code> ec, proxy_settings const& ps)
{
	reset_globals();

	std::cerr << " ===== TESTING: " << url << " =====" << std::endl;

	std::cerr << " expecting: size: " << size
		<< " status: " << status
		<< " connected: " << connected
		<< " error: " << (ec?ec->message():"no error") << std::endl;

	boost::shared_ptr<http_connection> h(new http_connection(ios, cq
		, &::http_handler, true, &::http_connect_handler));
	h->get(url, seconds(1), 0, &ps);
	ios.reset();
	error_code e;
	ios.run(e);

	std::cerr << "connect_handler_called: " << connect_handler_called << std::endl;
	std::cerr << "handler_called: " << handler_called << std::endl;
	std::cerr << "status: " << http_status << std::endl;
	std::cerr << "size: " << data_size << std::endl;
	std::cerr << "error_code: " << g_error_code.message() << std::endl;
	TEST_CHECK(connect_handler_called == connected);
	TEST_CHECK(handler_called == 1);	
	TEST_CHECK(data_size == size || size == -1);
	TEST_CHECK(!ec || g_error_code == *ec);
	TEST_CHECK(http_status == status || status == -1);
}
开发者ID:SiderZhang,项目名称:p2pns3,代码行数:30,代码来源:test_http_connection.cpp

示例2: run_test

void run_test(std::string const& url, int size, int status, int connected
	, boost::optional<error_code> ec, aux::proxy_settings const& ps
	, std::string const& auth = std::string())
{
	reset_globals();

	std::cerr << " ===== TESTING: " << url << " =====" << std::endl;

	std::cerr << time_now_string()
		<< " expecting: size: " << size
		<< " status: " << status
		<< " connected: " << connected
		<< " error: " << (ec?ec->message():"no error") << std::endl;

	boost::shared_ptr<http_connection> h(new http_connection(ios
		, res, &::http_handler, true, 1024*1024, &::http_connect_handler));
	h->get(url, seconds(1), 0, &ps, 5, "test/user-agent", address_v4::any()
		, 0, auth);
	ios.reset();
	error_code e;
	ios.run(e);
	if (e) std::cerr << time_now_string() << " run failed: " << e.message() << std::endl;

	std::cerr << time_now_string() << " connect_handler_called: " << connect_handler_called << std::endl;
	std::cerr << time_now_string() << " handler_called: " << handler_called << std::endl;
	std::cerr << time_now_string() << " status: " << http_status << std::endl;
	std::cerr << time_now_string() << " size: " << data_size << std::endl;
	std::cerr << time_now_string() << " expected-size: " << size << std::endl;
	std::cerr << time_now_string() << " error_code: " << g_error_code.message() << std::endl;
	TEST_CHECK(connect_handler_called == connected);
	TEST_CHECK(handler_called == 1);
	TEST_CHECK(data_size == size || size == -1);
	TEST_CHECK(!ec || g_error_code == *ec);
	TEST_CHECK(http_status == status || status == -1);
}
开发者ID:Athorcis,项目名称:libtorrent,代码行数:35,代码来源:test_http_connection.cpp

示例3: async_on_serv_error

void toy_ca_t::async_on_serv_error(boost::optional<boost::system::error_code const&> const& error, boost::optional<std::string const&> const& srt_msg){
	std::string msg("[serv]");
	if(error){
		msg.append("[").append(error->message()).append("]");
	}
	if(srt_msg){
		msg.append("[").append(*srt_msg).append("]");
	}

	post_log_message_(msg);

}
开发者ID:abelepereira,项目名称:stcrypt,代码行数:12,代码来源:toy_ca_t.cpp


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