From 122b50e26dcea38bcb7814a0846a528d8b23732a Mon Sep 17 00:00:00 2001 From: mes5k Date: Mon, 11 Apr 2011 00:08:41 +0000 Subject: [PATCH] patch that allows arg start strings to be pound defined to easily conform to different platforms --- include/tclap/Arg.h | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/include/tclap/Arg.h b/include/tclap/Arg.h index 31accb4..b28eef1 100644 --- a/include/tclap/Arg.h +++ b/include/tclap/Arg.h @@ -64,12 +64,15 @@ namespace TCLAP { class Arg { private: + /** + * Prevent accidental copying. + */ + Arg(const Arg& rhs); - /** - * Prevent accidental copying - */ - Arg(const Arg& rhs); - Arg& operator=(const Arg& rhs); + /** + * Prevent accidental copying. + */ + Arg& operator=(const Arg& rhs); /** * Indicates whether the rest of the arguments should be ignored. @@ -214,21 +217,32 @@ class Arg static char blankChar() { return (char)7; } /** - * The char that indicates the beginning of a flag. Currently '-'. + * The char that indicates the beginning of a flag. Defaults to '-', but + * clients can define TCLAP_FLAGSTARTCHAR to override. */ - static char flagStartChar() { return '-'; } +#ifndef TCLAP_FLAGSTARTCHAR +#define TCLAP_FLAGSTARTCHAR '-' +#endif + static char flagStartChar() { return TCLAP_FLAGSTARTCHAR; } /** - * The sting that indicates the beginning of a flag. Currently "-". - * Should be identical to flagStartChar. + * The sting that indicates the beginning of a flag. Defaults to "-", but + * clients can define TCLAP_FLAGSTARTSTRING to override. Should be the same + * as TCLAP_FLAGSTARTCHAR. */ - static const std::string flagStartString() { return "-"; } +#ifndef TCLAP_FLAGSTARTSTRING +#define TCLAP_FLAGSTARTSTRING "-" +#endif + static const std::string flagStartString() { return TCLAP_FLAGSTARTSTRING; } /** - * The sting that indicates the beginning of a name. Currently "--". - * Should be flagStartChar twice. + * The sting that indicates the beginning of a name. Defaults to "--", but + * clients can define TCLAP_NAMESTARTSTRING to override. */ - static const std::string nameStartString() { return "--"; } +#ifndef TCLAP_NAMESTARTSTRING +#define TCLAP_NAMESTARTSTRING "--" +#endif + static const std::string nameStartString() { return TCLAP_NAMESTARTSTRING; } /** * The name used to identify the ignore rest argument.