Main MRPT website > C++ reference
MRPT logo
Public Member Functions | Protected Member Functions | Protected Attributes
TCLAP::StdOutput Class Reference

Detailed Description

A class that isolates any output from the CmdLine object so that it may be easily modified.

#include <mrpt/otherlibs/tclap/StdOutput.h>

Inheritance diagram for TCLAP::StdOutput:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 StdOutput (std::ostream &desired_out=std::cout)
 Prints the usage to stdout.
virtual void usage (CmdLineInterface &c)
 Prints the usage to stdout.
virtual void version (CmdLineInterface &c)
 Prints the version to stdout.
virtual void failure (CmdLineInterface &c, ArgException &e)
 Prints (to stderr) an error message, short usage Can be overridden to produce alternative behavior.

Protected Member Functions

void _shortUsage (CmdLineInterface &c, std::ostream &os) const
 Writes a brief usage message with short args.
void _longUsage (CmdLineInterface &c, std::ostream &os) const
 Writes a longer usage message with long and short args, provides descriptions and prints message.
void spacePrint (std::ostream &os, const std::string &s, int maxWidth, int indentSpaces, int secondLineOffset) const
 This function inserts line breaks and indents long strings according the params input.

Protected Attributes

std::ostreamm_my_output
 By JLBC for MRPT.

Constructor & Destructor Documentation

TCLAP::StdOutput::StdOutput ( std::ostream desired_out = std::cout) [inline]

Prints the usage to stdout.

Can be overridden to produce alternative behavior.

Parameters:
c- The CmdLine object the output is generated for.

Definition at line 53 of file StdOutput.h.


Member Function Documentation

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

Writes a longer usage message with long and short args, provides descriptions and prints message.

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

Definition at line 198 of file StdOutput.h.

References TCLAP::CmdLineInterface::getArgList(), TCLAP::CmdLineInterface::getMessage(), TCLAP::CmdLineInterface::getXorHandler(), TCLAP::XorHandler::getXorList(), begin(), spacePrint(), end(), and TCLAP::XorHandler::contains().

Referenced by usage().

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 164 of file StdOutput.h.

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

Referenced by usage(), and failure().

void TCLAP::StdOutput::failure ( CmdLineInterface c,
ArgException e 
) [inline, virtual]

Prints (to stderr) an error message, short usage Can be overridden to produce alternative behavior.

Parameters:
c- The CmdLine object the output is generated for.
e- The ArgException that caused the failure.

Implements TCLAP::CmdLineOutput.

Definition at line 141 of file StdOutput.h.

References TCLAP::CmdLineInterface::getProgramName(), TCLAP::ArgException::argId(), TCLAP::ArgException::error(), TCLAP::CmdLineInterface::hasHelpAndVersion(), _shortUsage(), and usage().

void TCLAP::StdOutput::spacePrint ( std::ostream os,
const std::string s,
int  maxWidth,
int  indentSpaces,
int  secondLineOffset 
) const [inline, protected]

This function inserts line breaks and indents long strings according the params input.

It will only break lines at spaces, commas and pipes.

Parameters:
os- The stream to be printed to.
s- The string to be printed.
maxWidth- The maxWidth allowed for the output line.
indentSpaces- The number of spaces to indent the first line.
secondLineOffset- The number of spaces to indent the second and all subsequent lines in addition to indentSpaces.

Definition at line 236 of file StdOutput.h.

Referenced by _shortUsage(), and _longUsage().

void TCLAP::StdOutput::usage ( CmdLineInterface c) [inline, virtual]

Prints the usage to stdout.

Can be overridden to produce alternative behavior.

Parameters:
c- The CmdLine object the output is generated for.

Implements TCLAP::CmdLineOutput.

Definition at line 127 of file StdOutput.h.

References m_my_output, _shortUsage(), and _longUsage().

Referenced by failure().

void TCLAP::StdOutput::version ( CmdLineInterface c) [inline, virtual]

Prints the version to stdout.

Can be overridden to produce alternative behavior.

Parameters:
c- The CmdLine object the output is generated for.

Implements TCLAP::CmdLineOutput.

Definition at line 118 of file StdOutput.h.

References TCLAP::CmdLineInterface::getProgramName(), TCLAP::CmdLineInterface::getVersion(), and m_my_output.


Member Data Documentation

By JLBC for MRPT.

Definition at line 45 of file StdOutput.h.

Referenced by version(), usage(), and _shortUsage().




Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011