KDevelop API Documentation

InputBuffer.cpp

Go to the documentation of this file.
00001 /* ANTLR Translator Generator
00002  * Project led by Terence Parr at http://www.jGuru.com
00003  * Software rights: http://www.antlr.org/RIGHTS.html
00004  *
00005  * $Id: InputBuffer.cpp,v 1.2 2003/05/02 00:36:20 okellogg Exp $
00006  */
00007 
00008 #include "antlr/config.hpp"
00009 #include "antlr/InputBuffer.hpp"
00010 
00011 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
00012 namespace antlr {
00013 #endif
00014 
00016 void InputBuffer::fill(int amount)
00017 {
00018     syncConsume();
00019     // Fill the buffer sufficiently to hold needed characters
00020     while (queue.entries() < amount + markerOffset)
00021     {
00022         // Append the next character
00023         queue.append(getChar());
00024     }
00025 }
00026 
00030 ANTLR_USE_NAMESPACE(std)string InputBuffer::getLAChars( void ) const
00031 {
00032     ANTLR_USE_NAMESPACE(std)string ret;
00033 
00034     for(int i = markerOffset; i < queue.entries(); i++)
00035         ret += queue.elementAt(i);
00036 
00037     return ret;
00038 }
00039 
00043 ANTLR_USE_NAMESPACE(std)string InputBuffer::getMarkedChars( void ) const
00044 {
00045     ANTLR_USE_NAMESPACE(std)string ret;
00046 
00047     for(int i = 0; i < markerOffset; i++)
00048         ret += queue.elementAt(i);
00049 
00050     return ret;
00051 }
00052 
00056 int InputBuffer::mark()
00057 {
00058     syncConsume();
00059     nMarkers++;
00060     return markerOffset;
00061 }
00062 
00066 void InputBuffer::rewind(int mark)
00067 {
00068     syncConsume();
00069     markerOffset = mark;
00070     nMarkers--;
00071 }
00072 
00073 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
00074 }
00075 #endif
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:03:50 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003