Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FX::FXParseBuffer Class Reference

FXParseBuffer manages pointers to a buffer for various file format parsers. More...

#include <FXParseBuffer.h>

Inheritance diagram for FX::FXParseBuffer:
FX::FXINI FX::FXJSON FX::FXXML FX::FXINIFile FX::FXJSONFile FX::FXJSONString FX::FXXMLFile FX::FXXMLString

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
 

Detailed Description

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.

Member Enumeration Documentation

◆ Direction

Enumerator
Save 

Not active.

Load 

Save to device.

Constructor & Destructor Documentation

◆ FXParseBuffer()

FX::FXParseBuffer::FXParseBuffer ( FXchar *  buffer,
FXuval  sz = 4096,
Direction  d = Load 
)

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.


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

Copyright © 1997-2022 Jeroen van der Zijp