|
Sponge
CS144's user-space TCP library
|
Go to the documentation of this file. 1 #ifndef SPONGE_LIBSPONGE_BUFFER_HH
2 #define SPONGE_LIBSPONGE_BUFFER_HH
27 std::string_view
str()
const {
34 operator std::string_view()
const {
return str(); }
38 uint8_t
at(
const size_t n)
const {
return str().at(n); }
41 size_t size()
const {
return str().size(); }
129 #endif // SPONGE_LIBSPONGE_BUFFER_HH
BufferList(Buffer buffer)
Construct from a Buffer.
std::shared_ptr< std::string > _storage
std::string copy() const
Make a copy to a new std::string.
BufferViewList(const char *s)
Construct from a C string (must be NULL-terminated)
A non-owning temporary view (similar to std::string_view) of a discontiguous string.
void append(const BufferList &other)
Append a BufferList.
void remove_prefix(size_t n)
Discard the first n bytes of the string (does not require a copy or move)
A reference-counted discontiguous string that can discard bytes from the front.
BufferList(std::string &&str) noexcept
Construct by taking ownership of a std::string.
Buffer(std::string &&str) noexcept
Construct by taking ownership of a string.
A reference-counted read-only string that can discard bytes from the front.
uint8_t at(const size_t n) const
Get character at location n
void remove_prefix(const size_t n)
Discard the first n bytes of the string (does not require a copy or move)
std::deque< Buffer > _buffers
size_t size() const
Size of the string.
std::deque< std::string_view > _views
std::vector< iovec > as_iovecs() const
Convert to a vector of iovec structures.
BufferViewList(const std::string &str)
Construct from a std::string.
size_t size() const
Size of the string.
const std::deque< Buffer > & buffers() const
Access the underlying queue of Buffers.
size_t size() const
Size of the string.
BufferViewList(std::string_view str)
Construct from a std::string_view.
std::string_view str() const
void remove_prefix(size_t n)
Discard the first n bytes of the string (does not require a copy or move)
std::string concatenate() const
Make a copy to a new std::string.