Class stringstream
Synopsis
#include <include/flecs/cpp/util.hpp>
class stringstream
Description
No description yet.
Methods
stringstream overload | ||
~stringstream | ||
operator<< | ||
operator= overload | ||
str |
Source
Lines 145-182 in include/flecs/cpp/util.hpp.
class stringstream {
public:
explicit stringstream()
: m_buf({}) { }
~stringstream() {
ecs_strbuf_reset(&m_buf);
}
stringstream(stringstream&& str) {
ecs_strbuf_reset(&m_buf);
m_buf = str.m_buf;
str.m_buf = {};
}
stringstream& operator=(stringstream&& str) {
ecs_strbuf_reset(&m_buf);
m_buf = str.m_buf;
str.m_buf = {};
return *this;
}
// Ban implicit copies/allocations
stringstream& operator=(const stringstream& str) = delete;
stringstream(const stringstream& str) = delete;
stringstream& operator<<(const char* str) {
ecs_strbuf_appendstr(&m_buf, str);
return *this;
}
flecs::string str() {
return flecs::string(ecs_strbuf_get(&m_buf));
}
private:
ecs_strbuf_t m_buf;
};