00001 #ifndef _FV_TOKEN_H_ 00002 #define _FV_TOKEN_H_ 00003 00004 #include <istream> 00005 #include <string> 00006 00007 class tokenis; 00008 00009 class Token : public std::string 00010 { 00011 public: 00012 Token() : std::string(), quoted(0) 00013 {} 00014 00015 Token(const char* a) : std::string(a), quoted(0) 00016 {} 00017 00018 Token& operator =(const Token& b){ 00019 std::string::operator =(b); 00020 quoted = b.quoted; 00021 return *this; 00022 } 00023 00024 friend std::istream& operator >>(std::istream& is,Token& aToken); 00025 friend tokenis& operator >>(tokenis&is,Token& aToken); 00026 int quoted; 00027 00028 // static members and functions 00029 static const char* whiteSpaces; 00030 static const char* predefinedTokens; 00031 static int commentChar; 00032 static int stringChar; 00033 static void defaultSyntax(); 00034 }; 00035 00036 class lfToken : public Token 00037 { 00038 public: 00039 lfToken() : Token(){} 00040 friend tokenis& operator >>(tokenis& is,lfToken& aToken); 00041 00042 void copy(std::string str){ 00043 std::string::operator =(str); 00044 } 00045 }; 00046 00047 class CppToken : public Token 00048 { 00049 public: 00050 CppToken& operator =(const Token& b){ 00051 Token::operator =(b); 00052 return *this; 00053 } 00054 00055 friend std::istream& operator >>(std::istream& is,CppToken& aToken); 00056 friend tokenis& operator >>(tokenis& is,CppToken& aToken); 00057 }; 00058 00059 00060 00061 #endif /* _FV_TOKEN_H_ 00062 */