Logo Search packages:      
Sourcecode: passwordmaker-cli version File versions  Download package

void TCLAP::StdOutput::_shortUsage ( CmdLineInterface c,
std::ostream &  os 
) const [inline, protected]

Writes a brief usage message with short args.

Parameters:
c- The CmdLine object the output is generated for.
os- The stream to write the message to.

Definition at line 148 of file StdOutput.h.

References TCLAP::XorHandler::contains(), TCLAP::CmdLineInterface::getArgList(), TCLAP::CmdLineInterface::getProgramName(), TCLAP::CmdLineInterface::getXorHandler(), and spacePrint().

Referenced by failure(), and usage().

{
      std::list<Arg*> argList = _cmd.getArgList();
      std::string progName = _cmd.getProgramName();
      XorHandler xorHandler = _cmd.getXorHandler();
      std::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();

      std::string s = progName + " ";

      // first the xor
      for ( int i = 0; (unsigned int)i < xorList.size(); i++ )
      {
            s += " {";
            for ( ArgVectorIterator it = xorList[i].begin(); 
                                    it != xorList[i].end(); it++ )
                  s += (*it)->shortID() + "|";

            s[s.length()-1] = '}';
      }

      // then the rest
      for (ArgListIterator it = argList.begin(); it != argList.end(); it++)
            if ( !xorHandler.contains( (*it) ) )
                  s += " " + (*it)->shortID();

      // if the program name is too long, then adjust the second line offset 
      int secondLineOffset = (int)(progName.length()) + 2;
      if ( secondLineOffset > 75/2 )
                  secondLineOffset = (int)(75/2);

      spacePrint( std::cout, s, 75, 3, secondLineOffset );
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index