本文整理汇总了C++中aux::stack_allocator类的典型用法代码示例。如果您正苦于以下问题:C++ stack_allocator类的具体用法?C++ stack_allocator怎么用?C++ stack_allocator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了stack_allocator类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: if
torrent_alert::torrent_alert(aux::stack_allocator& alloc
, torrent_handle const& h)
: handle(h)
, m_alloc(alloc)
{
std::string name_str;
if (h.native_handle())
{
m_name_idx = alloc.copy_string(h.native_handle()->name());
}
else if (h.is_valid())
{
char msg[41];
to_hex(h.native_handle()->info_hash().data(), 20, msg);
m_name_idx = alloc.copy_string(msg);
}
else
{
m_name_idx = alloc.copy_string("");
}
#ifndef TORRENT_NO_DEPRECATE
name = torrent_name();
#endif
}
开发者ID:kevindhawkins,项目名称:libtorrent,代码行数:25,代码来源:alert.cpp
示例2: handle
torrent_alert::torrent_alert(aux::stack_allocator& alloc
, torrent_handle const& h)
: handle(h)
, m_alloc(alloc)
{
boost::shared_ptr<torrent> t = h.native_handle();
if (t)
{
std::string name_str = t->name();
if (!name_str.empty()) {
m_name_idx = alloc.copy_string(name_str);
}
else
{
char msg[41];
to_hex(t->info_hash().data(), 20, msg);
m_name_idx = alloc.copy_string(msg);
}
}
else
{
m_name_idx = alloc.copy_string("");
}
#ifndef TORRENT_NO_DEPRECATE
name = torrent_name();
#endif
}
开发者ID:microIBM,项目名称:libtorrent,代码行数:28,代码来源:alert.cpp
示例3: userdata
dht_direct_response_alert::dht_direct_response_alert(
aux::stack_allocator& alloc, void* userdata_
, udp::endpoint const& addr_, bdecode_node const& response)
: userdata(userdata_), addr(addr_), m_alloc(alloc)
, m_response_idx(alloc.copy_buffer(response.data_section().first, response.data_section().second))
, m_response_size(response.data_section().second)
{}
开发者ID:microIBM,项目名称:libtorrent,代码行数:7,代码来源:alert.cpp
示例4: msg
portmap_log_alert::portmap_log_alert(aux::stack_allocator& alloc, int t, const char* m)
: map_type(t)
#ifndef TORRENT_NO_DEPRECATE
, msg(m)
#endif
, m_alloc(alloc)
, m_log_idx(alloc.copy_string(m))
{}
开发者ID:kevindhawkins,项目名称:libtorrent,代码行数:8,代码来源:alert.cpp
示例5: path
storage_moved_alert::storage_moved_alert(aux::stack_allocator& alloc
, torrent_handle const& h, std::string const& p)
: torrent_alert(alloc, h)
#ifndef TORRENT_NO_DEPRECATE
, path(p)
#endif
, m_path_idx(alloc.copy_string(p))
{}
开发者ID:kevindhawkins,项目名称:libtorrent,代码行数:8,代码来源:alert.cpp
示例6: dir
dht_pkt_alert::dht_pkt_alert(aux::stack_allocator& alloc
, char const* buf, int size, dht_pkt_alert::direction_t d, udp::endpoint ep)
: dir(d)
, node(ep)
, m_alloc(alloc)
, m_msg_idx(alloc.copy_buffer(buf, size))
, m_size(size)
{}
开发者ID:kevindhawkins,项目名称:libtorrent,代码行数:8,代码来源:alert.cpp
示例7: url
tracker_alert::tracker_alert(aux::stack_allocator& alloc
, torrent_handle const& h
, std::string const& u)
: torrent_alert(alloc, h)
#ifndef TORRENT_NO_DEPRECATE
, url(u)
#endif
, m_url_idx(alloc.copy_string(u))
{}
开发者ID:kevindhawkins,项目名称:libtorrent,代码行数:9,代码来源:alert.cpp
示例8: sizeof
picker_log_alert::picker_log_alert(aux::stack_allocator& alloc, torrent_handle const& h
, tcp::endpoint const& ep, peer_id const& peer_id, boost::uint32_t flags
, piece_block const* blocks, int num_blocks)
: peer_alert(alloc, h, ep, peer_id)
, picker_flags(flags)
, m_array_idx(alloc.copy_buffer(reinterpret_cast<char const*>(blocks)
, num_blocks * sizeof(piece_block)))
, m_num_blocks(num_blocks)
{}
开发者ID:microIBM,项目名称:libtorrent,代码行数:9,代码来源:alert.cpp
示例9: error
torrent_error_alert::torrent_error_alert(
aux::stack_allocator& alloc
, torrent_handle const& h
, error_code const& e, std::string const& f)
: torrent_alert(alloc, h)
, error(e)
#ifndef TORRENT_NO_DEPRECATE
, error_file(f)
#endif
, m_file_idx(alloc.copy_string(f))
{}
开发者ID:kevindhawkins,项目名称:libtorrent,代码行数:11,代码来源:alert.cpp
示例10: name
file_renamed_alert::file_renamed_alert(aux::stack_allocator& alloc
, torrent_handle const& h
, std::string const& n
, int idx)
: torrent_alert(alloc, h)
#ifndef TORRENT_NO_DEPRECATE
, name(n)
#endif
, index(idx)
, m_name_idx(alloc.copy_string(n))
{}
开发者ID:kevindhawkins,项目名称:libtorrent,代码行数:11,代码来源:alert.cpp
示例11: trackerid
trackerid_alert::trackerid_alert(
aux::stack_allocator& alloc
, torrent_handle const& h
, std::string const& u
, const std::string& id)
: tracker_alert(alloc, h, u)
#ifndef TORRENT_NO_DEPRECATE
, trackerid(id)
#endif
, m_tracker_idx(alloc.copy_string(id))
{}
开发者ID:kevindhawkins,项目名称:libtorrent,代码行数:11,代码来源:alert.cpp
示例12: direction
peer_log_alert::peer_log_alert(aux::stack_allocator& alloc
, torrent_handle const& h
, tcp::endpoint const& i
, peer_id const& pi
, direction_t dir
, char const* event
, char const* log)
: peer_alert(alloc, h, i, pi)
, event_type(event)
, direction(dir)
, m_str_idx(alloc.copy_string(log))
{}
开发者ID:kevindhawkins,项目名称:libtorrent,代码行数:12,代码来源:alert.cpp
示例13: error
listen_failed_alert::listen_failed_alert(
aux::stack_allocator& alloc
, std::string const& iface
, tcp::endpoint const& ep
, int op
, error_code const& ec
, socket_type_t t)
: error(ec)
, operation(op)
, sock_type(t)
, endpoint(ep)
, m_alloc(alloc)
, m_interface_idx(alloc.copy_string(iface))
{}
开发者ID:microIBM,项目名称:libtorrent,代码行数:14,代码来源:alert.cpp
示例14:
dht_get_peers_reply_alert::dht_get_peers_reply_alert(aux::stack_allocator& alloc
, sha1_hash const& ih
, std::vector<tcp::endpoint> const& peers)
: info_hash(ih)
, m_alloc(alloc)
, m_num_peers(peers.size())
{
std::size_t total_size = m_num_peers; // num bytes for sizes
for (int i = 0; i < m_num_peers; i++) {
total_size += peers[i].size();
}
m_peers_idx = alloc.allocate(total_size);
char *ptr = alloc.ptr(m_peers_idx);
for (int i = 0; i < m_num_peers; i++) {
tcp::endpoint endp = peers[i];
std::size_t size = endp.size();
detail::write_uint8(size, ptr);
memcpy(ptr, endp.data(), size);
ptr += size;
}
}
开发者ID:kevindhawkins,项目名称:libtorrent,代码行数:24,代码来源:alert.cpp
示例15: operation
listen_failed_alert::listen_failed_alert(
aux::stack_allocator& alloc
, std::string iface
, int op
, error_code const& ec
, socket_type_t t)
:
#if !defined(TORRENT_NO_DEPRECATE) && !defined(TORRENT_WINRT)
interface(iface),
#endif
error(ec)
, operation(op)
, sock_type(t)
, m_alloc(alloc)
, m_interface_idx(alloc.copy_string(iface))
{}
开发者ID:kevindhawkins,项目名称:libtorrent,代码行数:16,代码来源:alert.cpp
示例16: file
file_error_alert::file_error_alert(aux::stack_allocator& alloc
, error_code const& ec
, std::string const& f
, char const* op
, torrent_handle const& h)
: torrent_alert(alloc, h)
#ifndef TORRENT_NO_DEPRECATE
, file(f)
#endif
, error(ec)
, operation(op)
, m_file_idx(alloc.copy_string(f))
{
#ifndef TORRENT_NO_DEPRECATE
msg = convert_from_native(error.message());
#endif
}
开发者ID:kevindhawkins,项目名称:libtorrent,代码行数:17,代码来源:alert.cpp
示例17: error
fastresume_rejected_alert::fastresume_rejected_alert(
aux::stack_allocator& alloc
, torrent_handle const& h
, error_code const& ec
, std::string const& file
, char const* op)
: torrent_alert(alloc, h)
, error(ec)
#ifndef TORRENT_NO_DEPRECATE
, file(file)
#endif
, operation(op)
, m_path_idx(alloc.copy_string(file))
{
#ifndef TORRENT_NO_DEPRECATE
msg = convert_from_native(error.message());
#endif
}
开发者ID:bendikro,项目名称:libtorrent,代码行数:18,代码来源:alert.cpp
示例18: module
dht_log_alert::dht_log_alert(aux::stack_allocator& alloc
, dht_log_alert::dht_module_t m, const char* msg)
: module(m)
, m_alloc(alloc)
, m_msg_idx(alloc.copy_string(msg))
{}
开发者ID:kevindhawkins,项目名称:libtorrent,代码行数:6,代码来源:alert.cpp
注:本文中的aux::stack_allocator类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论