class ParsingBuffer
Inherited by: DynamicParsingBuffer, and InplaceParsingBuffer.
Required header: <Eclog/ParsingBuffer.h>
The ParsingBuffer abstract class represents a buffer that stores intermediate results during a parsing process.
Name | Description |
---|---|
claim | Claims a new bytes buffer and makes it the current buffer. |
discard | Removes the last claimed bytes buffer. |
length | Returns the length of the current bytes buffer. |
address | Returns a pointer to the first byte of the current bytes buffer. |
str | Returns the current bytes buffer as a string. |
putChar | Puts a Unicode character at the end of the current bytes buffer. |
shrink | Truncates the current bytes buffer. |
virtual void* claim();
Claims a new bytes buffer and makes it the current buffer.
void*
Pointer to the internal descriptor.
virtual void discard(void* ptr);
Removes the last claimed bytes buffer.
void*
ptr Pointer earlier obtained from claim.
Returns the length of the current bytes buffer.
virtual size_t length() const;
size_t
The length.
virtual char* address();
Returns a pointer to the first byte of the current bytes buffer.
char*
Pointer to the first byte.
virtual cstring str() const;
Returns the current bytes buffer as a string. There is a null character after the last character of the returned string, making the string compatible with C-style APIs.
cstring The string.
virtual void putChar(int ch);
Puts the UTF-8 encoded bytes of Unicode character ch at the end of the current bytes buffer.
int
ch Unicode code point.
virtual void shrink(size_t length);
Truncates the current bytes buffer.
size_t
length The new length of the current bytes buffer; always less than or equal to length.