Logo Search packages:      
Sourcecode: gaffitter version File versions  Download package

void CmdLineParser::Process (  ) 

After added all options then this function process the command-line parameters searching for options and their arguments.

Definition at line 199 of file CmdLineParser.cc.

References Bool, Char, Float, Int, m_argc, m_argv, m_remains, OptionsSTRING::Match(), OptionsCHAR::Match(), OptionsBOOL::Match(), OptionsFLOAT::Match(), OptionsINT::Match(), and String.

Referenced by Params::Initialize().

{
   int i=1;
   while (i<m_argc)
   {
      bool match = false;

      if (m_argv[i][0] != '-') match = false; // not an option, skip
      else
      {
         // "--" stops the option search/processing
         if (!strcmp(m_argv[i],"--")) break;

         match = Int.Match(i, m_argv, m_argc) || Float.Match(i, m_argv, m_argc) 
             || Bool.Match(i, m_argv, m_argc) || Char.Match(i, m_argv, m_argc)
             || String.Match(i, m_argv, m_argc);

      }

      if (!match) m_remains.push_back(m_argv[i]); // not a valid option
      ++i;
   }

   // only if encountred "--": do not process the remaining
   while (++i<m_argc) { m_remains.push_back(m_argv[i]); }
}


Generated by  Doxygen 1.6.0   Back to index