2024-06-29 22:45:09 +00:00
|
|
|
// -*-mode:c++;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8-*-
|
|
|
|
// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :vi
|
|
|
|
#ifndef CTL_OSTRINGSTREAM_H_
|
|
|
|
#define CTL_OSTRINGSTREAM_H_
|
|
|
|
#include "ios_base.h"
|
|
|
|
#include "string.h"
|
|
|
|
|
|
|
|
namespace ctl {
|
|
|
|
|
|
|
|
class ostringstream : public ios_base
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ostringstream();
|
2024-07-01 10:48:28 +00:00
|
|
|
explicit ostringstream(const ctl::string_view&);
|
2024-06-29 22:45:09 +00:00
|
|
|
|
2024-07-01 10:48:28 +00:00
|
|
|
ctl::string str() const;
|
|
|
|
void str(const ctl::string& s);
|
2024-06-29 22:45:09 +00:00
|
|
|
void clear();
|
|
|
|
|
|
|
|
ostringstream& operator<<(char);
|
2024-07-01 10:48:28 +00:00
|
|
|
ostringstream& operator<<(const ctl::string_view&);
|
2024-06-29 22:45:09 +00:00
|
|
|
ostringstream& operator<<(int);
|
|
|
|
ostringstream& operator<<(unsigned int);
|
|
|
|
ostringstream& operator<<(long);
|
|
|
|
ostringstream& operator<<(unsigned long);
|
|
|
|
ostringstream& operator<<(float);
|
|
|
|
ostringstream& operator<<(double);
|
|
|
|
|
|
|
|
private:
|
2024-07-01 10:48:28 +00:00
|
|
|
ctl::string buffer_;
|
2024-06-29 22:45:09 +00:00
|
|
|
size_t write_pos_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace ctl
|
|
|
|
|
|
|
|
#endif // CTL_OSTRINGSTREAM_H_
|