00001 #ifndef _FV_TOKENIS_H_
00002 #define _FV_TOKENIS_H_
00003
00004 #include <iostream>
00005 #include "fv_token.h"
00006
00007 class Token;
00008
00009 class tokenis
00010 {
00011 public:
00012 tokenis(std::istream& isToAttach);
00013 int get();
00014 tokenis& getline(signed char* buf, int size, char c= '\n');
00015 tokenis& getline(unsigned char* buf, int size, char c= '\n');
00016 tokenis& nextline();
00017 long getCounter()
00018 { return lineCounter; }
00019 operator std::istream&()
00020 { return is; }
00021 operator int()
00022 { return is.good(); }
00023 void clear(int state= 0)
00024 {
00025 #ifdef WIN32
00026 is.clear(state);
00027 #else
00028 is.clear(static_cast<std::_Ios_Iostate>(state));
00029 #endif
00030 }
00031 int eof()const{return is.eof();}
00032 int peek()
00033 { return is.peek(); }
00034 int good() const
00035 { return is.good(); }
00036 Token lastToken;
00037 friend tokenis& putback(tokenis& is,Token& aToken);
00038 long tokenCounter;
00039 long lineCounter;
00040
00041 protected:
00042 std::istream& is;
00043
00044 private:
00045 void init()
00046 { lineCounter = 1; tokenCounter = 0; lastToken = ""; }
00047 };
00048
00049
00050 #endif
00051