mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-09-12 05:35:08 -04:00
added usage stuff
This commit is contained in:
parent
f951dccd84
commit
e1d1339530
@ -31,5 +31,6 @@
|
||||
#include <tclap/Visitor.h>
|
||||
#include <tclap/XorHandler.h>
|
||||
#include <tclap/CommandLine.h>
|
||||
#include <tclap/PrintSensibly.h>
|
||||
|
||||
#endif
|
||||
|
@ -33,10 +33,12 @@
|
||||
#include <tclap/SwitchArg.h>
|
||||
#include <tclap/Visitor.h>
|
||||
#include <tclap/XorHandler.h>
|
||||
#include <tclap/PrintSensibly.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
#include <cstdio>
|
||||
#include <cstdarg>
|
||||
#include <iomanip>
|
||||
@ -101,6 +103,19 @@ class CmdLine
|
||||
*/
|
||||
bool _emptyCombined(const string& s);
|
||||
|
||||
/**
|
||||
* Writes a brief usage message with short args.
|
||||
* \param os - The stream to write the message to.
|
||||
*/
|
||||
void _shortUsage( ostream& os );
|
||||
|
||||
/**
|
||||
* Writes a longer usage message with long and short args,
|
||||
* provides descriptions and prints message.
|
||||
* \param os - The stream to write the message to.
|
||||
*/
|
||||
void _longUsage( ostream& os );
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
@ -13,5 +13,6 @@ libtclapinclude_HEADERS = ArgException.h \
|
||||
HelpVisitor.h \
|
||||
SwitchArg.h \
|
||||
VersionVisitor.h \
|
||||
IgnoreRestVisitor.h
|
||||
IgnoreRestVisitor.h \
|
||||
PrintSensibly.h
|
||||
|
||||
|
51
include/tclap/PrintSensibly.h
Normal file
51
include/tclap/PrintSensibly.h
Normal file
@ -0,0 +1,51 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* file: PrintSensibly.h
|
||||
*
|
||||
* Copyright (c) 2004, Michael E. Smoot .
|
||||
* All rights reverved.
|
||||
*
|
||||
* See the file COPYING in the top directory of this distribution for
|
||||
* more information.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __PRINTSENSIBLY_HH__
|
||||
#define __PRINTSENSIBLY_HH__
|
||||
|
||||
#include <ostream>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace TCLAP {
|
||||
|
||||
/**
|
||||
* This function inserts line breaks and indents long strings according the
|
||||
* params input. It will only break lines at spaces, commas and pipes.
|
||||
* \param os - The stream to be printed to.
|
||||
* \param s - The string to be printed.
|
||||
* \param maxWidth - The maxWidth allowed for the output line.
|
||||
* \param indentSpaces - The number of spaces to indent the first line.
|
||||
* \param secondLineOffset - The number of spaces to indent the second
|
||||
* and all subsequent lines in addition to indentSpaces.
|
||||
*/
|
||||
void spacePrint( ostream& os,
|
||||
const string& s,
|
||||
int maxWidth,
|
||||
int indentSpaces=0,
|
||||
int secondLineOffset=0 );
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -23,9 +23,11 @@
|
||||
#define __ORHANDLER_HH__
|
||||
|
||||
#include <tclap/Arg.h>
|
||||
#include <tclap/PrintSensibly.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <ostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -67,14 +69,15 @@ class XorHandler
|
||||
int check( const Arg* a );
|
||||
|
||||
/**
|
||||
* Prints the XOR specific short usage.
|
||||
* Returns the XOR specific short usage.
|
||||
*/
|
||||
void shortUsage();
|
||||
string shortUsage();
|
||||
|
||||
/**
|
||||
* Prints the XOR specific long usage.
|
||||
* \param os - Stream to print to.
|
||||
*/
|
||||
void longUsage();
|
||||
void printLongUsage(ostream& os);
|
||||
|
||||
/**
|
||||
* Simply checks whether the Arg is contained in one of the arg
|
||||
|
Loading…
x
Reference in New Issue
Block a user