class MArgDatabase

Jump to documentation

: public MArgParser Command argument list parser. (OpenMaya) (OpenMaya.py)

Inheritance:

MArgDatabase < MArgParser

public members:

MArgDatabase ()
MArgDatabase (const MSyntax &syntax, const MArgList &argList, MStatus *ReturnStatus = NULL)
virtual ~MArgDatabase ()
MStatus getFlagArgument (const char *flag, unsigned int index, MSelectionList &result) const
MStatus getCommandArgument (unsigned int index, MSelectionList &result) const
MStatus getObjects ( MSelectionList &result) const

Inherited from MArgParser:

public members:

MArgParser (const MSyntax &syntax, const MArgList &argList, MStatus *ReturnStatus = NULL)
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

Documentation

This class parses argument lists based on a syntax object (MSyntax) which describes the format for a command.
Description

This class is used to parse and store all of the flags, arguments and objects which are passed to a command. The MArgDatabase 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:

Once the syntax for your command has been specified, when the doIt method for the command it called, the provided MArgList instance can be passed to the MArgDatabase constructor along with the command's syntax object to parse those arguments. If the parsing is unsuccessful, then the provided command was syntactically invalid. If successful, the methods in this class can be used to extract the values of the arguments to the command.

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.

Note: command arguments and objects are incompatible and must not be combined in the syntax definition of a command. If both have been specified to the Syntax object, then neither the getCommandArgument or getObjects methods will work predictably.

Functions

MArgDatabase:: MArgDatabase ()

Description

Default Constructor

MArgDatabase:: MArgDatabase (const MSyntax &syntax, const MArgList &argList, MStatus *ReturnStatus)

Description

Creates an MArgDatabase object by using the data in syntax to parse the arguments provided in argList.

Arguments

  • syntax the syntax object
  • argList the argument list
  • ReturnStatus return status

Status Codes

  • MS::kSuccess parsing successful. The MArgDatabase instance was constructed sucessfully.
  • MS::kFailure The provided arguments were not syntactically valid as specified by the syntax object, The MArgDatabase instance was not constructed sucessfully.

MArgDatabase:: ~MArgDatabase ()

Description

The class destructor.

MStatus MArgDatabase:: getFlagArgument (const char *flag, unsigned int index, MSelectionList &result) const

Description

Gets the value of the requested flag argument to the given flag as an MSelectionList.

Arguments

  • flag the flag whose argument is being requested
  • index the index of the argument to the flag
  • result the value of the argument as an MSelectionList

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MArgDatabase:: getCommandArgument (unsigned int index, MSelectionList &result) const

Description

Gets the value of the requested command argument to the command and appends it to the end of the MSelectionList that is passed in.

Arguments

  • index the index of the argument of the command
  • result the value of the argument as an MSelectionList

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MArgDatabase:: getObjects ( MSelectionList &result) const

Description

Gets the list of objects passed to the command as an MSelectionList.

Arguments

  • result the list of objects passed to the command as an MSelectionList

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright