#include <cpp-terminal/buffer.hpp>
|
int_type | underflow () override |
|
int_type | overflow (int c=std::char_traits< Term::Buffer::char_type >::eof()) override |
|
int | sync () override |
|
Definition at line 19 of file buffer.hpp.
◆ Type
Enumerator |
---|
Unbuffered | |
LineBuffered | |
FullBuffered | |
Definition at line 22 of file buffer.hpp.
◆ Buffer() [1/3]
Definition at line 47 of file buffer.cpp.
48{
51 {
55 }
56}
void setType(const Term::Buffer::Type &type)
Term::Buffer::Type m_type
std::streambuf * setbuf(char *s, std::streamsize n) override
◆ ~Buffer()
Term::Buffer::~Buffer |
( |
| ) |
|
|
override |
◆ Buffer() [2/3]
Term::Buffer::Buffer |
( |
const Buffer & | | ) |
|
|
delete |
◆ Buffer() [3/3]
Term::Buffer::Buffer |
( |
Buffer && | | ) |
|
|
delete |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ overflow()
Term::Buffer::int_type Term::Buffer::overflow |
( |
int | c = std::char_traits<Term::Buffer::char_type>::eof() | ) |
|
|
overrideprotected |
Definition at line 113 of file buffer.cpp.
114{
115 if(c != std::char_traits<Term::Buffer::char_type>::eof())
116 {
118 {
120 {
122 break;
123 }
125 {
127 if(static_cast<char>(c) == '\n')
128 {
131 }
132 break;
133 }
135 {
137 {
140 }
142 break;
143 }
144 }
145 }
146 return c;
147}
std::size_t write(const std::string &str) const
◆ setbuf()
std::streambuf * Term::Buffer::setbuf |
( |
char * | s, |
|
|
std::streamsize | n ) |
|
overrideprivate |
Definition at line 60 of file buffer.cpp.
61{
62 if(s !=
nullptr)
m_buffer.reserve(
static_cast<std::size_t
>(n));
63 return this;
64}
◆ setType()
◆ sync()
int Term::Buffer::sync |
( |
| ) |
|
|
overrideprotected |
◆ underflow()
Term::Buffer::int_type Term::Buffer::underflow |
( |
| ) |
|
|
overrideprotected |
Definition at line 66 of file buffer.cpp.
67{
68 try
69 {
70
73 {
74 do {
76 if(!ret.empty())
77 {
78 if(ret[0] == '\x7f' || ret[0] == '\b')
79 {
82 }
83 else if(ret[0] == '\033')
84 {
85 continue;
86 }
87 else if(ret[0] <= 31 && ret[0] != '\t' && ret[0] != '\b' && ret[0] != 127 && ret[0] != ' ' && ret[0] != '\n' && ret[0] != '\r') { continue; }
88 else
89 {
92 }
93 }
96 }
97 else
98 {
99 do {
103 }
105 return traits_type::to_int_type(
m_buffer.at(0));
106 }
107 catch(...)
108 {
109 return traits_type::eof();
110 }
111}
bool has(const Option &option) const noexcept
Term::Options getOptions() const noexcept
@ Raw
Set terminal in raw mode.
Term::Terminal & terminal
◆ m_buffer
std::string Term::Buffer::m_buffer |
|
private |
◆ m_type
The documentation for this class was generated from the following files: