Flecs: include/flecs/addons/cpp/utils/stringstream.hpp Source File
Description: A fast entity component system (ECS) for C & C++

| Flecs v4.0 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
8 struct stringstream {
9 explicit stringstream()
10 : buf_({}) { }
11
12 ~stringstream() {
13 ecs_strbuf_reset(&buf_);
14 }
15
16 stringstream(stringstream&& str) noexcept {
17 ecs_strbuf_reset(&buf_);
18 buf_ = str.buf_;
19 str.buf_ = {};
20 }
21
22 stringstream& operator=(stringstream&& str) noexcept {
23 ecs_strbuf_reset(&buf_);
24 buf_ = str.buf_;
25 str.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(&buf_, str);
35 return *this;
36 }
37
38 flecs::string str() {
39 return flecs::string(ecs_strbuf_get(&buf_));
40 }
41
42private:
43 ecs_strbuf_t buf_;
44};
45
46}
flecs::string
Definition string.hpp:13
flecs::stringstream
Definition stringstream.hpp:8