coan  6.0.1
A C/C++ Configuration Analyzer
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
parse_buffer Struct Reference

struct parse_buffer is a polymorphic base for classes representing possibly extensible lines of parsed text. More...

#include <parse_buffer.h>

Inheritance diagram for parse_buffer:
parsed_line

Public Types

using value_type = char
 Value-type of parse_buffer
 

Public Member Functions

 parse_buffer ()=default
 Default constuctor.
 
virtual ~parse_buffer ()
 Destructor.
 
 parse_buffer (std::string const &str)
 Explicitly construct from an std::string
 
parse_bufferoperator= (parse_buffer const &)=default
 Assign another parse_buffer
 
parse_bufferoperator= (std::string const &str)
 Assign an std::string
 
bool operator== (parse_buffer const &other) const
 Equality.
 
bool operator!= (parse_buffer const &other) const
 Inequality operator.
 
size_t size () const
 Get the length of the parse_buffer
 
 operator std::string const & () const
 Explicitly cast to std::string
 
std::string substr (size_t start, size_t len=std::string::npos) const
 Get a substring of the parse_buffer.
 
bool overshoot (size_t off=0) const
 Say whether an offset is out of tange.
 
char at (size_t off) const
 Get the character indexed by an offset. Not range-checked.
 
char & at (size_t off)
 Get a reference to the character an offset. Not range-checked.
 
char operator[] (size_t off) const
 Get the character at an offset. Not range checked.
 
char & operator[] (size_t offset)
 Get a reference to the character at an offset. Not range checked.
 
void clear ()
 Empty the parse_buffer.
 
unsigned eol (size_t offset) const
 Say whether there is a newline sequence at an offset. More...
 
virtual size_t extend ()
 Extend the string, perhaps. More...
 
virtual size_t extension_pending (size_t off) const
 Test whether an extension of the string is pending at an offset. More...
 
virtual size_t extend (size_t skip)
 Extend the string, perhaps. More...
 
std::string & str ()
 Get a [const] reference to the underlying std::string.
 
std::string const & str () const
 
char const * data () const
 Get a [const] pointer to the data.
 
char * data ()
 

Protected Attributes

std::string _text
 The data.
 

Detailed Description

struct parse_buffer is a polymorphic base for classes representing possibly extensible lines of parsed text.

Definition at line 51 of file parse_buffer.h.

Member Function Documentation

unsigned parse_buffer::eol ( size_t  offset) const
inline

Say whether there is a newline sequence at an offset.

Parameters
offsetAn offset into the parse_buffer
Returns
0 to indicate the there is no newline sequence at offset; otherwise the length of the newline sequence at offset

Definition at line 156 of file parse_buffer.h.

virtual size_t parse_buffer::extend ( )
inlinevirtual

Extend the string, perhaps.

Returns
The number of characters by which the string is extended.

The virtual member function may either do nothing or it may attempt to extend the string by appending characters from some opaque source.

Reimplemented in parsed_line.

Definition at line 168 of file parse_buffer.h.

virtual size_t parse_buffer::extend ( size_t  skip)
inlinevirtual

Extend the string, perhaps.

Parameters
skipThe number of characters currently ahead of the cursor that constitute a sequence betokening an extension. This should be the value returned immediately beforehand by extension_pending()
Returns
The net number of characters by which the string is extended.

The virtual member function shall do nothing if skip is 0. Otherwise it may either do nothing or it may attempt to extend the string by appending characters from some opaque source, possibly replacing up to skip characters that are ahead of the cursor.

Reimplemented in parsed_line.

Definition at line 202 of file parse_buffer.h.

virtual size_t parse_buffer::extension_pending ( size_t  off) const
inlinevirtual

Test whether an extension of the string is pending at an offset.

Parameters
offThe offset at which to test.

The virtual member function shall return a value to indicate whether a sequence of characters at offset off betokens a logical extension of the string already in the buffer.

Returns
0 if no extension is betokened. Otherwise the length of the character sequence that betokens an extension.

Reimplemented in parsed_line.

Definition at line 183 of file parse_buffer.h.


The documentation for this struct was generated from the following file: