95 std::string
const &
str()
const {
101 explicit operator std::string
const &()
const {
111 return const_cast<char *
>(
_text.data());
116 std::string
substr(
size_t start,
size_t len = std::string::npos)
const {
117 return _text.substr(start,len);
122 return off >=
size();
126 char at(
size_t off)
const {
131 char &
at(
size_t off) {
156 unsigned eol(
size_t offset)
const {
unsigned eol(CharSeq const &seq, size_t off)
Test for a newline-sequence at an offset in a character sequence.
virtual size_t extend(size_t skip)
Extend the string, perhaps.
virtual ~parse_buffer()
Destructor.
void clear()
Empty the parse_buffer.
virtual size_t extension_pending(size_t off) const
Test whether an extension of the string is pending at an offset.
parse_buffer(std::string const &str)
Explicitly construct from an std::string
parse_buffer & operator=(std::string const &str)
Assign an std::string
std::string _text
The data.
parse_buffer & operator=(parse_buffer const &)=default
Assign another parse_buffer
char & operator[](size_t offset)
Get a reference to the character at an offset. Not range checked.
bool overshoot(size_t off=0) const
Say whether an offset is out of tange.
unsigned eol(size_t offset) const
Say whether there is a newline sequence at an offset.
bool operator!=(parse_buffer const &other) const
Inequality operator.
struct parse_buffer is a polymorphic base for classes representing possibly extensible lines of parse...
char & at(size_t off)
Get a reference to the character an offset. Not range-checked.
std::string substr(size_t start, size_t len=std::string::npos) const
Get a substring of the parse_buffer.
bool operator==(parse_buffer const &other) const
Equality.
char value_type
Value-type of parse_buffer
char const * data() const
Get a [const] pointer to the data.
parse_buffer()=default
Default constuctor.
char at(size_t off) const
Get the character indexed by an offset. Not range-checked.
char operator[](size_t off) const
Get the character at an offset. Not range checked.
std::string & str()
Get a [const] reference to the underlying std::string.
virtual size_t extend()
Extend the string, perhaps.
size_t size() const
Get the length of the parse_buffer