00001 // ===================================================================== 00002 // $Id: TUnaliasCommand.cc,v 1.4 2004/03/07 10:30:28 goiwai Exp $ 00003 // $Name: CLDAQ-1-14-03 $ 00004 // $Log: TUnaliasCommand.cc,v $ 00005 // Revision 1.4 2004/03/07 10:30:28 goiwai 00006 // ROOTに組みこむためのおまじないマクロを埋めこみました。 00007 // 全てにおいて完全に動作するわけではありません。 00008 // 00009 // Revision 1.3 2003/10/06 17:02:37 goiwai 00010 // *** empty log message *** 00011 // 00012 // Revision 1.2 2003/07/30 16:17:33 goiwai 00013 // ファイルにコミットログをつけることにしました. 00014 // 00015 // ===================================================================== 00016 #include "TUnaliasCommand.hh" 00017 #include "TRunManager.hh" 00018 #include "TUserInterface.hh" 00019 #include "TCommandSpecified.hh" 00020 00021 static const Tstring _name = "unalias"; 00022 static const Tstring _desc = "removes all aliases whose names match pattern.\n`unalias *' thus removes all aliases."; 00023 00024 TUnaliasCommand::TUnaliasCommand( TRunManager* manager ) 00025 : TCommand( manager, _name, _desc ) 00026 {;} 00027 00028 TUnaliasCommand::~TUnaliasCommand() 00029 {;} 00030 00031 Tvoid TUnaliasCommand::Execute( const TstringList& arguments ) 00032 { 00033 if ( arguments.size() != 1 ) { 00034 ShowCommandDetail(); 00035 return; 00036 } 00037 00038 TUserInterface* ui = theRunManager -> GetUserInterface(); 00039 00040 if ( ui ) { 00041 TCommandTable& table = ui -> GetCommandTable(); 00042 if ( arguments[ 0 ] == "*" ) { 00043 for ( Tint i = 0; i < table.GetSize(); i ++ ) { 00044 if ( table[ i ].IsAliasedCommand() ) { 00045 table.RemoveCommand( i ); 00046 } 00047 } 00048 } else { 00049 Tstring abspath = ui -> ModifyPath( arguments[ 0 ] ); 00050 for ( Tint i = 0; i < table.GetSize(); i ++ ) { 00051 if ( table[ i ].IsAliasedCommand() && table[ i ].GetFullName() == abspath ) { 00052 table.RemoveCommand( i ); 00053 return; 00054 } 00055 } 00056 } 00057 } 00058 return; 00059 } 00060 00061 #ifdef __CLDAQ_ROOT_DLL 00062 ClassImp(TUnaliasCommand) 00063 #endif