/*************************************************************** ** Name: fileparser.h ** Author: Leo Liberti ** Source: GNU C++ ** Purpose: www exploring topologizer - file parser (header) ** History: 060820 work started ****************************************************************/ #ifndef _WETFILEPARSERH #define _WETFILEPARSERH #include #include class FileParserException { public: FileParserException(); ~FileParserException(); }; class FileParser { public: FileParser(); FileParser(std::string theFileName, std::string theParseTag); ~FileParser(); void setFileName(std::string theFileName); std::string getFileName(void) const; void setParseTag(std::string theParseTag); std::string getParseTag(void) const; // parse the file and build the list of parsed strings void parse(void) throw(FileParserException); // get the number of parsed strings after parsing int getNumberOfParsedStrings(void) const; // get the i-th parsed string std::string getParsedString(int i) const throw(FileParserException); protected: std::string fileName; std::string parseTag; // compare two strings (case insensitive), return 0 if equal int compareCaseInsensitive(const std::string& s1, const std::string& s2) const; // return true if s2 is the tail (case insensitive) of string s1 bool isTailCaseInsensitive(const std::string& s1, const std::string& s2) const; private: std::vector parsedString; }; #endif