/////////////////////////////////////////////////////////////////////////////
// Name: cmdline.h
-// Purpose: documentation for wxCmdLineParser class
+// Purpose: interface of wxCmdLineParser
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
It has the following features:
- distinguishes options, switches and parameters; allows option grouping
- allows both short and long options
- automatically generates the usage message from the command line description
- does type checks on the options values (number, date, ...).
+ - distinguishes options, switches and parameters
+ - allows option grouping
+ - allows both short and long options
+ - automatically generates the usage message from the command line description
+ - checks types of the options values (number, date, ...).
To use it you should follow these steps:
- @ref wxCmdLineParser::construction construct an object of this class
+ -# @ref wxCmdLineParser::construction construct an object of this class
giving it the command line to parse and optionally its description or use
@c AddXXX() functions later
- call @c Parse()
- use @c Found() to retrieve the results
+ -# call @c Parse()
+ -# use @c Found() to retrieve the results
In the documentation below the following terminology is used:
-
-
- switch
-
-
+ - @e switch
This is a boolean option which can be given or not, but
which doesn't have any value. We use the word switch to distinguish such boolean
options from more generic options like those described below. For example,
@c -v might be a switch meaning "enable verbose mode".
-
-
- option
-
-
+ - @e option
Option for us here is something which comes with a value 0
unlike a switch. For example, @c -o:filename might be an option which allows
to specify the name of the output file.
-
-
- parameter
-
-
+ - @e parameter
This is a required program argument.
@library{wxbase}
@category{appmanagement}
- @seealso
- wxApp::argc and wxApp::argv, console sample
+ @see wxApp::argc and wxApp::argv, console sample
*/
class wxCmdLineParser
{
/**
Returns @true if long options are enabled, otherwise @false.
-
+
@see EnableLongOptions()
*/
- bool AreLongOptionsEnabled();
+ bool AreLongOptionsEnabled() const;
/**
Before Parse() can be called, the command line
Enable or disable support for the long options.
As long options are not (yet) POSIX-compliant, this option allows to disable
them.
-
+
@see Customization() and AreLongOptionsEnabled()
*/
void EnableLongOptions(bool enable = true);
Returns @true if an option taking a date value was found and stores the
value in the provided pointer (which should not be @NULL).
*/
- bool Found(const wxString& name);
- bool Found(const wxString& name, wxString* value);
- bool Found(const wxString& name, long* value);
- bool Found(const wxString& name, wxDateTime* value);
+ bool Found(const wxString& name) const;
+ bool Found(const wxString& name, wxString* value) const;
+ bool Found(const wxString& name, long* value) const;
+ bool Found(const wxString& name, double* value) const;
+ bool Found(const wxString& name, wxDateTime* value) const;
//@}
/**
Returns the value of Nth parameter (as string only).
*/
- wxString GetParam(size_t n = 0u);
+ wxString GetParam(size_t n = 0u) const;
/**
Returns the number of parameters found. This function makes sense mostly if you
had used @c wxCMD_LINE_PARAM_MULTIPLE flag.
*/
- size_t GetParamCount();
+ size_t GetParamCount() const;
/**
After calling Parse() (and if it returned 0),
Parse the command line, return 0 if ok, -1 if @c "-h" or @c "--help"
option was encountered and the help message was given or a positive value if a
syntax error occurred.
-
+
@param giveUsage
If @true (default), the usage message is given if a
syntax error was encountered while parsing the command line or if help was
Give the standard usage message describing all program options. It will use the
options and parameters descriptions specified earlier, so the resulting message
will not be helpful to the user unless the descriptions were indeed specified.
-
+
@see SetLogo()
*/
- void Usage();
+ void Usage() const;
};
+