flush helper count writes instead of time

This commit is contained in:
gabime
2014-03-14 14:35:46 +02:00
parent 9d687d1634
commit 38670cef27
14 changed files with 139 additions and 94 deletions

View File

@@ -22,25 +22,30 @@ public:
str_devicebuf& operator=(str_devicebuf&&) = delete;
const std::string& str_ref() const {
const std::string& str_ref() const
{
return _str;
}
void clear() {
void clear()
{
_str.clear();
}
protected:
virtual int sync() override {
virtual int sync() override
{
return 0;
}
virtual std::streamsize xsputn(const char_type* s, std::streamsize count) override {
virtual std::streamsize xsputn(const char_type* s, std::streamsize count) override
{
_str.append(s, static_cast<unsigned int>(count));
return count;
}
virtual int_type overflow(int_type ch) override {
virtual int_type overflow(int_type ch) override
{
if (ch != traits_type::eof())
_str.append((char*)&ch, 1);
return 1;
@@ -59,12 +64,11 @@ public:
fast_oss(fast_oss&& other) = delete;
fast_oss& operator=(const fast_oss& other) = delete;
const std::string& str_ref() const {
const std::string& str_ref() const
{
return _dev.str_ref();
}
private:
str_devicebuf _dev;
};