msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const char(&v)[N]) const { char const* p = v; uint32_t size = checked_get_container_size(std::strlen(p)); o.pack_str(size); o.pack_str_body(p, size); return o; }
inline void operator<< (msgpack::object& o, const std::string& v) { uint32_t size = checked_get_container_size(v.size()); o.type = msgpack::type::STR; o.via.str.ptr = v.data(); o.via.str.size = size; }
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const unsigned char(&v)[N]) const { unsigned char const* p = v; uint32_t size = checked_get_container_size(N); o.pack_bin(size); o.pack_bin_body(reinterpret_cast<char const*>(p), size); return o; }
inline msgpack::packer<Stream>& operator<< (msgpack::packer<Stream>& o, const std::string& v) { uint32_t size = checked_get_container_size(v.size()); o.pack_str(size); o.pack_str_body(v.data(), size); return o; }
void operator()(msgpack::object::with_zone& o, const std::vector<T>& v) const { o.type = msgpack::type::ARRAY; if(v.empty()) { o.via.array.ptr = nullptr; o.via.array.size = 0; } else { uint32_t size = checked_get_container_size(v.size()); msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size)); msgpack::object* const pend = p + size; o.via.array.ptr = p; o.via.array.size = size; typename std::vector<T>::const_iterator it(v.begin()); do { #if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif // defined(__GNUC__) && !defined(__clang__) *p = msgpack::object(*it, o.zone); #if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop #endif // defined(__GNUC__) && !defined(__clang__) ++p; ++it; } while(p < pend); } }
clmdep_msgpack::packer<Stream>& operator()(clmdep_msgpack::packer<Stream>& o, const std::array<unsigned char, N>& v) const { uint32_t size = checked_get_container_size(v.size()); o.pack_bin(size); o.pack_bin_body(reinterpret_cast<char const*>(v.data()), size); return o; }
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const std::array<char, N>& v) const { uint32_t size = checked_get_container_size(v.size()); o.pack_bin(size); o.pack_bin_body(v.data(), size); return o; }
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const std::vector<char, Alloc>& v) const { uint32_t size = checked_get_container_size(v.size()); o.pack_bin(size); o.pack_bin_body(&v.front(), size); return o; }
msgpack::packer<Stream>& operator()( msgpack::packer<Stream>& o, const std::tuple<Args...>& v) const { uint32_t size = checked_get_container_size(sizeof...(Args)); o.pack_array(size); StdTuplePacker<Stream, decltype(v), sizeof...(Args)>::pack(o, v); return o; }
void operator()(msgpack::object::with_zone& o, const unsigned char(&v)[N]) const { uint32_t size = checked_get_container_size(N); o.type = msgpack::type::BIN; char* ptr = static_cast<char*>(o.zone.allocate_align(size)); o.via.bin.ptr = ptr; o.via.bin.size = size; std::memcpy(ptr, v, size); }
void operator()(clmdep_msgpack::object::with_zone& o, const std::string& v) const { uint32_t size = checked_get_container_size(v.size()); o.type = clmdep_msgpack::type::STR; char* ptr = static_cast<char*>(o.zone.allocate_align(size)); o.via.str.ptr = ptr; o.via.str.size = size; std::memcpy(ptr, v.data(), v.size()); }
void operator()(clmdep_msgpack::object::with_zone& o, const std::array<unsigned char, N>& v) const { uint32_t size = checked_get_container_size(v.size()); o.type = clmdep_msgpack::type::BIN; char* ptr = static_cast<char*>(o.zone.allocate_align(size)); o.via.bin.ptr = ptr; o.via.bin.size = size; std::memcpy(ptr, v.data(), size); }
void operator()(msgpack::object& o, const std::vector<char, Alloc>& v) const { uint32_t size = checked_get_container_size(v.size()); o.type = msgpack::type::BIN; if (size != 0) { o.via.bin.ptr = &v.front(); } o.via.bin.size = size; }
void operator()(msgpack::object::with_zone& o, const std::vector<char, Alloc>& v) const { uint32_t size = checked_get_container_size(v.size()); o.type = msgpack::type::BIN; char* ptr = static_cast<char*>(o.zone.allocate_align(size)); o.via.bin.ptr = ptr; o.via.bin.size = size; std::memcpy(ptr, &v.front(), size); }
clmdep_msgpack::packer<Stream>& operator()(clmdep_msgpack::packer<Stream>& o, const std::set<T, Compare, Alloc>& v) const { uint32_t size = checked_get_container_size(v.size()); o.pack_array(size); for (typename std::set<T, Compare, Alloc>::const_iterator it(v.begin()), it_end(v.end()); it != it_end; ++it) { o.pack(*it); } return o; }
void operator()( msgpack::object::with_zone& o, std::tuple<Args...> const& v) const { uint32_t size = checked_get_container_size(sizeof...(Args)); o.type = msgpack::type::ARRAY; o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size)); o.via.array.size = size; StdTupleToObjectWithZone<decltype(v), sizeof...(Args)>::convert(o, v); }
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const std::unordered_multiset<T>& v) const { uint32_t size = checked_get_container_size(v.size()); o.pack_array(size); for(typename std::unordered_multiset<T>::const_iterator it(v.begin()), it_end(v.end()); it != it_end; ++it) { o.pack(*it); } return o; }
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const std::unordered_map<K, V, Hash, Compare, Alloc>& v) const { uint32_t size = checked_get_container_size(v.size()); o.pack_map(size); for(typename std::unordered_map<K, V, Hash, Compare, Alloc>::const_iterator it(v.begin()), it_end(v.end()); it != it_end; ++it) { o.pack(it->first); o.pack(it->second); } return o; }
clmdep_msgpack::packer<Stream>& operator()(clmdep_msgpack::packer<Stream>& o, const MSGPACK_STD_TR1::unordered_multimap<K, V, Hash, Pred, Alloc>& v) const { uint32_t size = checked_get_container_size(v.size()); o.pack_map(size); for(typename MSGPACK_STD_TR1::unordered_multimap<K, V, Hash, Pred, Alloc>::const_iterator it(v.begin()), it_end(v.end()); it != it_end; ++it) { o.pack(it->first); o.pack(it->second); } return o; }
void operator()(clmdep_msgpack::object::with_zone& o, const std::forward_list<T, Alloc>& v) const { o.type = clmdep_msgpack::type::ARRAY; if(v.empty()) { o.via.array.ptr = nullptr; o.via.array.size = 0; } else { uint32_t size = checked_get_container_size(std::distance(v.begin(), v.end())); o.via.array.size = size; clmdep_msgpack::object* p = static_cast<clmdep_msgpack::object*>( o.zone.allocate_align(sizeof(clmdep_msgpack::object)*size)); o.via.array.ptr = p; for(auto const& e : v) *p++ = clmdep_msgpack::object(e, o.zone); } }
void operator()(clmdep_msgpack::object::with_zone& o, const std::multiset<T, Compare, Alloc>& v) const { o.type = clmdep_msgpack::type::ARRAY; if (v.empty()) { o.via.array.ptr = nullptr; o.via.array.size = 0; } else { uint32_t size = checked_get_container_size(v.size()); clmdep_msgpack::object* p = static_cast<clmdep_msgpack::object*>(o.zone.allocate_align(sizeof(clmdep_msgpack::object)*size)); clmdep_msgpack::object* const pend = p + size; o.via.array.ptr = p; o.via.array.size = size; typename std::multiset<T, Compare, Alloc>::const_iterator it(v.begin()); do { *p = clmdep_msgpack::object(*it, o.zone); ++p; ++it; } while(p < pend); } }
void operator()(msgpack::object::with_zone& o, const std::unordered_map<K, V, Hash, Compare, Alloc>& v) const { o.type = msgpack::type::MAP; if(v.empty()) { o.via.map.ptr = nullptr; o.via.map.size = 0; } else { uint32_t size = checked_get_container_size(v.size()); msgpack::object_kv* p = static_cast<msgpack::object_kv*>(o.zone.allocate_align(sizeof(msgpack::object_kv)*size)); msgpack::object_kv* const pend = p + size; o.via.map.ptr = p; o.via.map.size = size; typename std::unordered_map<K, V, Hash, Compare, Alloc>::const_iterator it(v.begin()); do { p->key = msgpack::object(it->first, o.zone); p->val = msgpack::object(it->second, o.zone); ++p; ++it; } while(p < pend); } }
void operator()(msgpack::object::with_zone& o, const std::set<T, Compare, Alloc>& v) const { o.type = msgpack::type::ARRAY; if (v.empty()) { o.via.array.ptr = MSGPACK_NULLPTR; o.via.array.size = 0; } else { uint32_t size = checked_get_container_size(v.size()); msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size, MSGPACK_ZONE_ALIGNOF(msgpack::object))); msgpack::object* const pend = p + size; o.via.array.ptr = p; o.via.array.size = size; typename std::set<T, Compare, Alloc>::const_iterator it(v.begin()); do { *p = msgpack::object(*it, o.zone); ++p; ++it; } while(p < pend); } }
void operator()(msgpack::object& o, const std::array<char, N>& v) const { uint32_t size = checked_get_container_size(v.size()); o.type = msgpack::type::BIN; o.via.bin.ptr = v.data(); o.via.bin.size = size; }
void operator()(clmdep_msgpack::object& o, const std::array<unsigned char, N>& v) const { uint32_t size = checked_get_container_size(v.size()); o.type = clmdep_msgpack::type::BIN; o.via.bin.ptr = reinterpret_cast<char const*>(v.data()); o.via.bin.size = size; }
void operator()(clmdep_msgpack::object& o, const boost::string_ref& v) const { uint32_t size = checked_get_container_size(v.size()); o.type = clmdep_msgpack::type::STR; o.via.str.ptr = v.data(); o.via.str.size = size; }
clmdep_msgpack::packer<Stream>& operator()(clmdep_msgpack::packer<Stream>& o, const boost::string_ref& v) const { uint32_t size = checked_get_container_size(v.size()); o.pack_str(size); o.pack_str_body(v.data(), size); return o; }
clmdep_msgpack::packer<Stream>& operator()(clmdep_msgpack::packer<Stream>& o, const std::forward_list<T, Alloc>& v) const { uint32_t size = checked_get_container_size(std::distance(v.begin(), v.end())); o.pack_array(size); for(auto const& e : v) o.pack(e); return o; }
void operator()(msgpack::object& o, const char(&v)[N]) const { uint32_t size = checked_get_container_size(std::strlen(v)); o.type = msgpack::type::STR; o.via.str.ptr = v; o.via.str.size = size; }