126 self &operator<<(
bool v)
128 append(v ?
"1" :
"0", 1);
132 self &operator<<(
short);
133 self &operator<<(
unsigned short);
134 self &operator<<(
int);
135 self &operator<<(
unsigned int);
136 self &operator<<(
long);
137 self &operator<<(
unsigned long);
138 self &operator<<(
const long long &);
139 self &operator<<(
const unsigned long long &);
141 self &operator<<(
const void *);
143 self &operator<<(
float &v)
145 *this << static_cast<double>(v);
148 self &operator<<(
const double &);
149 self &operator<<(
const long double &v);
151 self &operator<<(
char v)
160 self &operator<<(
const char (&buf)[N])
162 assert(strnlen(buf, N) == N - 1);
167 self &operator<<(
char *str)
171 append(str, strlen(str));
180 self &operator<<(
const char *str)
184 append(str, strlen(str));
193 self &operator<<(
const unsigned char *str)
195 return operator<<(reinterpret_cast<const char *>(str));
198 self &operator<<(
const std::string &v)
200 append(v.c_str(), v.size());
204 void append(
const char *data,
size_t len)
206 if (exBuffer_.empty())
208 if (!buffer_.append(data, len))
210 exBuffer_.append(buffer_.data(), buffer_.length());
211 exBuffer_.append(data, len);
216 exBuffer_.append(data, len);
220 const char *bufferData()
const
222 if (!exBuffer_.empty())
224 return exBuffer_.data();
226 return buffer_.data();
229 size_t bufferLength()
const
231 if (!exBuffer_.empty())
233 return exBuffer_.length();
235 return buffer_.length();
244 template <
typename T>
245 void formatInteger(T);
248 std::string exBuffer_;