Flecs v3.2
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
stringstream.hpp
Go to the documentation of this file.
1
6namespace flecs {
7
9 explicit stringstream()
10 : m_buf({}) { }
11
13 ecs_strbuf_reset(&m_buf);
14 }
15
16 stringstream(stringstream&& str) noexcept {
17 ecs_strbuf_reset(&m_buf);
18 m_buf = str.m_buf;
19 str.m_buf = {};
20 }
21
22 stringstream& operator=(stringstream&& str) noexcept {
23 ecs_strbuf_reset(&m_buf);
24 m_buf = str.m_buf;
25 str.m_buf = {};
26 return *this;
27 }
28
29 // Ban implicit copies/allocations
30 stringstream& operator=(const stringstream& str) = delete;
31 stringstream(const stringstream& str) = delete;
32
33 stringstream& operator<<(const char* str) {
34 ecs_strbuf_appendstr(&m_buf, str);
35 return *this;
36 }
37
38 flecs::string str() {
39 return flecs::string(ecs_strbuf_get(&m_buf));
40 }
41
42private:
43 ecs_strbuf_t m_buf;
44};
45
46}