![]() |
Bitcoin Core 31.99.0
P2P Digital Currency
|
#include <string.h>
Public Member Functions | |
| LineReader (std::string_view str, size_t max_line_length) | |
| std::optional< std::string_view > | ReadLine () LIFETIMEBOUND |
| Returns a string from current iterator position up to (but not including) next and advances iterator to the character following the on success. More... | |
| std::string_view | ReadLength (size_t len) LIFETIMEBOUND |
| Returns string from current iterator position of specified length if possible and advances iterator on success. More... | |
| size_t | Remaining () const |
| Returns remaining size of bytes in buffer. More... | |
| size_t | Consumed () const |
| Returns number of bytes already read from buffer. More... | |
Private Attributes | |
| const std::string_view | m_str |
| const size_t | m_max_line_length |
| std::string_view::iterator | m_it |
|
explicit |
Definition at line 20 of file string.cpp.
| size_t util::LineReader::Consumed | ( | ) | const |
Returns number of bytes already read from buffer.
Definition at line 73 of file string.cpp.
| std::string_view util::LineReader::ReadLength | ( | size_t | len | ) |
Returns string from current iterator position of specified length if possible and advances iterator on success.
May exceed max_line_length but will not read past end of buffer.
| [in] | len | The number of bytes to read from the buffer |
| a | std::runtime_error if there is not enough data in the buffer. |
Definition at line 59 of file string.cpp.
| std::optional< std::string_view > util::LineReader::ReadLine | ( | ) |
Returns a string from current iterator position up to (but not including) next
and advances iterator to the character following the
on success.
Will not return a line longer than max_line_length.
| a | std::runtime_error if max_line_length + 1 bytes are read without finding . |
Definition at line 23 of file string.cpp.
| size_t util::LineReader::Remaining | ( | ) | const |
Returns remaining size of bytes in buffer.
Definition at line 68 of file string.cpp.