本文整理汇总了C++中Converter::to方法的典型用法代码示例。如果您正苦于以下问题:C++ Converter::to方法的具体用法?C++ Converter::to怎么用?C++ Converter::to使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Converter
的用法示例。
在下文中一共展示了Converter::to方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fetch_master_status
bool fetch_master_status(tcp::socket *socket, std::string *filename, unsigned long *position)
{
asio::streambuf server_messages;
std::ostream command_request_stream(&server_messages);
Protocol_chunk<uint8_t> prot_command(COM_QUERY);
command_request_stream << prot_command
<< "SHOW MASTER STATUS";
int size=server_messages.size();
char command_packet_header[4];
write_packet_header(command_packet_header, size, 0);
// Send the request.
asio::write(*socket, asio::buffer(command_packet_header, 4), asio::transfer_at_least(4));
asio::write(*socket, server_messages, asio::transfer_at_least(size));
Result_set result_set(socket);
Converter conv;
for(Result_set::iterator it = result_set.begin();
it != result_set.end();
it++)
{
Row_of_fields row(*it);
*filename= "";
conv.to(*filename, row[0]);
long pos;
conv.to(pos, row[1]);
*position= (unsigned long)pos;
}
return false;
}
示例2: fetch_master_status
bool fetch_master_status(tcp::socket *socket, std::string *filename, unsigned long *position)
{
boost::asio::streambuf server_messages;
std::ostream command_request_stream(&server_messages);
static boost::uint8_t com_query = COM_QUERY;
Protocol_chunk<boost::uint8_t> prot_command(com_query);
command_request_stream << prot_command
<< "SHOW MASTER STATUS";
int size=server_messages.size();
char command_packet_header[4];
write_packet_header(command_packet_header, size, 0);
// Send the request.
boost::asio::write(*socket, boost::asio::buffer(command_packet_header, 4), boost::asio::transfer_at_least(4));
boost::asio::write(*socket, server_messages, boost::asio::transfer_at_least(size));
Result_set result_set(socket);
Converter conv;
BOOST_FOREACH(Row_of_fields row, result_set)
{
*filename= "";
conv.to(*filename, row[0]);
long pos;
conv.to(pos, row[1]);
*position= (unsigned long)pos;
}
示例3: fetch_binlogs_name_and_size
bool fetch_binlogs_name_and_size(tcp::socket *socket, std::map<std::string, unsigned long> &binlog_map)
{
asio::streambuf server_messages;
std::ostream command_request_stream(&server_messages);
Protocol_chunk<uint8_t> prot_command(COM_QUERY);
command_request_stream << prot_command
<< "SHOW BINARY LOGS";
int size=server_messages.size();
char command_packet_header[4];
write_packet_header(command_packet_header, size, 0);
// Send the request.
asio::write(*socket, asio::buffer(command_packet_header, 4), asio::transfer_at_least(4));
asio::write(*socket, server_messages, asio::transfer_at_least(size));
Result_set result_set(socket);
Converter conv;
for(Result_set::iterator it = result_set.begin();
it != result_set.end();
it++)
{
Row_of_fields row(*it);
std::string filename;
long position;
conv.to(filename, row[0]);
conv.to(position, row[1]);
binlog_map.insert(std::make_pair<std::string, unsigned long>(filename, (unsigned long)position));
}
return false;
}
示例4: fetch_master_status
bool Binlog_tcp_driver::fetch_master_status(tcp::socket *socket, std::string *filename, unsigned long *position)
{
boost::asio::streambuf server_messages;
std::ostream command_request_stream(&server_messages);
static boost::uint8_t com_query = COM_QUERY;
Protocol_chunk<boost::uint8_t> prot_command(com_query);
command_request_stream << prot_command
<< "SHOW MASTER STATUS";
int size=server_messages.size();
char command_packet_header[4];
write_packet_header(command_packet_header, size, 0);
try {
// Send the request.
boost::asio::write(*socket, boost::asio::buffer(command_packet_header, 4), boost::asio::transfer_at_least(4));
boost::asio::write(*socket, server_messages, boost::asio::transfer_at_least(size));
}
catch(boost::system::error_code const& e)
{
throw(ListenerException(std::string("Show master status failed: ") + e.message(), __FILE__, __LINE__));
}
Result_set result_set(socket);
Converter conv;
BOOST_FOREACH(Row_of_fields row, result_set)
{
*filename= "";
conv.to(*filename, row[0]);
long pos;
conv.to(pos, row[1]);
*position= (unsigned long)pos;
}