00001 // ===================================================================== 00002 // $Id: TMacroFileParser.hh,v 1.1.1.1 2003/06/27 02:56:42 goiwai Exp $ 00003 // $Name: CLDAQ-1-06-00 $ 00004 // ===================================================================== 00005 #ifndef __TMACROFILEPARSER_HH 00006 #define __TMACROFILEPARSER_HH 00007 00008 #include "Tglobals.h" 00009 00010 class TMacroFileParser 00011 { 00012 00013 private: 00014 Tstring theMacroFileName; 00015 TstringList theCommentStringList; 00016 Tifstream theMacroFileStream; 00017 00018 public: 00019 TMacroFileParser(); 00020 TMacroFileParser( const Tstring& input ); 00021 TMacroFileParser( const Tstring& input, const TstringList& comment ); 00022 TMacroFileParser( const TMacroFileParser& right ); 00023 ~TMacroFileParser(); 00024 00025 public: 00026 Tvoid Open(); 00027 Tvoid Open( const Tstring& filename ); 00028 Tbool IsOpen(); 00029 Tbool IsGood() const; 00030 Tbool IsFail() const; 00031 Tbool IsEndOfFile() const; 00032 Tbool IsSuccess(); 00033 Tvoid Close(); 00034 TstringList ReadLine(); 00035 Tbool IsExecutable( const TstringList& readbuf ) const; 00036 Tstring GetCommand( const TstringList& readbuf ) const; 00037 TstringList GetArguments( const TstringList& readbuf ) const; 00038 00039 public: 00040 const Tstring& GetMacroFileName() const; 00041 Tvoid SetMacroFileName( const Tstring& filename ); 00042 const TstringList& GetCommentStringList() const; 00043 TstringList GetCommentStringList(); 00044 Tvoid SetCommentStringList( const TstringList& list ); 00045 Tifstream& GetMacroFileStream(); 00046 00047 private: 00048 Tvoid checkFileStream(); 00049 TstringList divideLine( Tstring& readline ) const; 00050 const Tstring& eraseComment( Tstring& readline ) const; 00051 00052 }; 00053 00054 inline const Tstring& TMacroFileParser::GetMacroFileName() const 00055 { 00056 return( theMacroFileName ); 00057 } 00058 00059 inline Tvoid TMacroFileParser::SetMacroFileName( const Tstring& filename ) 00060 { 00061 theMacroFileName = filename; 00062 return; 00063 } 00064 00065 inline const TstringList& TMacroFileParser::GetCommentStringList() const 00066 { 00067 return( theCommentStringList ); 00068 } 00069 00070 inline TstringList TMacroFileParser::GetCommentStringList() 00071 { 00072 return( theCommentStringList ); 00073 } 00074 00075 inline Tvoid TMacroFileParser::SetCommentStringList( const TstringList& list ) 00076 { 00077 theCommentStringList = list; 00078 return; 00079 } 00080 00081 inline Tifstream& TMacroFileParser::GetMacroFileStream() 00082 { 00083 return( theMacroFileStream ); 00084 } 00085 00086 00087 #endif