adjusted indentation with astyle; added Id keyword
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52383 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -9,75 +9,75 @@
|
||||
/**
|
||||
@class wxCmdLineParser
|
||||
@wxheader{cmdline.h}
|
||||
|
||||
|
||||
wxCmdLineParser is a class for parsing the command line.
|
||||
|
||||
|
||||
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, ...).
|
||||
|
||||
|
||||
To use it you should follow these steps:
|
||||
|
||||
|
||||
@ref wxCmdLineParser::construction construct an object of this class
|
||||
giving it the command line to parse and optionally its description or use
|
||||
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
|
||||
|
||||
|
||||
In the documentation below the following terminology is used:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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,
|
||||
options from more generic options like those described below. For example,
|
||||
@c -v might be a switch meaning "enable verbose mode".
|
||||
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
This is a required program argument.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@library{wxbase}
|
||||
@category{appmanagement}
|
||||
|
||||
|
||||
@seealso
|
||||
wxApp::argc and wxApp::argv, console sample
|
||||
*/
|
||||
class wxCmdLineParser
|
||||
class wxCmdLineParser
|
||||
{
|
||||
public:
|
||||
//@{
|
||||
/**
|
||||
Specifies both the command line (in Windows format) and the
|
||||
Specifies both the command line (in Windows format) and the
|
||||
@ref setdesc() "command line description".
|
||||
*/
|
||||
wxCmdLineParser();
|
||||
wxCmdLineParser(int argc, char** argv);
|
||||
wxCmdLineParser(int argc, wchar_t** argv);
|
||||
wxCmdLineParser(const wxString& cmdline);
|
||||
wxCmdLineParser(const wxCmdLineEntryDesc* desc);
|
||||
wxCmdLineParser(const wxCmdLineEntryDesc* desc, int argc,
|
||||
char** argv);
|
||||
wxCmdLineParser(const wxCmdLineEntryDesc* desc,
|
||||
const wxString& cmdline);
|
||||
wxCmdLineParser(int argc, char** argv);
|
||||
wxCmdLineParser(int argc, wchar_t** argv);
|
||||
wxCmdLineParser(const wxString& cmdline);
|
||||
wxCmdLineParser(const wxCmdLineEntryDesc* desc);
|
||||
wxCmdLineParser(const wxCmdLineEntryDesc* desc, int argc,
|
||||
char** argv);
|
||||
wxCmdLineParser(const wxCmdLineEntryDesc* desc,
|
||||
const wxString& cmdline);
|
||||
//@}
|
||||
|
||||
/**
|
||||
@@ -129,26 +129,26 @@ public:
|
||||
description in what follows.
|
||||
|
||||
You have complete freedom of choice as to when specify the required information,
|
||||
the only restriction is that it must be done before calling
|
||||
the only restriction is that it must be done before calling
|
||||
Parse().
|
||||
|
||||
To specify the command line to parse you may use either one of constructors
|
||||
accepting it (@c wxCmdLineParser(argc, argv) or @c wxCmdLineParser(const
|
||||
wxString) usually)
|
||||
or, if you use the default constructor, you can do it later by calling
|
||||
or, if you use the default constructor, you can do it later by calling
|
||||
SetCmdLine().
|
||||
|
||||
The same holds for command line description: it can be specified either in
|
||||
the @ref wxcmdlineparserctor() constructor (with or without
|
||||
the command line itself) or constructed later using either
|
||||
SetDesc() or combination of
|
||||
AddSwitch(),
|
||||
AddOption() and
|
||||
SetDesc() or combination of
|
||||
AddSwitch(),
|
||||
AddOption() and
|
||||
AddParam() methods.
|
||||
|
||||
Using constructors or SetDesc() uses a (usually
|
||||
Using constructors or SetDesc() uses a (usually
|
||||
@c const static) table containing the command line description. If you want
|
||||
to decide which options to accept during the run-time, using one of the
|
||||
to decide which options to accept during the run-time, using one of the
|
||||
@c AddXXX() functions above might be preferable.
|
||||
*/
|
||||
|
||||
@@ -169,7 +169,7 @@ public:
|
||||
The long options are the ones which start with two dashes (@c "--") and look
|
||||
like this: @c --verbose, i.e. they generally are complete words and not some
|
||||
abbreviations of them. As long options are used by more and more applications,
|
||||
they are enabled by default, but may be disabled with
|
||||
they are enabled by default, but may be disabled with
|
||||
DisableLongOptions().
|
||||
|
||||
Another global option is the set of characters which may be used to start an
|
||||
@@ -180,7 +180,7 @@ public:
|
||||
with SetSwitchChars() method.
|
||||
|
||||
Finally, SetLogo() can be used to show some
|
||||
application-specific text before the explanation given by
|
||||
application-specific text before the explanation given by
|
||||
Usage() function.
|
||||
*/
|
||||
|
||||
@@ -206,9 +206,9 @@ public:
|
||||
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, wxString* value);
|
||||
bool Found(const wxString& name, long* value);
|
||||
bool Found(const wxString& name, wxDateTime* value);
|
||||
//@}
|
||||
|
||||
/**
|
||||
@@ -227,21 +227,21 @@ public:
|
||||
you may access the results of parsing using one of overloaded @c Found()
|
||||
methods.
|
||||
|
||||
For a simple switch, you will simply call
|
||||
For a simple switch, you will simply call
|
||||
Found() to determine if the switch was given
|
||||
or not, for an option or a parameter, you will call a version of @c Found()
|
||||
which also returns the associated value in the provided variable. All
|
||||
or not, for an option or a parameter, you will call a version of @c Found()
|
||||
which also returns the associated value in the provided variable. All
|
||||
@c Found() functions return @true if the switch or option were found in the
|
||||
command line or @false if they were not specified.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
Parse the command line, return 0 if ok, -1 if @c "-h" or @c "--help"
|
||||
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
|
||||
@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
|
||||
requested. If @false, only error messages about possible syntax errors
|
||||
@@ -268,8 +268,8 @@ public:
|
||||
Set command line to parse after using one of the constructors which don't do it.
|
||||
*/
|
||||
void SetCmdLine(int argc, char** argv);
|
||||
void SetCmdLine(int argc, wchar_t** argv);
|
||||
void SetCmdLine(const wxString& cmdline);
|
||||
void SetCmdLine(int argc, wchar_t** argv);
|
||||
void SetCmdLine(const wxString& cmdline);
|
||||
//@}
|
||||
|
||||
/**
|
||||
@@ -282,7 +282,7 @@ public:
|
||||
void SetDesc(const wxCmdLineEntryDesc* desc);
|
||||
|
||||
/**
|
||||
@e logo is some extra text which will be shown by
|
||||
@e logo is some extra text which will be shown by
|
||||
Usage() method.
|
||||
*/
|
||||
void SetLogo(const wxString& logo);
|
||||
|
||||
Reference in New Issue
Block a user