Skip to content

Latest commit

 

History

History
122 lines (73 loc) · 2.29 KB

ParsingBuffer.md

File metadata and controls

122 lines (73 loc) · 2.29 KB

ParsingBuffer

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.

Member functions

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.

claim

virtual void* claim();

Claims a new bytes buffer and makes it the current buffer.

Return value

void* Pointer to the internal descriptor.


discard

virtual void discard(void* ptr);

Removes the last claimed bytes buffer.

Parameters

void* ptr Pointer earlier obtained from claim.


length

Returns the length of the current bytes buffer.

virtual size_t length() const;

Return value

size_t The length.


address

virtual char* address();

Returns a pointer to the first byte of the current bytes buffer.

Return value

char* Pointer to the first byte.


str

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.

Return value

cstring The string.


putChar

virtual void putChar(int ch);

Puts the UTF-8 encoded bytes of Unicode character ch at the end of the current bytes buffer.

Parameters

int ch Unicode code point.


shrink

virtual void shrink(size_t length);

Truncates the current bytes buffer.

Parameters

size_t length The new length of the current bytes buffer; always less than or equal to length.