00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __NEDFILEBUFFER_H
00017 #define __NEDFILEBUFFER_H
00018
00019 #include "nedparser.h"
00020
00029 class NEDFileBuffer
00030 {
00031 private:
00032 enum {COMMENT_LINE, BLANK_LINE, CODE_LINE};
00033
00034 char *wholeFile;
00035
00036 int numLines;
00037 char **lineBeg;
00038
00039 char *end;
00040 char savedChar;
00041
00042 char *commentBuf;
00043 int commentBufLen;
00044
00045 private:
00046 int lineType(char *s);
00047 int lineContainsCode(char *s);
00048 int getIndent(char *s);
00049 int lastColumn(char *s);
00050 char *getPosition(int line, int column);
00051
00052 bool indexLines();
00053 int topLineOfBannerComment(int li);
00054 char *stripComment(const char *s);
00055
00056 public:
00060 NEDFileBuffer();
00061
00065 ~NEDFileBuffer();
00066
00072 bool readFile(const char *filename);
00073
00079 bool setData(const char *data);
00080
00088 const char *get(YYLTYPE pos);
00089
00093 const char *getFileComment();
00094
00098 const char *getBannerComment(YYLTYPE pos);
00099
00103 const char *getTrailingComment(YYLTYPE pos);
00104
00108 const char *getFullText();
00109 };
00110
00111 #endif
00112