OpenMD  2.5
Molecular Dynamics in the Open
antlr::CharInputBuffer Class Reference

#include <CharInputBuffer.hpp>

Inheritance diagram for antlr::CharInputBuffer:
antlr::InputBuffer

Public Member Functions

 CharInputBuffer (unsigned char *buf, size_t size, bool owner=false)
 
 ~CharInputBuffer (void)
 
virtual void reset (void)
 
virtual int getChar (void)
 
- Public Member Functions inherited from antlr::InputBuffer
 InputBuffer ()
 
virtual ~InputBuffer ()
 
void commit (void)
 
virtual void consume ()
 
virtual void fill (unsigned int amount)
 
virtual int LA (unsigned int i)
 
virtual unsigned int mark ()
 
virtual bool isMarked () const
 Are there any marks active in the InputBuffer. More...
 
virtual void rewind (unsigned int mark)
 
virtual unsigned int entries () const
 
std ::string getLAChars () const
 
std ::string getMarkedChars () const
 

Protected Attributes

unsigned char * buffer
 the buffer with data More...
 
unsigned char * ptr
 position ptr into the buffer More...
 
unsigned char * end
 end sentry for buffer More...
 
bool delete_buffer
 flag signifying if we have to delete the buffer More...
 
- Protected Attributes inherited from antlr::InputBuffer
unsigned int nMarkers
 
unsigned int markerOffset
 
unsigned int numToConsume
 
CircularQueue< int > queue
 

Additional Inherited Members

- Protected Member Functions inherited from antlr::InputBuffer
void syncConsume ()
 

Detailed Description

CharInputBuffer.hpp provides an InputBuffer for plain character arrays (buffers).

Definition at line 26 of file CharInputBuffer.hpp.

Constructor & Destructor Documentation

◆ CharInputBuffer()

antlr::CharInputBuffer::CharInputBuffer ( unsigned char *  buf,
size_t  size,
bool  owner = false 
)
inline

Construct a CharInputBuffer.hpp object with a char* buffer of 'size' if 'owner' is true, then the buffer will be delete[]-ed on destruction.

Note
it is assumed the buffer was allocated with new[]!

Definition at line 33 of file CharInputBuffer.hpp.

◆ ~CharInputBuffer()

antlr::CharInputBuffer::~CharInputBuffer ( void  )
inline

Destructor

Note
If you're using malloced data, then you probably need to change this destructor. Or better use this class as template for your own.

Definition at line 45 of file CharInputBuffer.hpp.

References buffer, and delete_buffer.

Member Function Documentation

◆ getChar()

virtual int antlr::CharInputBuffer::getChar ( void  )
inlinevirtual

Override this in subclasses to get the next character

Implements antlr::InputBuffer.

Definition at line 61 of file CharInputBuffer.hpp.

References end, and ptr.

◆ reset()

virtual void antlr::CharInputBuffer::reset ( void  )
inlinevirtual

Reset the CharInputBuffer to initial state Called from LexerInputState::reset.

See also
LexerInputState

Reimplemented from antlr::InputBuffer.

Definition at line 55 of file CharInputBuffer.hpp.

References buffer, ptr, and antlr::InputBuffer::reset().

Member Data Documentation

◆ buffer

unsigned char* antlr::CharInputBuffer::buffer
protected

the buffer with data

Definition at line 67 of file CharInputBuffer.hpp.

Referenced by reset(), and ~CharInputBuffer().

◆ delete_buffer

bool antlr::CharInputBuffer::delete_buffer
protected

flag signifying if we have to delete the buffer

Definition at line 70 of file CharInputBuffer.hpp.

Referenced by ~CharInputBuffer().

◆ end

unsigned char* antlr::CharInputBuffer::end
protected

end sentry for buffer

Definition at line 69 of file CharInputBuffer.hpp.

Referenced by getChar().

◆ ptr

unsigned char* antlr::CharInputBuffer::ptr
protected

position ptr into the buffer

Definition at line 68 of file CharInputBuffer.hpp.

Referenced by getChar(), and reset().


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