mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 02:19:35 +08:00
var names and some minor cleanups
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
// Faster than ostringstream--returns its string by ref
|
||||
|
||||
#include <ostream>
|
||||
#include "c11log/details/fast_buf.h"
|
||||
|
||||
namespace c11log
|
||||
@@ -19,21 +19,14 @@ public:
|
||||
str_devicebuf(str_devicebuf&& other) = delete;
|
||||
str_devicebuf& operator=(const str_devicebuf&) = delete;
|
||||
str_devicebuf& operator=(str_devicebuf&&) = delete;
|
||||
|
||||
/*
|
||||
const std::string& str_ref() const
|
||||
{
|
||||
return _str;
|
||||
}
|
||||
*/
|
||||
|
||||
bufpair_t buf()
|
||||
{
|
||||
return _fastbuf.get();
|
||||
}
|
||||
|
||||
void reset_str()
|
||||
{
|
||||
//_str.clear();
|
||||
{
|
||||
_fastbuf.clear();
|
||||
}
|
||||
|
||||
@@ -46,21 +39,13 @@ protected:
|
||||
// copy the give buffer into the accumulated string.
|
||||
// reserve initially 128 bytes which should be enough for common log lines
|
||||
std::streamsize xsputn(const char_type* s, std::streamsize count) override
|
||||
{
|
||||
/*
|
||||
if(_str.capacity() < k_initial_reserve)
|
||||
{
|
||||
_str.reserve(k_initial_reserve);
|
||||
}
|
||||
_str.append(s, static_cast<unsigned int>(count));
|
||||
*/
|
||||
{
|
||||
_fastbuf.append(s, static_cast<unsigned int>(count));
|
||||
return count;
|
||||
}
|
||||
|
||||
int_type overflow(int_type ch) override
|
||||
{
|
||||
|
||||
bool not_eofile = traits_type::not_eof(ch);
|
||||
if (not_eofile)
|
||||
{
|
||||
@@ -70,7 +55,6 @@ protected:
|
||||
return not_eofile;
|
||||
}
|
||||
private:
|
||||
//std::string _str;
|
||||
fast_buf<192> _fastbuf;
|
||||
};
|
||||
|
||||
@@ -83,12 +67,7 @@ public:
|
||||
fast_oss(const fast_oss& other) = delete;
|
||||
fast_oss(fast_oss&& other) = delete;
|
||||
fast_oss& operator=(const fast_oss& other) = delete;
|
||||
/*
|
||||
const std::string& str_ref() const
|
||||
{
|
||||
return _dev.str_ref();
|
||||
}
|
||||
*/
|
||||
|
||||
bufpair_t buf()
|
||||
{
|
||||
return _dev.buf();
|
||||
|
Reference in New Issue
Block a user