MArgDatabase Class Reference
[OpenMaya - API module for common classes]

#include <MArgDatabase.h>
Inheritance diagram for MArgDatabase:
Inheritance graph
[legend]
Collaboration diagram for MArgDatabase:
Collaboration graph
[legend]

List of all members.


Detailed Description

Command argument list parser.

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.

Examples:

cgfxShaderCmd.cpp, closestPointOnCurveCmd.cpp, clusterWeightFunction.cpp, conditionTest.cpp, dagMessageCmd.cpp, deletedMsgCmd.cpp, eventTest.cpp, filteredAsciiFile.cpp, flipUVCmd.cpp, flipUVCmd.h, fxManagerCmd.cpp, geometryCacheConverter.cpp, geometrySurfaceConstraint.cpp, helixTool.cpp, lockEvent.cpp, nodeCreatedCBCmd.cpp, nodeInfoCmd.cpp, particlePathsCmd.cpp, peltOverlapCmd.cpp, renderViewInteractiveRenderCmd.cpp, renderViewRenderCmd.cpp, renderViewRenderRegionCmd.cpp, scanDagSyntax.cpp, userMsgCmd.cpp, and viewCallbackTest.cpp.


Public Member Functions

  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
MStatus  getFlagArgument (const char *flag, unsigned int index, bool &result) const
  NO SCRIPT SUPPORT, USE BASE CLASS.
MStatus  getFlagArgument (const char *flag, unsigned int index, int &result) const
  NO SCRIPT SUPPORT, USE BASE CLASS.
MStatus  getFlagArgument (const char *flag, unsigned int index, double &result) const
  NO SCRIPT SUPPORT, USE BASE CLASS.
MStatus  getFlagArgument (const char *flag, unsigned int index, MString &result) const
  NO SCRIPT SUPPORT, USE BASE CLASS.
MStatus  getFlagArgument (const char *flag, unsigned int index, unsigned int &result) const
  NO SCRIPT SUPPORT, USE BASE CLASS.
MStatus  getFlagArgument (const char *flag, unsigned int index, MDistance &result) const
  NO SCRIPT SUPPORT, USE BASE CLASS.
MStatus  getFlagArgument (const char *flag, unsigned int index, MAngle &result) const
  NO SCRIPT SUPPORT, USE BASE CLASS.
MStatus  getFlagArgument (const char *flag, unsigned int index, MTime &result) const
  NO SCRIPT SUPPORT, USE BASE CLASS.
MStatus  getCommandArgument (unsigned int index, bool &result) const
  NO SCRIPT SUPPORT, USE BASE CLASS.
MStatus  getCommandArgument (unsigned int index, int &result) const
  NO SCRIPT SUPPORT, USE BASE CLASS.
MStatus  getCommandArgument (unsigned int index, double &result) const
  NO SCRIPT SUPPORT, USE BASE CLASS.
MStatus  getCommandArgument (unsigned int index, MString &result) const
  NO SCRIPT SUPPORT, USE BASE CLASS.
MStatus  getCommandArgument (unsigned int index, MDistance &result) const
  NO SCRIPT SUPPORT, USE BASE CLASS.
MStatus  getCommandArgument (unsigned int index, MAngle &result) const
  NO SCRIPT SUPPORT, USE BASE CLASS.
MStatus  getCommandArgument (unsigned int index, MTime &result) const
  NO SCRIPT SUPPORT, USE BASE CLASS.
MStatus  getObjects (MStringArray &result) const

Constructor & Destructor Documentation

MArgDatabase::MArgDatabase (  ) 

Default Constructor

MArgDatabase::MArgDatabase ( const MSyntax syntax,
const MArgList argList,
MStatus ReturnStatus = NULL  
)

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

Parameters:
[in]  syntax  the syntax object
[in]  argList  the argument list
[out]  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 (  )  [virtual]

The class destructor.


Member Function Documentation

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

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

Parameters:
[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 MSelectionList
Returns:
Examples:

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

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

Parameters:
[in]  index  the index of the argument of the command
[out]  result  the value of the argument as an MSelectionList
Returns:

MStatus MArgDatabase::getObjects ( MSelectionList result  )  const

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

Parameters:
[out]  result  the list of objects passed to the command as an MSelectionList
Returns:

MStatus MArgDatabase::getObjects ( MStringArray result  )  const

Gets the list of objects passed to the command as an array of strings.

Parameters:
[out]  result  the list of objects passed to the command as an MStringArray
Returns:

Reimplemented from MArgParser.


Autodesk® Maya® 2011 © 1997-2010 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6