Version: 3.1.3
wxCmdLineArg Class Referenceabstract

#include <wx/cmdline.h>

Detailed Description

The interface wxCmdLineArg provides information for an instance of argument passed on command line.

Example of use:

for (wxCmdLineArgs::const_iterator itarg=parser.GetArguments().begin();
itarg!=parser.GetArguments().end();
++itarg)
{
wxString optionName;
switch (itarg->GetKind())
{
if (itarg->IsNegated()) {
}
else {
}
break;
// assuming that all the options have a short name
optionName = itarg->GetShortName();
switch (itarg->GetType()) {
// do something with itarg->GetLongVal();
break;
// do something with itarg->GetDoubleVal();
break;
// do something with itarg->GetDateVal();
break;
// do something with itarg->GetStrVal();
break;
}
break;
// do something with itarg->GetStrVal();
break;
}
}

With C++11, the for loop could be written:

for (const auto &arg : parser.GetArguments()) {
// working on arg as with *itarg above
}
Since
3.1.0

Public Member Functions

virtual ~wxCmdLineArg ()
 
virtual const wxDateTimeGetDateVal () const =0
 Returns the command line argument value as a wxDateTime. More...
 
virtual double GetDoubleVal () const =0
 Returns the command line argument value as a double. More...
 
virtual wxCmdLineEntryType GetKind () const =0
 Returns the command line argument entry kind. More...
 
virtual long GetLongVal () const =0
 Returns the command line argument value as a long. More...
 
virtual wxString GetLongName () const =0
 Returns the command line argument long name if any. More...
 
virtual wxString GetShortName () const =0
 Returns the command line argument short name if any. More...
 
virtual const wxStringGetStrVal () const =0
 Returns the command line argument value as a string. More...
 
virtual wxCmdLineParamType GetType () const =0
 Returns the command line argument parameter type. More...
 
virtual bool IsNegated () const =0
 Returns true if the switch was negated. More...
 

Constructor & Destructor Documentation

virtual wxCmdLineArg::~wxCmdLineArg ( )
inlinevirtual

Member Function Documentation

virtual const wxDateTime& wxCmdLineArg::GetDateVal ( ) const
pure virtual

Returns the command line argument value as a wxDateTime.

Note
This call works only for wxCMD_LINE_VAL_DATE options
virtual double wxCmdLineArg::GetDoubleVal ( ) const
pure virtual

Returns the command line argument value as a double.

Note
This call works only for wxCMD_LINE_VAL_DOUBLE options
virtual wxCmdLineEntryType wxCmdLineArg::GetKind ( ) const
pure virtual

Returns the command line argument entry kind.

Note
Parameters can only be retrieved as strings, with GetStrVal()
See also
wxCmdLineEntryType, GetType()
virtual wxString wxCmdLineArg::GetLongName ( ) const
pure virtual

Returns the command line argument long name if any.

Note
This call makes sense only for options and switches
virtual long wxCmdLineArg::GetLongVal ( ) const
pure virtual

Returns the command line argument value as a long.

Note
This call works only for wxCMD_LINE_VAL_NUMBER options
virtual wxString wxCmdLineArg::GetShortName ( ) const
pure virtual

Returns the command line argument short name if any.

Note
This call makes sense only for options and switches
virtual const wxString& wxCmdLineArg::GetStrVal ( ) const
pure virtual

Returns the command line argument value as a string.

Note
This call works only for wxCMD_LINE_VAL_STRING options and parameters
virtual wxCmdLineParamType wxCmdLineArg::GetType ( ) const
pure virtual

Returns the command line argument parameter type.

Note
This call makes sense only for options (i.e. GetKind() == wxCMD_LINE_OPTION).
See also
wxCmdLineParamType, GetKind()
virtual bool wxCmdLineArg::IsNegated ( ) const
pure virtual

Returns true if the switch was negated.

Note
This call works only for switches.