UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
line_buffer.hpp
Go to the documentation of this file.
1#ifndef LINE_BUFFER_5dd68dbd1e7b
2#define LINE_BUFFER_5dd68dbd1e7b
3
4#include <string>
5#include <string_view>
6
8public:
9 void write(std::string_view str);
10
11 bool hasLine() const { return startIdx != endIdx; }
12
13 //valid only until pop()
14 std::string_view peek() const {
15 return std::string_view(buf.data() + startIdx, endIdx - startIdx);
16 }
17
18 void pop();
19
20private:
21 void reduceBuf();
22
23 std::string buf;
24 size_t startIdx = 0;
25 size_t endIdx = 0;
26};
27
28
29#endif
size_t endIdx
bool hasLine() const
void write(std::string_view str)
std::string buf
std::string_view peek() const
size_t startIdx
void reduceBuf()