00001
00002
00003
00004
00005
00006
00007 #ifndef IEC_CSTREAM_HEADER
00008 #define IEC_CSTREAM_HEADER
00009
00010 #include <iostream>
00011 #include <fstream>
00012 #include <ostream>
00013
00014 using namespace std;
00015
00016 class ConfigPos;
00017
00023 class ConfigStream : public ifstream
00024 {
00025 unsigned long LineCount;
00026 unsigned long TagBeginPos;
00027 public:
00028 ConfigStream();
00029
00031 void open(char* FileName);
00032
00035 ConfigPos tellg();
00036
00038 ConfigPos tellTagBegin() ;
00039
00041 ConfigStream& seekg(ConfigPos& pos);
00042
00051 bool GetTag(char* buf, int len);
00052
00053
00054 void FwdToTag(const char* tag);
00055
00056 ostream& LineStamp(ostream& oS) ;
00057 inline unsigned int GetLineNo() { return LineCount;};
00058 };
00059
00064 class ConfigPos
00065 {
00066 unsigned long LineNo, StreamPos;
00067 friend class ConfigStream;
00068 public:
00069 ConfigPos();
00070 ostream& LineStamp(ostream& oS) ;
00071 inline bool operator >(ConfigPos B) { return (LineNo > B.LineNo);};
00072 inline bool operator <(ConfigPos B) { return (LineNo < B.LineNo);};
00073 inline unsigned long GetLineNo() { return LineNo; };
00074 };
00075
00076
00077 void TrimComment(char* str);
00078
00079 void eatwhite(char* str);
00080
00081 void Rtrim(char* str);
00082
00083 void Ltrim(char* str);
00084
00085 #endif // IEC_%{MODULE}_HEADER
00086