PT-Cooling-Log 1.0
PTCoolingLogViewer
|
00001 #include "Usage.hh" 00002 #include "Switch.hh" 00003 00004 #include <iostream> 00005 #include <iomanip> 00006 00007 using namespace std; 00008 00009 Usage::Usage( Switch *sw ) : sw_( sw ) { 00010 this->fArgument( NO ); 00011 this->remark() = "show help message"; 00012 } 00013 00014 Usage::~Usage(){ 00015 } 00016 00017 bool Usage::operator()( const std::string& option ){ 00018 for( Switch::iterator itr = sw_->begin(); 00019 itr != sw_->end(); 00020 itr++ ){ 00021 cout << setw(12) << string( "--" + itr->first ) << flush; 00022 if( itr->second ) { 00023 if( itr->second->fArgument() == NO ) cout << " NO " << flush; 00024 if( itr->second->fArgument() == REQUIRED ) cout << " RE " << flush; 00025 if( itr->second->fArgument() == OPTIONAL ) cout << " OP " << flush; 00026 cout << itr->second->remark() << flush; 00027 } 00028 cout << endl; 00029 } 00030 this->exist() = true; 00031 return false; 00032 } 00033