X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Fcommon%2FPrebufferedStreambuf.h;fp=src%2Fceph%2Fsrc%2Fcommon%2FPrebufferedStreambuf.h;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=b7fa21d68b780455b754cad55d79846a07d5a3b1;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/common/PrebufferedStreambuf.h b/src/ceph/src/common/PrebufferedStreambuf.h deleted file mode 100644 index b7fa21d..0000000 --- a/src/ceph/src/common/PrebufferedStreambuf.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef CEPH_COMMON_PREBUFFEREDSTREAMBUF_H -#define CEPH_COMMON_PREBUFFEREDSTREAMBUF_H - -#include - -/** - * streambuf using existing buffer, overflowing into a std::string - * - * A simple streambuf that uses a preallocated buffer for small - * strings, and overflows into a std::string when necessary. If the - * preallocated buffer size is chosen well, we can optimize for the - * common case and overflow to a slower heap-allocated buffer when - * necessary. - */ -class PrebufferedStreambuf - : public std::basic_streambuf::traits_type> -{ - char *m_buf; - size_t m_buf_len; - std::string m_overflow; - - typedef std::char_traits traits_ty; - typedef traits_ty::int_type int_type; - typedef traits_ty::pos_type pos_type; - typedef traits_ty::off_type off_type; - -public: - PrebufferedStreambuf(char *buf, size_t len); - - // called when the buffer fills up - int_type overflow(int_type c) override; - - // called when we read and need more data - int_type underflow() override; - - /// return a string copy (inefficiently) - std::string get_str() const; - - // returns current size of content - size_t size() const; - - // extracts up to avail chars of content - int snprintf(char* dst, size_t avail) const; -}; - -#endif