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