From 8893523776e5258e2817711da75f00a6074a13ae Mon Sep 17 00:00:00 2001 From: frsyuki Date: Wed, 25 Feb 2009 23:31:53 +0900 Subject: c: msgpack_unpacker_buffered_size; c++: unpacker::buffered_size --- cpp/unpack.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'cpp') diff --git a/cpp/unpack.hpp b/cpp/unpack.hpp index e6d35da..6e9b641 100644 --- a/cpp/unpack.hpp +++ b/cpp/unpack.hpp @@ -43,6 +43,9 @@ public: ~unpacker(); public: + /*! 0. check if the buffered size is not exceed the assumption. */ + size_t buffered_size() const; + /*! 1. reserve buffer. at least `size' bytes of capacity will be ready */ void reserve_buffer(size_t size); @@ -154,6 +157,12 @@ inline unpacker::~unpacker() msgpack_unpacker_destroy(this); } + +inline size_t unpacker::buffered_size() const +{ + return msgpack_unpacker_buffered_size(this); +} + inline void unpacker::reserve_buffer(size_t size) { if(!msgpack_unpacker_reserve_buffer(this, size)) { -- cgit v1.2.1