本文整理汇总了C++中MyString::serialize_int方法的典型用法代码示例。如果您正苦于以下问题:C++ MyString::serialize_int方法的具体用法?C++ MyString::serialize_int怎么用?C++ MyString::serialize_int使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyString
的用法示例。
在下文中一共展示了MyString::serialize_int方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCurrentProcess
bool
SharedPortEndpoint::serialize(MyString &inherit_buf,int &inherit_fd)
{
inherit_buf.serialize_string(m_full_name.c_str());
inherit_buf.serialize_sep("*");
#ifdef WIN32
/*
Serializing requires acquiring the handles of the respective pipes and seeding them into
the buffer.
*/
if (inheritable_to_child && inheritable_to_child != INVALID_HANDLE_VALUE) {
dprintf(D_ALWAYS, "SharedPortEndpoint::serialize called when inheritable_to_child already has a value\n");
CloseHandle(inheritable_to_child); inheritable_to_child = INVALID_HANDLE_VALUE;
}
HANDLE current_process = GetCurrentProcess();
if(!DuplicateHandle(current_process, pipe_end, current_process, &inheritable_to_child, NULL, true, DUPLICATE_SAME_ACCESS))
{
dprintf(D_ALWAYS, "SharedPortEndpoint: Failed to duplicate named pipe for inheritance.\n");
return false;
}
inherit_buf.serialize_int((LONG_PTR)inheritable_to_child);
inherit_buf.serialize_sep("*");
#else
inherit_fd = m_listener_sock.get_file_desc();
ASSERT( inherit_fd != -1 );
char *named_sock_serial = m_listener_sock.serialize();
ASSERT( named_sock_serial );
inherit_buf += named_sock_serial;
delete []named_sock_serial;
#endif
return true;
}