5#ifndef WPIUTIL_WPI_RAW_ISTREAM_H_
6#define WPIUTIL_WPI_RAW_ISTREAM_H_
15#include <system_error>
52 read_impl(
data, readlen);
57 size_t old_size = buf.
size();
59 read_impl(&buf[old_size], len);
60 buf.
resize(old_size + m_read_count);
65 size_t old_size = buf.
size();
67 read_impl(&buf[old_size], len);
68 buf.
resize(old_size + m_read_count);
73 size_t old_size = buf.size();
74 buf.insert(buf.end(), len, 0);
75 read_impl(&buf[old_size], len);
76 buf.resize(old_size + m_read_count);
81 size_t old_size = buf.size();
82 buf.insert(buf.end(), len, 0);
83 read_impl(&buf[old_size], len);
84 buf.resize(old_size + m_read_count);
89 size_t old_size = buf.size();
90 buf.insert(buf.end(), len, 0);
91 read_impl(&buf[old_size], len);
92 buf.resize(old_size + m_read_count);
125 virtual void read_impl(
void*
data,
size_t len) = 0;
127 bool m_error =
false;
128 size_t m_read_count = 0;
142 : m_cur(str), m_left(
std::strlen(str)) {}
148 void read_impl(
void*
data,
size_t len)
override;
157 size_t bufSize = 4096);
164 void read_impl(
void*
data,
size_t len) override;
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:670
void resize(size_type N)
Definition: SmallVector.h:622
size_t size() const
Definition: SmallVector.h:78
Definition: raw_istream.h:154
raw_fd_istream(std::string_view filename, std::error_code &ec, size_t bufSize=4096)
~raw_fd_istream() override
raw_fd_istream(int fd, bool shouldClose, size_t bufSize=4096)
size_t in_avail() const override
Definition: raw_istream.h:22
bool has_error() const
Definition: raw_istream.h:114
raw_istream & read(signed char &c)
Definition: raw_istream.h:37
raw_istream & readinto(std::string &buf, size_t len)
Definition: raw_istream.h:88
size_t readsome(void *data, size_t len)
Definition: raw_istream.h:47
virtual size_t in_avail() const =0
raw_istream & readinto(SmallVectorImpl< uint8_t > &buf, size_t len)
Definition: raw_istream.h:64
raw_istream & readinto(std::vector< uint8_t > &buf, size_t len)
Definition: raw_istream.h:80
virtual ~raw_istream()=default
std::string_view getline(SmallVectorImpl< char > &buf, int maxLen)
raw_istream & operator=(const raw_istream &)=delete
raw_istream & readinto(std::vector< char > &buf, size_t len)
Definition: raw_istream.h:72
raw_istream & read(void *data, size_t len)
Definition: raw_istream.h:42
raw_istream & readinto(SmallVectorImpl< char > &buf, size_t len)
Definition: raw_istream.h:56
void error_detected()
Definition: raw_istream.h:121
raw_istream(const raw_istream &)=delete
raw_istream & read(unsigned char &c)
Definition: raw_istream.h:32
raw_istream & read(char &c)
Definition: raw_istream.h:27
void set_read_count(size_t count)
Definition: raw_istream.h:122
void clear_error()
Definition: raw_istream.h:115
size_t read_count() const
Definition: raw_istream.h:112
Definition: raw_istream.h:131
raw_mem_istream(const char *str)
Definition: raw_istream.h:141
raw_mem_istream(std::string &str)
Definition: raw_istream.h:134
raw_mem_istream(std::span< const uint8_t > mem)
Definition: raw_istream.h:138
raw_mem_istream(const char *mem, size_t len)
Definition: raw_istream.h:143
size_t in_avail() const override
raw_mem_istream(std::span< const char > mem)
Definition: raw_istream.h:136
basic_string_view< char > string_view
Definition: core.h:520
constexpr auto count() -> size_t
Definition: core.h:1204
constexpr common_t< T1, T2 > min(const T1 x, const T2 y) noexcept
Compile-time pairwise minimum function.
Definition: min.hpp:35
EIGEN_CONSTEXPR Index size(const T &x)
Definition: Meta.h:479
Definition: StdDeque.h:50
static constexpr const velocity::meters_per_second_t c(299792458.0)
Speed of light in vacuum.
/file This file defines the SmallVector class.
Definition: AprilTagFieldLayout.h:18
Definition: format.h:1544