Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 #include "cmtkCommandLine.h"
00033 
00034 mxml_node_t*
00035 cmtk::CommandLine::KeyToActionSingle
00036 ::MakeXML( mxml_node_t *const parent ) const
00037 {
00038   if ( ! (this->m_Properties & PROPS_NOXML) )
00039     {
00040     return this->Superclass::MakeXML( this->m_Action->MakeXML( parent ) );
00041     }
00042   return NULL;
00043 }
00044 
00045 void
00046 cmtk::CommandLine::KeyToActionSingle
00047 ::PrintHelp( const size_t globalIndent ) const
00048 {
00049   std::ostringstream fmt;
00050   this->Superclass::FormatHelp( fmt );
00051 
00052   this->m_Action->PrintHelp( fmt );
00053   StdErr.FormatText( fmt.str(), CommandLine::HelpTextIndent + globalIndent, StdErr.GetLineWidth(), -CommandLine::HelpTextIndent ) << "\n";  
00054 }
00055 
00056 void
00057 cmtk::CommandLine::KeyToActionSingle
00058 ::PrintWikiWithPrefix( const std::string& prefix ) const
00059 {
00060   this->Superclass::PrintWikiWithPrefix( prefix );
00061   
00062   this->m_Action->PrintWiki();
00063   StdOut << "\n";
00064 }
00065 
00066 bool
00067 cmtk::CommandLine::KeyToActionSingle
00068 ::MatchAndExecute( const std::string& key, const size_t argc, const char* argv[], size_t& index )
00069 {
00070   if ( this->MatchLongOption( std::string( key ) ) )
00071     {
00072     this->m_Action->Evaluate( argc, argv, index );
00073     return true;
00074     }
00075   return false;
00076 }
00077 
00078 bool
00079 cmtk::CommandLine::KeyToActionSingle
00080 ::MatchAndExecute( const char keyChar, const size_t argc, const char* argv[], size_t& index )
00081 {
00082   if ( this->m_Key.m_KeyChar == keyChar )
00083     {
00084     this->m_Action->Evaluate( argc, argv, index );
00085     return true;
00086     }
00087 
00088   return false;
00089 }