ANTLR Support Libraries 2.7.1+
Loading...
Searching...
No Matches
antlr
CharInputBuffer.hpp
Go to the documentation of this file.
1
#ifndef INC_CharInputBuffer_hpp__
2
# define INC_CharInputBuffer_hpp__
3
4
/* ANTLR Translator Generator
5
* Project led by Terence Parr at http://www.jGuru.com
6
* Software rights: http://www.antlr.org/license.html
7
*
8
* $Id:$
9
*/
10
11
# include <
antlr/config.hpp
>
12
# include <
antlr/InputBuffer.hpp
>
13
14
# ifdef HAS_NOT_CCTYPE_H
15
# include <ctype.h>
16
# else
17
# include <cctype>
18
# endif
19
20
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
21
namespace
antlr
{
22
#endif
23
26
class
CharInputBuffer
:
public
InputBuffer
27
{
28
public
:
33
CharInputBuffer
(
unsigned
char
* buf,
size_t
size,
bool
owner =
false
)
34
:
buffer
(buf)
35
,
ptr
(buf)
36
,
end
(buf + size)
37
,
delete_buffer
(owner)
38
{
39
}
40
45
~CharInputBuffer
(
void
)
46
{
47
if
(
delete_buffer
&&
buffer
)
48
delete
[]
buffer
;
49
}
50
55
virtual
inline
void
reset
(
void
)
56
{
57
InputBuffer::reset
();
58
ptr
=
buffer
;
59
}
60
61
virtual
int
getChar
(
void
)
62
{
63
return
(
ptr
<
end
) ? *
ptr
++ : EOF;
64
}
65
66
protected
:
67
unsigned
char
*
buffer
;
68
unsigned
char
*
ptr
;
69
unsigned
char
*
end
;
70
bool
delete_buffer
;
71
};
72
73
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
74
}
75
#endif
76
77
#endif
InputBuffer.hpp
CharInputBuffer::end
unsigned char * end
end sentry for buffer
Definition
CharInputBuffer.hpp:69
CharInputBuffer::getChar
virtual int getChar(void)
Definition
CharInputBuffer.hpp:61
CharInputBuffer::reset
virtual void reset(void)
Definition
CharInputBuffer.hpp:55
CharInputBuffer::~CharInputBuffer
~CharInputBuffer(void)
Definition
CharInputBuffer.hpp:45
CharInputBuffer::buffer
unsigned char * buffer
the buffer with data
Definition
CharInputBuffer.hpp:67
CharInputBuffer::delete_buffer
bool delete_buffer
flag signifying if we have to delete the buffer
Definition
CharInputBuffer.hpp:70
CharInputBuffer::CharInputBuffer
CharInputBuffer(unsigned char *buf, size_t size, bool owner=false)
Definition
CharInputBuffer.hpp:33
CharInputBuffer::ptr
unsigned char * ptr
position ptr into the buffer
Definition
CharInputBuffer.hpp:68
InputBuffer::InputBuffer
InputBuffer()
Definition
InputBuffer.hpp:34
InputBuffer::reset
virtual void reset(void)
Reset the input buffer to empty state.
Definition
InputBuffer.hpp:46
config.hpp
antlr
Definition
ANTLRException.hpp:15
Generated by
1.14.0