Restored pointer based interfaces to maintain compatibility.

This commit is contained in:
Takatoshi Kondo
2013-09-05 11:31:03 +09:00
parent 616be1aa60
commit 9bd339baf8
2 changed files with 28 additions and 6 deletions

View File

@@ -90,7 +90,6 @@ struct object {
template <typename T> template <typename T>
void convert(T* v) const; void convert(T* v) const;
object(); object();
object(msgpack_object o); object(msgpack_object o);

View File

@@ -670,9 +670,10 @@ private:
}; };
static void unpack(unpacked& result, inline void unpack(unpacked& result,
const char* data, size_t len, size_t* offset = NULL);
inline void unpack(unpacked* result,
const char* data, size_t len, size_t* offset = NULL); const char* data, size_t len, size_t* offset = NULL);
// obsolete // obsolete
typedef enum { typedef enum {
@@ -685,10 +686,13 @@ typedef enum {
// obsolete // obsolete
static unpack_return unpack(const char* data, size_t len, size_t* off, static unpack_return unpack(const char* data, size_t len, size_t* off,
zone& z, object& result); zone& z, object& result);
static unpack_return unpack(const char* data, size_t len, size_t* off,
zone* z, object* result);
// obsolete // obsolete
static object unpack(const char* data, size_t len, zone& z, size_t* off = NULL); static object unpack(const char* data, size_t len, zone& z, size_t* off = NULL);
static object unpack(const char* data, size_t len, zone* z, size_t* off = NULL);
inline unpacker::unpacker(size_t initial_buffer_size) inline unpacker::unpacker(size_t initial_buffer_size)
@@ -981,6 +985,7 @@ unpack_imp(const char* data, size_t len, size_t* off,
} // detail } // detail
// reference version
inline void unpack(unpacked& result, inline void unpack(unpacked& result,
const char* data, size_t len, size_t* offset) const char* data, size_t len, size_t* offset)
{ {
@@ -1010,17 +1015,30 @@ inline void unpack(unpacked& result,
throw unpack_error("parse error"); throw unpack_error("parse error");
} }
} }
// pointer version
inline void unpack(unpacked* result,
const char* data, size_t len, size_t* offset) {
unpack(*result, data, len, offset);
}
// obsolete // obsolete
// reference version
inline unpack_return unpack(const char* data, size_t len, size_t* off, inline unpack_return unpack(const char* data, size_t len, size_t* off,
zone& z, object& result) zone& z, object& result)
{ {
return detail::unpack_imp(data, len, off, return detail::unpack_imp(data, len, off,
z, result); z, result);
} }
// pointer version
inline unpack_return unpack(const char* data, size_t len, size_t* off,
zone* z, object* result)
{
return unpack(data, len, off, *z, *result);
}
// obsolete // obsolete
// reference version
inline object unpack(const char* data, size_t len, zone& z, size_t* off) inline object unpack(const char* data, size_t len, zone& z, size_t* off)
{ {
object result; object result;
@@ -1044,6 +1062,11 @@ inline object unpack(const char* data, size_t len, zone& z, size_t* off)
throw unpack_error("parse error"); throw unpack_error("parse error");
} }
} }
// pointer version
inline object unpack(const char* data, size_t len, zone* z, size_t* off)
{
return unpack(data, len, *z, off);
}
} // namespace msgpack } // namespace msgpack