2000-03-22 22:01:33 +00:00
|
|
|
#ifndef _PARSE_FILE_H_
|
|
|
|
#define _PARSE_FILE_H_
|
|
|
|
|
2000-10-02 21:49:04 +00:00
|
|
|
#include <simgear/compiler.h>
|
|
|
|
|
2000-03-22 22:01:33 +00:00
|
|
|
#include <string>
|
|
|
|
#include <list>
|
|
|
|
#include <fstream>
|
|
|
|
|
2001-03-23 22:59:18 +00:00
|
|
|
SG_USING_STD(list);
|
|
|
|
SG_USING_STD(string);
|
|
|
|
SG_USING_STD(getline);
|
|
|
|
SG_USING_STD(ifstream);
|
2000-09-21 22:59:27 +00:00
|
|
|
|
2000-03-22 22:01:33 +00:00
|
|
|
#define DELIMITERS " \t"
|
|
|
|
#define COMMENT "#"
|
|
|
|
|
|
|
|
#define MAXLINE 200 // Max size of the line of the input file
|
|
|
|
|
|
|
|
typedef list<string> stack; //list to contain the input file "command_lines"
|
|
|
|
|
|
|
|
class ParseFile
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
|
|
|
stack commands;
|
|
|
|
ifstream file;
|
|
|
|
void readFile();
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
ParseFile() {}
|
|
|
|
ParseFile(const string fileName);
|
|
|
|
~ParseFile();
|
|
|
|
|
|
|
|
|
|
|
|
void removeComments(string& inputLine);
|
|
|
|
string getToken(string inputLine, int tokenNo);
|
|
|
|
void storeCommands(string inputLine);
|
|
|
|
stack getCommands();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _PARSE_FILE_H_
|