Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
|
FXParseBuffer manages pointers to a buffer for various file format parsers. More...
#include <FXParseBuffer.h>
Public Types | |
enum | Direction { Stop = 0, Save = 1, Load = 2 } |
Public Member Functions | |
FXParseBuffer () | |
Initialize parse buffer to empty. | |
FXParseBuffer (FXchar *buffer, FXuval sz=4096, Direction d=Load) | |
Initialize parse buffer with given size and direction. More... | |
FXbool | open (FXchar *buffer=nullptr, FXuval sz=4096, Direction d=Load) |
Open parse buffer with given size and direction. | |
Direction | direction () const |
Return current direction. | |
FXuval | size () const |
Return current buffer size. | |
virtual FXival | fill (FXival count) |
Read at least count bytes into buffer; return bytes available, or -1 for error. | |
virtual FXival | flush (FXival count) |
Write at least count bytes from buffer; return space available, or -1 for error. | |
FXbool | close () |
Close parse buffer. | |
virtual | ~FXParseBuffer () |
Clean up and close buffer. | |
Protected Member Functions | |
FXbool | need (FXival count) |
FXbool | emit (FXchar ch, FXint count) |
FXbool | emit (const FXchar *str, FXint count) |
Protected Attributes | |
FXchar * | begptr |
FXchar * | endptr |
FXchar * | wptr |
FXchar * | rptr |
FXchar * | sptr |
Direction | dir |
FXParseBuffer manages pointers to a buffer for various file format parsers.
It is intended to be subclassed for the particular syntax. Additional subclasses are expected to override fill() and flush() to read or write to different destinations. The default implementation works on in-memory buffer containing the entire dataset.
Initialize parse buffer with given size and direction.
Read pointer, scan pointer, and write pointer are set to beginning of buffer, unless direction is Load. When direction is Load, the write pointer is set to the end of the buffer.
Copyright © 1997-2022 Jeroen van der Zijp |