Skip to content

Commit 4b0c90f

Browse files
committed
Merge branch 'add_msgpack_prefix'
Conflicts: include/msgpack/adaptor/char_ptr.hpp include/msgpack/adaptor/cpp11/array.hpp include/msgpack/adaptor/cpp11/array_char.hpp include/msgpack/adaptor/cpp11/tuple.hpp include/msgpack/adaptor/cpp11/unordered_map.hpp include/msgpack/adaptor/cpp11/unordered_set.hpp include/msgpack/adaptor/deque.hpp include/msgpack/adaptor/list.hpp include/msgpack/adaptor/map.hpp include/msgpack/adaptor/set.hpp include/msgpack/adaptor/string.hpp include/msgpack/adaptor/tr1/unordered_map.hpp include/msgpack/adaptor/tr1/unordered_set.hpp include/msgpack/adaptor/vector.hpp include/msgpack/adaptor/vector_char.hpp include/msgpack/object.hpp include/msgpack/unpack.hpp
2 parents 8eaa2e9 + f707c6b commit 4b0c90f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2518
-2518
lines changed

erb/cpp03_define.hpp.erb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,25 @@
4343
#define MSGPACK_ADD_ENUM(enum) \
4444
namespace msgpack { \
4545
MSGPACK_API_VERSION_NAMESPACE(v1) { \
46-
inline object const& operator>> (object const& o, enum& v) \
46+
inline msgpack::object const& operator>> (msgpack::object const& o, enum& v) \
4747
{ \
4848
int tmp; \
4949
o >> tmp; \
5050
v = static_cast<enum>(tmp); \
5151
return o; \
5252
} \
53-
inline void operator<< (object& o, const enum& v) \
53+
inline void operator<< (msgpack::object& o, const enum& v) \
5454
{ \
5555
o << static_cast<int>(v); \
5656
} \
57-
inline void operator<< (object::with_zone& o, const enum& v) \
57+
inline void operator<< (msgpack::object::with_zone& o, const enum& v) \
5858
{ \
5959
o << static_cast<int>(v); \
6060
} \
6161
namespace detail { \
6262
template <typename Stream> \
6363
struct packer_serializer<Stream, enum> { \
64-
static packer<Stream>& pack(packer<Stream>& o, const enum& v) { \
64+
static msgpack::packer<Stream>& pack(msgpack::packer<Stream>& o, const enum& v) { \
6565
return o << static_cast<int>(v); \
6666
} \
6767
}; \
@@ -90,11 +90,11 @@ struct define<> {
9090
}
9191
void msgpack_unpack(msgpack::object const& o)
9292
{
93-
if(o.type != type::ARRAY) { throw type_error(); }
93+
if(o.type != msgpack::type::ARRAY) { throw type_error(); }
9494
}
9595
void msgpack_object(msgpack::object* o, msgpack::zone&) const
9696
{
97-
o->type = type::ARRAY;
97+
o->type = msgpack::type::ARRAY;
9898
o->via.array.ptr = nullptr;
9999
o->via.array.size = 0;
100100
}
@@ -115,7 +115,7 @@ struct define<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> {
115115
}
116116
void msgpack_unpack(msgpack::object const& o)
117117
{
118-
if(o.type != type::ARRAY) { throw type_error(); }
118+
if(o.type != msgpack::type::ARRAY) { throw type_error(); }
119119
const size_t size = o.via.array.size;
120120
if(size > 0) {
121121
msgpack::object *ptr = o.via.array.ptr;
@@ -127,11 +127,11 @@ struct define<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> {
127127
}
128128
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
129129
{
130-
o->type = type::ARRAY;
131-
o->via.array.ptr = static_cast<object*>(z.allocate_align(sizeof(object)*<%=i+1%>));
130+
o->type = msgpack::type::ARRAY;
131+
o->via.array.ptr = static_cast<msgpack::object*>(z.allocate_align(sizeof(msgpack::object)*<%=i+1%>));
132132
o->via.array.size = <%=i+1%>;
133133
<%0.upto(i) {|j|%>
134-
o->via.array.ptr[<%=j%>] = object(a<%=j%>, z);<%}%>
134+
o->via.array.ptr[<%=j%>] = msgpack::object(a<%=j%>, z);<%}%>
135135
}
136136
<%0.upto(i) {|j|%>
137137
A<%=j%>& a<%=j%>;<%}%>

erb/cpp03_msgpack_tuple.hpp.erb

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private:
9595
template <>
9696
struct tuple<> {
9797
tuple() {}
98-
tuple(object const& o) { o.convert(*this); }
98+
tuple(msgpack::object const& o) { o.convert(*this); }
9999
typedef tuple<> value_type;
100100
};
101101
<%0.upto(GENERATION_LIMIT) {|i|%>
@@ -105,7 +105,7 @@ struct tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> {
105105
tuple() {}
106106
tuple(typename tuple_type<A0>::transparent_reference _a0<%1.upto(i) {|j|%>, typename tuple_type<A<%=j%>>::transparent_reference _a<%=j%><%}%>) :
107107
a0(_a0)<%1.upto(i) {|j|%>, a<%=j%>(_a<%=j%>)<%}%> {}
108-
tuple(object const& o) { o.convert(*this); }
108+
tuple(msgpack::object const& o) { o.convert(*this); }
109109
template <int N> typename tuple_element<value_type, N>::reference get()
110110
{ return tuple_element<value_type, N>(*this).get(); }
111111
template <int N> typename const_tuple_element<value_type, N>::const_reference get() const
@@ -136,18 +136,18 @@ inline tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> make_tuple(typename tuple_type<
136136

137137
} // namespace type
138138

139-
inline object const& operator>> (
140-
object const& o,
139+
inline msgpack::object const& operator>> (
140+
msgpack::object const& o,
141141
type::tuple<>&) {
142-
if(o.type != type::ARRAY) { throw type_error(); }
142+
if(o.type != msgpack::type::ARRAY) { throw type_error(); }
143143
return o;
144144
}
145145
<%0.upto(GENERATION_LIMIT) {|i|%>
146146
template <typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
147-
inline object const& operator>> (
148-
object const& o,
147+
inline msgpack::object const& operator>> (
148+
msgpack::object const& o,
149149
type::tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>>& v) {
150-
if(o.type != type::ARRAY) { throw type_error(); }
150+
if(o.type != msgpack::type::ARRAY) { throw type_error(); }
151151
if(o.via.array.size < <%=i+1%>) { throw type_error(); }
152152
<%0.upto(i) {|j|%>
153153
o.via.array.ptr[<%=j%>].convert<typename type::tuple_type<A<%=j%>>::type>(v.template get<<%=j%>>());<%}%>
@@ -156,16 +156,16 @@ inline object const& operator>> (
156156
<%}%>
157157

158158
template <typename Stream>
159-
inline const packer<Stream>& operator<< (
160-
packer<Stream>& o,
159+
inline const msgpack::packer<Stream>& operator<< (
160+
msgpack::packer<Stream>& o,
161161
const type::tuple<>&) {
162162
o.pack_array(0);
163163
return o;
164164
}
165165
<%0.upto(GENERATION_LIMIT) {|i|%>
166166
template <typename Stream, typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
167-
inline const packer<Stream>& operator<< (
168-
packer<Stream>& o,
167+
inline const msgpack::packer<Stream>& operator<< (
168+
msgpack::packer<Stream>& o,
169169
const type::tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>>& v) {
170170
o.pack_array(<%=i+1%>);
171171
<%0.upto(i) {|j|%>
@@ -175,22 +175,22 @@ inline const packer<Stream>& operator<< (
175175
<%}%>
176176

177177
inline void operator<< (
178-
object::with_zone& o,
178+
msgpack::object::with_zone& o,
179179
const type::tuple<>&) {
180-
o.type = type::ARRAY;
180+
o.type = msgpack::type::ARRAY;
181181
o.via.array.ptr = nullptr;
182182
o.via.array.size = 0;
183183
}
184184
<%0.upto(GENERATION_LIMIT) {|i|%>
185185
template <typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
186186
inline void operator<< (
187-
object::with_zone& o,
187+
msgpack::object::with_zone& o,
188188
const type::tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>>& v) {
189-
o.type = type::ARRAY;
190-
o.via.array.ptr = static_cast<object*>(o.zone.allocate_align(sizeof(object)*<%=i+1%>));
189+
o.type = msgpack::type::ARRAY;
190+
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*<%=i+1%>));
191191
o.via.array.size = <%=i+1%>;
192192
<%0.upto(i) {|j|%>
193-
o.via.array.ptr[<%=j%>] = object(v.template get<<%=j%>>(), o.zone);<%}%>
193+
o.via.array.ptr[<%=j%>] = msgpack::object(v.template get<<%=j%>>(), o.zone);<%}%>
194194
}
195195
<%}%>
196196

erb/cpp03_msgpack_tuple_fwd.hpp.erb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,36 +77,36 @@ tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> make_tuple(typename tuple_type<A0>::tr
7777

7878
} // namespace type
7979

80-
object const& operator>> (
81-
object const& o,
80+
msgpack::object const& operator>> (
81+
msgpack::object const& o,
8282
type::tuple<>&);
8383

8484
<%0.upto(GENERATION_LIMIT) {|i|%>
8585
template <typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
86-
object const& operator>> (
87-
object const& o,
86+
msgpack::object const& operator>> (
87+
msgpack::object const& o,
8888
type::tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>>& v);
8989
<%}%>
9090

9191
template <typename Stream>
92-
const packer<Stream>& operator<< (
93-
packer<Stream>& o,
92+
const msgpack::packer<Stream>& operator<< (
93+
msgpack::packer<Stream>& o,
9494
const type::tuple<>&);
9595

9696
<%0.upto(GENERATION_LIMIT) {|i|%>
9797
template <typename Stream, typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
98-
const packer<Stream>& operator<< (
99-
packer<Stream>& o,
98+
const msgpack::packer<Stream>& operator<< (
99+
msgpack::packer<Stream>& o,
100100
const type::tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>>& v);
101101
<%}%>
102102

103103
void operator<< (
104-
object::with_zone& o,
104+
msgpack::object::with_zone& o,
105105
const type::tuple<>&);
106106
<%0.upto(GENERATION_LIMIT) {|i|%>
107107
template <typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
108108
void operator<< (
109-
object::with_zone& o,
109+
msgpack::object::with_zone& o,
110110
const type::tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>>& v);
111111
<%}%>
112112

include/msgpack/adaptor/bool.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,29 @@ namespace msgpack {
2626

2727
MSGPACK_API_VERSION_NAMESPACE(v1) {
2828

29-
inline object const& operator>> (object const& o, bool& v)
29+
inline msgpack::object const& operator>> (msgpack::object const& o, bool& v)
3030
{
31-
if(o.type != type::BOOLEAN) { throw type_error(); }
31+
if(o.type != msgpack::type::BOOLEAN) { throw type_error(); }
3232
v = o.via.boolean;
3333
return o;
3434
}
3535

3636
template <typename Stream>
37-
inline packer<Stream>& operator<< (packer<Stream>& o, const bool& v)
37+
inline msgpack::packer<Stream>& operator<< (msgpack::packer<Stream>& o, const bool& v)
3838
{
3939
if(v) { o.pack_true(); }
4040
else { o.pack_false(); }
4141
return o;
4242
}
4343

44-
inline void operator<< (object& o, bool v)
44+
inline void operator<< (msgpack::object& o, bool v)
4545
{
46-
o.type = type::BOOLEAN;
46+
o.type = msgpack::type::BOOLEAN;
4747
o.via.boolean = v;
4848
}
4949

50-
inline void operator<< (object::with_zone& o, bool v)
51-
{ static_cast<object&>(o) << v; }
50+
inline void operator<< (msgpack::object::with_zone& o, bool v)
51+
{ static_cast<msgpack::object&>(o) << v; }
5252

5353

5454
} // MSGPACK_API_VERSION_NAMESPACE(v1)

include/msgpack/adaptor/bool_fwd.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ namespace msgpack {
2525

2626
MSGPACK_API_VERSION_NAMESPACE(v1) {
2727

28-
object const& operator>> (object const& o, bool& v);
28+
msgpack::object const& operator>> (msgpack::object const& o, bool& v);
2929
template <typename Stream>
30-
packer<Stream>& operator<< (packer<Stream>& o, const bool& v);
31-
void operator<< (object& o, bool v);
32-
void operator<< (object::with_zone& o, bool v);
30+
msgpack::packer<Stream>& operator<< (msgpack::packer<Stream>& o, const bool& v);
31+
void operator<< (msgpack::object& o, bool v);
32+
void operator<< (msgpack::object::with_zone& o, bool v);
3333

3434

3535
} // MSGPACK_API_VERSION_NAMESPACE(v1)

include/msgpack/adaptor/char_ptr.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,28 @@ namespace msgpack {
2929
MSGPACK_API_VERSION_NAMESPACE(v1) {
3030

3131
template <typename Stream>
32-
inline packer<Stream>& operator<< (packer<Stream>& o, const char* v)
32+
inline msgpack::packer<Stream>& operator<< (msgpack::packer<Stream>& o, const char* v)
3333
{
3434
uint32_t size = checked_get_container_size(std::strlen(v));
3535
o.pack_str(size);
3636
o.pack_str_body(v, size);
3737
return o;
3838
}
3939

40-
inline void operator<< (object::with_zone& o, const char* v)
40+
inline void operator<< (msgpack::object::with_zone& o, const char* v)
4141
{
4242
uint32_t size = checked_get_container_size(std::strlen(v));
43-
o.type = type::STR;
43+
o.type = msgpack::type::STR;
4444
char* ptr = static_cast<char*>(o.zone.allocate_align(size));
4545
o.via.str.ptr = ptr;
4646
o.via.str.size = size;
4747
std::memcpy(ptr, v, size);
4848
}
4949

50-
inline void operator<< (object& o, const char* v)
50+
inline void operator<< (msgpack::object& o, const char* v)
5151
{
5252
uint32_t size = checked_get_container_size(std::strlen(v));
53-
o.type = type::STR;
53+
o.type = msgpack::type::STR;
5454
o.via.str.ptr = v;
5555
o.via.str.size = size;
5656
}

include/msgpack/adaptor/char_ptr_fwd.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ namespace msgpack {
2727
MSGPACK_API_VERSION_NAMESPACE(v1) {
2828

2929
template <typename Stream>
30-
packer<Stream>& operator<< (packer<Stream>& o, const char* v);
31-
void operator<< (object::with_zone& o, const char* v);
32-
void operator<< (object& o, const char* v);
30+
msgpack::packer<Stream>& operator<< (msgpack::packer<Stream>& o, const char* v);
31+
void operator<< (msgpack::object::with_zone& o, const char* v);
32+
void operator<< (msgpack::object& o, const char* v);
3333

3434
template <typename Stream>
3535
packer<Stream>& operator<< (packer<Stream>& o, char* v);

include/msgpack/adaptor/cpp11/array.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ namespace msgpack {
3030
MSGPACK_API_VERSION_NAMESPACE(v1) {
3131

3232
template <typename T, std::size_t N>
33-
inline object const& operator>> (object const& o, std::array<T, N>& v) {
34-
if(o.type != type::ARRAY) { throw type_error(); }
33+
inline msgpack::object const& operator>> (msgpack::object const& o, std::array<T, N>& v) {
34+
if(o.type != msgpack::type::ARRAY) { throw type_error(); }
3535
if(o.via.array.size != N) { throw type_error(); }
3636
if(o.via.array.size > 0) {
37-
object* p = o.via.array.ptr;
38-
object* const pend = o.via.array.ptr + o.via.array.size;
37+
msgpack::object* p = o.via.array.ptr;
38+
msgpack::object* const pend = o.via.array.ptr + o.via.array.size;
3939
T* it = &v[0];
4040
do {
4141
p->convert(*it);
@@ -47,25 +47,25 @@ inline object const& operator>> (object const& o, std::array<T, N>& v) {
4747
}
4848

4949
template <typename Stream, typename T, std::size_t N>
50-
inline packer<Stream>& operator<< (packer<Stream>& o, const std::array<T, N>& v) {
50+
inline msgpack::packer<Stream>& operator<< (msgpack::packer<Stream>& o, const std::array<T, N>& v) {
5151
uint32_t size = checked_get_container_size(v.size());
5252
o.pack_array(size);
5353
for(auto const& e : v) o.pack(e);
5454
return o;
5555
}
5656

5757
template <typename T, std::size_t N>
58-
inline void operator<< (object::with_zone& o, const std::array<T, N>& v) {
59-
o.type = type::ARRAY;
58+
inline void operator<< (msgpack::object::with_zone& o, const std::array<T, N>& v) {
59+
o.type = msgpack::type::ARRAY;
6060
if(v.empty()) {
6161
o.via.array.ptr = nullptr;
6262
o.via.array.size = 0;
6363
} else {
6464
uint32_t size = checked_get_container_size(v.size());
65-
object* p = static_cast<object*>(o.zone.allocate_align(sizeof(object)*size));
65+
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size));
6666
o.via.array.size = size;
6767
o.via.array.ptr = p;
68-
for (auto const& e : v) *p++ = object(e, o.zone);
68+
for (auto const& e : v) *p++ = msgpack::object(e, o.zone);
6969
}
7070
}
7171

0 commit comments

Comments
 (0)