Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

ParserSharedInputState.hpp

Go to the documentation of this file.
00001 #ifndef INC_ParserSharedInputState_hpp__
00002 #define INC_ParserSharedInputState_hpp__
00003 
00004 /* ANTLR Translator Generator
00005  * Project led by Terence Parr at http://www.jGuru.com
00006  * Software rights: http://www.antlr.org/license.html
00007  *
00008  * $Id: ParserSharedInputState.hpp,v 1.1 2004/10/08 16:27:34 dfisher Exp $
00009  */
00010 
00011 #include <antlr/config.hpp>
00012 #include <antlr/TokenBuffer.hpp>
00013 #include <antlr/RefCount.hpp>
00014 #include <string>
00015 
00016 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
00017 namespace antlr {
00018 #endif
00019 
00025 class ANTLR_API ParserInputState {
00026 public:
00031         ParserInputState( TokenBuffer* in )
00032         : guessing(0)
00033         , filename()
00034         , input(in)
00035         , inputResponsible(true)
00036         {
00037         }
00041         ParserInputState( TokenBuffer& in )
00042         : guessing(0)
00043         , filename("")
00044         , input(&in)
00045         , inputResponsible(false)
00046         {
00047         }
00048 
00049         virtual ~ParserInputState()
00050         {
00051                 if (inputResponsible)
00052                         delete input;
00053         }
00054 
00055         TokenBuffer& getInput( void )
00056         {
00057                 return *input;
00058         }
00059 
00061         void reset( void )
00062         {
00063                 input->reset();
00064                 guessing = 0;
00065         }
00066 
00067 public:
00069         int guessing;
00073         ANTLR_USE_NAMESPACE(std)string filename;
00074 private:
00076         TokenBuffer* input;
00078         bool inputResponsible;
00079 
00080         // we don't want these:
00081         ParserInputState(const ParserInputState&);
00082         ParserInputState& operator=(const ParserInputState&);
00083 };
00084 
00086 typedef RefCount<ParserInputState> ParserSharedInputState;
00087 
00088 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
00089 }
00090 #endif
00091 
00092 #endif //INC_ParserSharedInputState_hpp__

Generated on Wed Nov 3 12:59:01 2004 for Lemur Toolkit by doxygen1.2.18