#include
<MArgParser.h>
This class is used to parse and store all of the flags, arguments and objects which are passed to a command. The MArgParser accepts an MSyntax object, which describes the format for a command, and uses it to parse the command arguments into a form which is easy to query. The documentation for the MSyntax command contains the details on three types of arguments to commands:
The isFlagSet method can be used to find out if a particular flag argument was provided in the command invocation, and the getFlagArgument methods are used to return the value of that flag.
If the command requires command arguments (i.e. the addArg method was used to construct the syntax object), then getCommandArgument methods are used to return the values of those arguments.
If the command requires objects then the getObjects methods are used to return those objects either as a selection list of as a list of strings.
Public Member Functions |
|
MArgParser () | |
MArgParser (const MSyntax &syntax, const MArgList &argList, MStatus *ReturnStatus=NULL) | |
virtual | ~MArgParser () |
bool | isFlagSet (const char *flag, MStatus *ReturnStatus=NULL) const |
bool | isEdit (MStatus *ReturnStatus=NULL) const |
bool | isQuery (MStatus *ReturnStatus=NULL) const |
unsigned int | numberOfFlagsUsed () const |
unsigned int | numberOfFlagUses (const char *flag) const |
MStatus | getFlagArgument (const char *flag, unsigned int index, bool &result) const |
MStatus | getFlagArgument (const char *flag, unsigned int index, int &result) const |
MStatus | getFlagArgument (const char *flag, unsigned int index, double &result) const |
MStatus | getFlagArgument (const char *flag, unsigned int index, MString &result) const |
MStatus | getFlagArgument (const char *flag, unsigned int index, unsigned int &result) const |
MStatus | getFlagArgument (const char *flag, unsigned int index, MDistance &result) const |
MStatus | getFlagArgument (const char *flag, unsigned int index, MAngle &result) const |
MStatus | getFlagArgument (const char *flag, unsigned int index, MTime &result) const |
bool | flagArgumentBool (const char *flag, unsigned int index, MStatus *ReturnStatus=NULL) const |
int | flagArgumentInt (const char *flag, unsigned int index, MStatus *ReturnStatus=NULL) const |
double | flagArgumentDouble (const char *flag, unsigned int index, MStatus *ReturnStatus=NULL) const |
MString | flagArgumentString (const char *flag, unsigned int index, MStatus *ReturnStatus=NULL) const |
MDistance | flagArgumentMDistance (const char *flag, unsigned int index, MStatus *ReturnStatus=NULL) const |
MAngle | flagArgumentMAngle (const char *flag, unsigned int index, MStatus *ReturnStatus=NULL) const |
MTime | flagArgumentMTime (const char *flag, unsigned int index, MStatus *ReturnStatus=NULL) const |
MStatus | getFlagArgumentPosition (const char *flag, unsigned int i, unsigned int &position) const |
MStatus | getFlagArgumentList (const char *flag, unsigned int i, MArgList &args) const |
MStatus | getCommandArgument (unsigned int index, bool &result) const |
MStatus | getCommandArgument (unsigned int index, int &result) const |
MStatus | getCommandArgument (unsigned int index, double &result) const |
MStatus | getCommandArgument (unsigned int index, MString &result) const |
MStatus | getCommandArgument (unsigned int index, MDistance &result) const |
MStatus | getCommandArgument (unsigned int index, MAngle &result) const |
MStatus | getCommandArgument (unsigned int index, MTime &result) const |
bool | commandArgumentBool (unsigned int index, MStatus *ReturnStatus=NULL) const |
int | commandArgumentInt (unsigned int index, MStatus *ReturnStatus=NULL) const |
double | commandArgumentDouble (unsigned int index, MStatus *ReturnStatus=NULL) const |
MString | commandArgumentString (unsigned int index, MStatus *ReturnStatus=NULL) const |
MDistance | commandArgumentMDistance (unsigned int index, MStatus *ReturnStatus=NULL) const |
MAngle | commandArgumentMAngle (unsigned int index, MStatus *ReturnStatus=NULL) const |
MTime | commandArgumentMTime (unsigned int index, MStatus *ReturnStatus=NULL) const |
MStatus | getObjects (MStringArray &result) const |
MArgParser::MArgParser | ( | ) |
The default class constructor.
MArgParser::MArgParser | ( | const MSyntax & | syntax, | |
const MArgList & | argList, | |||
MStatus * | ReturnStatus =
NULL |
|||
) |
Creates an MArgParser object by using the data in 'syntax' to parse the argList.
[in] | syntax | the syntax object |
[in] | argList | the argument list |
[out] | ReturnStatus | the status codes |
MArgParser::~MArgParser | ( | ) | [virtual] |
The class destructor.
bool MArgParser::isFlagSet | ( | const char * | flag, | |
MStatus * | ReturnStatus =
NULL |
|||
) | const |
Queries the arguments to the command to determine if the given flag is set.
[in] | flag | the flag whose state is to be queried |
[out] | ReturnStatus | the return status |
bool MArgParser::isEdit | ( | MStatus * | ReturnStatus =
NULL |
) | const |
Determines if the edit flag was one of the arguments to the command. The edit flag in its short form is "-e", and in its int form is "-edit".
[out] | ReturnStatus | the return status |
bool MArgParser::isQuery | ( | MStatus * | ReturnStatus =
NULL |
) | const |
Determines if the query flag was one of the arguments to the command. The query flag in its short form is "-q", and in its int form is "-query".
[out] | ReturnStatus | the return status |
unsigned int MArgParser::numberOfFlagsUsed | ( | ) | const |
Returns the number of flags given on the command line command line.
unsigned int MArgParser::numberOfFlagUses | ( | const char * | flag | ) | const |
Returns the number of times the given flag was used on the command line.
[in] | flag | the flag whose argument is being requested |
MStatus MArgParser::getFlagArgument | ( | const char * | flag, | |
unsigned int | index, | |||
bool & | result | |||
) | const |
Gets the value of the requested flag argument to the given flag as a boolean.
Python Notes
This method is not available in Python. Please see the flagArgumentBool() method
[in] | flag | the flag whose argument is being requested |
[in] | index | the index of the argument to the flag |
[out] | result | the value of the argument as a boolean |
Reimplemented in MArgDatabase.
MStatus MArgParser::getFlagArgument | ( | const char * | flag, | |
unsigned int | index, | |||
int & | result | |||
) | const |
Gets the value of the requested flag argument to the given flag as a int.
Python Notes
This method is not available in Python. Please see the flagArgumentInt() method
[in] | flag | the flag whose argument is being requested |
[in] | index | the index of the argument to the flag |
[out] | result | the value of the argument as a int |
Reimplemented in MArgDatabase.
MStatus MArgParser::getFlagArgument | ( | const char * | flag, | |
unsigned int | index, | |||
double & | result | |||
) | const |
Gets the value of the requested flag argument to the given flag as a double.
Python Notes
This method is not available in Python. Please see the flagArgumentDouble() method
[in] | flag | the flag whose argument is being requested |
[in] | index | the index of the argument to the flag |
[out] | result | the value of the argument as a double |
Reimplemented in MArgDatabase.
MStatus MArgParser::getFlagArgument | ( | const char * | flag, | |
unsigned int | index, | |||
MString & | result | |||
) | const |
Gets the value of the requested flag argument to the given flag as an MString.
Python Notes
This method is not available in Python. Please see the flagArgumentString() method
[in] | flag | the flag whose argument is being requested |
[in] | index | the index of the argument to the flag |
[out] | result | the value of the argument as an MString |
Reimplemented in MArgDatabase.
MStatus MArgParser::getFlagArgument | ( | const char * | flag, | |
unsigned int | index, | |||
unsigned int & | result | |||
) | const |
Gets the value of the requested flag argument to the given flag as an unsigned int.
Python Notes
This method is not available in Python. Please see the flagArgumentInt() method
[in] | flag | the flag whose argument is being requested |
[in] | index | the index of the argument to the flag |
[out] | result | the value of the argument as an unsigned int |
Reimplemented in MArgDatabase.
MStatus MArgParser::getFlagArgument | ( | const char * | flag, | |
unsigned int | index, | |||
MDistance & | result | |||
) | const |
Gets the value of the requested flag argument to the given flag as an MDistance.
Python Notes
This method is not available in Python. Please see the flagArgumentMDistance() method
[in] | flag | the flag whose argument is being requested |
[in] | index | the index of the argument to the flag |
[out] | result | the value of the argument as an MDistance |
Reimplemented in MArgDatabase.
MStatus MArgParser::getFlagArgument | ( | const char * | flag, | |
unsigned int | index, | |||
MAngle & | result | |||
) | const |
Gets the value of the requested flag argument to the given flag as an MAngle.
Python Notes
This method is not available in Python. Please see the flagArgumentMAngle() method
[in] | flag | the flag whose argument is being requested |
[in] | index | the index of the argument to the flag |
[out] | result | the value of the argument as an MAngle |
Reimplemented in MArgDatabase.
Gets the value of the requested flag argument to the given flag as an MTime.
Python Notes
This method is not available in Python. Please see the flagArgumentMTime() method
[in] | flag | the flag whose argument is being requested |
[in] | index | the index of the argument to the flag |
[out] | result | the value of the argument as an MTime |
Reimplemented in MArgDatabase.
bool MArgParser::flagArgumentBool | ( | const char * | flag, | |
unsigned int | index, | |||
MStatus * | ReturnStatus =
NULL |
|||
) | const |
Gets the value of the requested flag argument to the given flag as a boolean.
[in] | flag | the flag whose argument is being requested |
[in] | index | the index of the argument to the flag |
[out] | ReturnStatus | the return status |
int MArgParser::flagArgumentInt | ( | const char * | flag, | |
unsigned int | index, | |||
MStatus * | ReturnStatus =
NULL |
|||
) | const |
Gets the value of the requested flag argument to the given flag as a int.
[in] | flag | the flag whose argument is being requested |
[in] | index | the index of the argument to the flag |
[out] | ReturnStatus | the return status |
double MArgParser::flagArgumentDouble | ( | const char * | flag, | |
unsigned int | index, | |||
MStatus * | ReturnStatus =
NULL |
|||
) | const |
Gets the value of the requested flag argument to the given flag as a double.
[in] | flag | the flag whose argument is being requested |
[in] | index | the index of the argument to the flag |
[out] | ReturnStatus | the return status |
MString MArgParser::flagArgumentString | ( | const char * | flag, | |
unsigned int | index, | |||
MStatus * | ReturnStatus =
NULL |
|||
) | const |
Gets the value of the requested flag argument to the given flag as an MString.
[in] | flag | the flag whose argument is being requested |
[in] | index | the index of the argument to the flag |
[out] | ReturnStatus | the return status |
MDistance MArgParser::flagArgumentMDistance | ( | const char * | flag, | |
unsigned int | index, | |||
MStatus * | ReturnStatus =
NULL |
|||
) | const |
Gets the value of the requested flag argument to the given flag as an MDistance.
[in] | flag | the flag whose argument is being requested |
[in] | index | the index of the argument to the flag |
[out] | ReturnStatus | the return status |
MAngle MArgParser::flagArgumentMAngle | ( | const char * | flag, | |
unsigned int | index, | |||
MStatus * | ReturnStatus =
NULL |
|||
) | const |
Gets the value of the requested flag argument to the given flag as an MAngle.
[in] | flag | the flag whose argument is being requested |
[in] | index | the index of the argument to the flag |
[out] | ReturnStatus | the return status |
MTime MArgParser::flagArgumentMTime | ( | const char * | flag, | |
unsigned int | index, | |||
MStatus * | ReturnStatus =
NULL |
|||
) | const |
Gets the value of the requested flag argument to the given flag as an MTime.
[in] | flag | the flag whose argument is being requested |
[in] | index | the index of the argument to the flag |
[out] | ReturnStatus | the return status |
MStatus MArgParser::getFlagArgumentPosition | ( | const char * | flag, | |
unsigned int | i, | |||
unsigned int & | position | |||
) | const |
Returns the position in the command line of the i'th usage of a specified flag. This call is only valid if the flags has been marked as available for multi-usage with MSyntax::makeFlagMultiUse
[in] | flag | the flag whose argument is being requested |
[in] | i | the desired instance of the flag on the command line |
[out] | position | on return the position in the command line of the i'th usage of the specified flag |
MStatus MArgParser::getFlagArgumentList | ( | const char * | flag, | |
unsigned int | i, | |||
MArgList & | args | |||
) | const |
Returns an MArgList containing the arguments to the i'th usage of the specified flag. This call is only valid if the flags has been marked as available for multi-usage with MSyntax::makeFlagMultiUse
[in] | flag | the flag whose argument is being requested |
[in] | i | the desired instance of the flag on the command line |
[out] | args | on return the arguments to the i'th usage of the specified flag |
MStatus MArgParser::getCommandArgument | ( | unsigned int | index, | |
bool & | result | |||
) | const |
Gets the value of the requested command argument to the command as a boolean.
Python Notes
This method is not available in Python. Please see the commandArgumentBool() method
[in] | index | the index of the argument of the command |
[out] | result | the value of the argument as a boolean |
Reimplemented in MArgDatabase.
MStatus MArgParser::getCommandArgument | ( | unsigned int | index, | |
int & | result | |||
) | const |
Gets the value of the requested command argument to the command as a int.
Python Notes
This method is not available in Python. Please see the commandArgumentBool() method
[in] | index | the index of the argument of the command |
[out] | result | the value of the argument as a int |
Reimplemented in MArgDatabase.
MStatus MArgParser::getCommandArgument | ( | unsigned int | index, | |
double & | result | |||
) | const |
Gets the value of the requested command argument to the command as a double.
Python Notes
This method is not available in Python. Please see the commandArgumentBool() method
[in] | index | the index of the argument of the command |
[out] | result | the value of the argument as a double |
Reimplemented in MArgDatabase.
Gets the value of the requested command argument to the command as an MString.
Python Notes
This method is not available in Python. Please see the commandArgumentBool() method
[in] | index | the index of the argument of the command |
[out] | result | the value of the argument as an MString |
Reimplemented in MArgDatabase.
Gets the value of the requested command argument to the command as an MDistance.
Python Notes
This method is not available in Python. Please see the commandArgumentBool() method
[in] | index | the index of the argument of the command |
[out] | result | the value of the argument as an MDistance |
Reimplemented in MArgDatabase.
Gets the value of the requested command argument to the command as an MAngle.
Python Notes
This method is not available in Python. Please see the commandArgumentBool() method
[in] | index | the index of the argument of the command |
[out] | result | the value of the argument as an MAngle |
Reimplemented in MArgDatabase.
Gets the value of the requested command argument to the command as an MTime.
Python Notes
This method is not available in Python. Please see the commandArgumentBool() method
[in] | index | the index of the argument of the command |
[out] | result | the value of the argument as an MTime |
Reimplemented in MArgDatabase.
bool MArgParser::commandArgumentBool | ( | unsigned int | index, | |
MStatus * | ReturnStatus =
NULL |
|||
) | const |
Gets the value of the requested command argument as a boolean.
[in] | index | the index of the argument to the command |
[out] | ReturnStatus | the return status |
int MArgParser::commandArgumentInt | ( | unsigned int | index, | |
MStatus * | ReturnStatus =
NULL |
|||
) | const |
Gets the value of the requested command argument as an int.
[in] | index | the index of the argument to the command |
[out] | ReturnStatus | the return status |
double MArgParser::commandArgumentDouble | ( | unsigned int | index, | |
MStatus * | ReturnStatus =
NULL |
|||
) | const |
Gets the value of the requested command argument as a double.
[in] | index | the index of the argument to the command |
[out] | ReturnStatus | the return status |
MString MArgParser::commandArgumentString | ( | unsigned int | index, | |
MStatus * | ReturnStatus =
NULL |
|||
) | const |
Gets the value of the requested command argument as a string.
[in] | index | the index of the argument to the command |
[out] | ReturnStatus | the return status |
MDistance MArgParser::commandArgumentMDistance | ( | unsigned int | index, | |
MStatus * | ReturnStatus =
NULL |
|||
) | const |
Gets the value of the requested command argument as a MDistance.
[in] | index | the index of the argument to the command |
[out] | ReturnStatus | the return status |
MAngle MArgParser::commandArgumentMAngle | ( | unsigned int | index, | |
MStatus * | ReturnStatus =
NULL |
|||
) | const |
Gets the value of the requested command argument as a MAngle.
[in] | index | the index of the argument to the command |
[out] | ReturnStatus | the return status |
Gets the value of the requested command argument as a MTime.
[in] | index | the index of the argument to the command |
[out] | ReturnStatus | the return status |
MStatus MArgParser::getObjects | ( | MStringArray & | result | ) | const |
Gets the list of objects passed to the command as an array of strings.
[out] | result | the list of objects passed to the command as an MStringArray |
Reimplemented in MArgDatabase.
Autodesk® Maya® 2011 © 1997-2010 Autodesk, Inc. All rights reserved. | Generated with 1.5.6 |