mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02:51:42 +00:00
raw_istream: Add std::istream style in_avail(). (#135)
This commit is contained in:
@@ -20,6 +20,8 @@ using namespace wpi;
|
||||
|
||||
void raw_mem_istream::close() {}
|
||||
|
||||
std::size_t raw_mem_istream::in_avail() const { return m_left; }
|
||||
|
||||
void raw_mem_istream::read_impl(void* data, std::size_t len) {
|
||||
if (len > m_left) {
|
||||
error_detected();
|
||||
@@ -47,6 +49,8 @@ void raw_fd_istream::close() {
|
||||
}
|
||||
}
|
||||
|
||||
std::size_t raw_fd_istream::in_avail() const { return m_end - m_cur; }
|
||||
|
||||
void raw_fd_istream::read_impl(void* data, std::size_t len) {
|
||||
std::size_t left = m_end - m_cur;
|
||||
if (left < len) {
|
||||
|
||||
@@ -27,3 +27,5 @@ void raw_socket_istream::read_impl(void* data, std::size_t len) {
|
||||
}
|
||||
|
||||
void raw_socket_istream::close() { m_stream.close(); }
|
||||
|
||||
std::size_t raw_socket_istream::in_avail() const { return 0; }
|
||||
|
||||
Reference in New Issue
Block a user