lib/antlr/antlr/CharInputBuffer.hpp
Go to the documentation of this file.00001
#ifndef INC_CharInputBuffer_hpp__
00002
# define INC_CharInputBuffer_hpp__
00003
00004
00005
00006
00007
00008
00009
00010
00011
# include <antlr/config.hpp>
00012
# include <antlr/InputBuffer.hpp>
00013
00014
# ifdef HAS_NOT_CCTYPE_H
00015
# include <ctype.h>
00016
# else
00017
# include <cctype>
00018
# endif
00019
00020
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
00021
namespace antlr {
00022
#endif
00023
00026 class CharInputBuffer :
public InputBuffer
00027 {
00028
public:
00033 CharInputBuffer(
unsigned char* buf, size_t size,
bool owner =
false )
00034 : buffer(buf)
00035 , ptr(buf)
00036 , end(buf +
size)
00037 , delete_buffer(owner)
00038 {
00039 }
00040
00045 ~
CharInputBuffer(
void )
00046 {
00047
if( delete_buffer && buffer )
00048
delete [] buffer;
00049 }
00050
00055 virtual inline void reset(
void )
00056 {
00057
InputBuffer::reset();
00058 ptr = buffer;
00059 }
00060
00061 virtual int getChar(
void )
00062 {
00063
return (ptr < end) ? *ptr++ : EOF;
00064 }
00065
00066
protected:
00067 unsigned char* buffer;
00068 unsigned char* ptr;
00069 unsigned char* end;
00070 bool delete_buffer;
00071 };
00072
00073
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
00074
}
00075
#endif
00076
00077
#endif
This file is part of the documentation for KDevelop Version 3.0.4.