Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

Tokenizer.hh

Go to the documentation of this file.
00001 #ifndef XML_Tokenizer_hh_
00002 #define XML_Tokenizer_hh_
00003 
00004 #include <iostream>
00005 #include <string>
00006 #include <set>
00007 #include <stdlib.h>
00008 
00009 namespace XML {
00010 
00011 class Tokenizer {
00012 public:
00013       Tokenizer(void) : mLine(1), mStream(0), mWhiteSpace(" \t\n\r") {}
00014       Tokenizer(std::istream& inStream) : mLine(1), mStream(&inStream), mWhiteSpace(" \t\n\r") {}
00015  
00016       std::string getNextToken();
00017        bool getNextToken(std::string& outToken);
00018  
00019        void addStringToken(const std::string& inToken) {mStringTokens.insert(inToken);}
00020        void clearStringTokens() {mStringTokens.clear();}
00021       unsigned int getLineNumber() {return mLine;}
00022        std::istream* getStreamPtr() {return mStream;}
00023       const std::string& getStreamName() const {return mName;}
00024       const std::string& getSingleCharTokens() const {return mSingleCharTokens;}
00025        const std::string& getWhiteSpace() const {return mWhiteSpace;}
00026       void removeStringToken(const std::string& inToken) {mStringTokens.erase(inToken);}
00027       void setLineNumber(unsigned int inLine) {mLine = inLine;}
00028        void setStream(std::istream& inStream) {mStream = &inStream;}
00029       void setStreamName(const std::string& inName) {mName = inName;}
00030       void setSingleCharTokens(const std::string &inTokens) {mSingleCharTokens = inTokens;}
00031        void setWhiteSpace(const std::string &inWhite) {mWhiteSpace = inWhite;}
00032  
00033      protected:
00034        unsigned int mLine; 
00035        std::string mName; 
00036        std::istream* mStream; 
00037        std::string mWhiteSpace; 
00038        std::string mSingleCharTokens; 
00039        std::set<std::string> mStringTokens; 
00040 
00041 };
00042 
00043  inline int convertStringToInteger(const std::string& inString) {return atoi(inString.c_str());}
00044  inline double convertStringToFloat(const std::string& inString) {return atof(inString.c_str());}
00045 
00046 } 
00047 
00048 #endif // XML_Tokenizer_hh_
00049 
00050 

Generated on Sun Jan 16 11:05:56 2005 for RolLerCoaster by  doxygen 1.3.9.1