00001 // ===================================================================== 00002 // $Id: TUserInterface.hh,v 1.2 2003/07/30 16:18:52 goiwai Exp $ 00003 // $Name: CLDAQ-1-07-01 $ 00004 // 00005 // $Log: TUserInterface.hh,v $ 00006 // Revision 1.2 2003/07/30 16:18:52 goiwai 00007 // ファイルにコミットログをつけることにしました. 00008 // 00009 // ===================================================================== 00010 #ifndef __TUSERINTERFACE_HH 00011 #define __TUSERINTERFACE_HH 00012 00013 #include "Tglobals.h" 00014 #include "TCommandHistory.hh" 00015 #include "TCommandTable.hh" 00016 00017 class TCommand; 00018 00019 class TUserInterface 00020 { 00021 00022 protected: 00023 TCommandTable theCommandTable; 00024 Tofstream theHistoryFileStream; 00025 Tstring theCurrentWorkingDirectory; 00026 TCommandHistory theCommandHistory; 00027 00028 public: 00029 TUserInterface( const Tstring& history ); 00030 virtual ~TUserInterface(); 00031 00032 public: 00033 Tint AddCommand( TCommand* command ); 00034 Tint RemoveCommand( Tint index ); 00035 Tvoid ClearCommands(); 00036 TCommand* FindCommand( const Tstring& fullname ); 00037 TCommand* FindCommand( const Tstring& name, const Tstring& path ); 00038 TCommand* GetCommand( Tint index ); 00039 TCommand* GetCommand( const Tstring& fullname ); 00040 TCommand* GetCommand( const Tstring& name, const Tstring& path ); 00041 Tvoid ExecuteCommand( const Tstring& command, const TstringList& arguments ); 00042 Tvoid ExecuteCommand( const Tstring& command ); 00043 Tint GetCurrentWorkingDirectoryLevel() const; 00044 Tstring ModifyPath( const Tstring& path ) const; 00045 00046 public: 00047 const TCommandTable& GetCommandTable() const; 00048 TCommandTable& GetCommandTable(); 00049 const Tstring& GetCurrentWorkingDirectory() const; 00050 Tstring& GetCurrentWorkingDirectory(); 00051 const TCommandHistory& GetCommandHistory() const; 00052 TCommandHistory& GetCommandHistory(); 00053 Tofstream& GetHistoryFileStream(); 00054 Tvoid SetCommandTable( const TCommandTable& table ); 00055 Tvoid SetCurrentWorkingDirectory( const Tstring& directory ); 00056 Tvoid SetCommandHistory( const TCommandHistory& history ); 00057 00058 public: 00059 virtual Tbool AcceptCommand() = 0; 00060 virtual const Tstring& GetInputCommand() = 0; 00061 00062 public: 00063 virtual Tvoid NotFoundCommand( const Tstring& commandname ) const; 00064 virtual Tvoid ClearScreen() const; 00065 virtual Tint GetNumberOfColumns() const; 00066 virtual Tint GetNumberOfLines() const; 00067 00068 }; 00069 00070 inline const TCommandTable& TUserInterface::GetCommandTable() const 00071 { 00072 return( theCommandTable ); 00073 } 00074 00075 inline TCommandTable& TUserInterface::GetCommandTable() 00076 { 00077 return( theCommandTable ); 00078 } 00079 00080 inline const Tstring& TUserInterface::GetCurrentWorkingDirectory() const 00081 { 00082 return( theCurrentWorkingDirectory ); 00083 } 00084 00085 inline Tstring& TUserInterface::GetCurrentWorkingDirectory() 00086 { 00087 return( theCurrentWorkingDirectory ); 00088 } 00089 00090 inline const TCommandHistory& TUserInterface::GetCommandHistory() const 00091 { 00092 return( theCommandHistory ); 00093 } 00094 00095 inline TCommandHistory& TUserInterface::GetCommandHistory() 00096 { 00097 return( theCommandHistory ); 00098 } 00099 00100 inline Tofstream& TUserInterface::GetHistoryFileStream() 00101 { 00102 return( theHistoryFileStream ); 00103 } 00104 00105 inline Tvoid TUserInterface::SetCommandTable( const TCommandTable& table ) 00106 { 00107 theCommandTable = table; 00108 return; 00109 } 00110 00111 inline Tvoid TUserInterface::SetCommandHistory( const TCommandHistory& history ) 00112 { 00113 theCommandHistory = history; 00114 return; 00115 } 00116 00117 #endif