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

JBLToken.h

Go to the documentation of this file.
00001 
00015 #ifndef __JBLTOKEN_H
00016 #define __JBLTOKEN_H
00017 
00018 #include <string>
00019 #include <iosfwd>
00020 
00021 
00022 
00023 //  Class JBLToken:
00025 
00038 class JBLToken {
00039   private:
00040     enum Type {EMPTY, UNKNOWN, IDENTIFIER, INT, FLOAT, BOOL, OPERATOR, PARANTHESIS};
00041   
00042   public:
00043     JBLToken();
00044     
00045     bool input(std::istream& is);
00046     
00047     bool isEmpty()  const      {return type == EMPTY;}
00048     bool isUnknown() const     {return type == UNKNOWN;}
00049     bool isIdentifier() const  {return type == IDENTIFIER;}
00050     bool isNumber() const      {return (type == INT) || (type == FLOAT) ;}
00051     bool isInt()  const        {return type == INT;}
00052     bool isFloat()  const      {return type == FLOAT;}
00053     bool isBool()  const       {return type == BOOL;}
00054     bool isOperator() const    {return type == OPERATOR;}
00055     bool isParanthesis() const {return type == PARANTHESIS;}
00056     
00057     int                getIntValue() const    {return intvalue; }
00058     float              getFloatValue() const  {return floatvalue; }
00059     bool               getBoolValue() const   {return boolvalue; }
00060     const std::string& getStringValue() const {return stringvalue;}
00061     
00062     std::ostream& print(std::ostream& os) const;
00063     
00064   private:
00065     std::string stringvalue;
00066     int         intvalue;
00067     float       floatvalue;
00068     bool        boolvalue;
00069     Type        type;
00070     
00071     static bool isoperator (char c);
00072     static bool issimpleoperator (char c);
00073     static bool isparanthesis (char c);
00074 };
00075 
00077 
00081 std::istream& operator>> (std::istream& is, JBLToken& token);
00082 
00084 
00088 std::ostream& operator<< (std::ostream& os, const JBLToken& token);
00089 
00090 #endif /* #ifndef __JBLTOKEN_H */

Generated on Thu Oct 26 12:52:58 2006 for SFH by doxygen 1.3.2