class MStatus

Jump to documentation

Manipulate Maya Status codes. (OpenMaya)

public members:

enum MStatusCode
Available Status Codes
kSuccess
The operation was successful
kFailure
The operation failed
kInsufficientMemory
The operation failed due to insufficient memory
kInvalidParameter
An invalid parameter was provided
kLicenseFailure
Application is not licensed for the attempted operation
kUnknownParameter
Returned by MPxNode::compute for unrecognised plugs
kNotImplemented
Not currently used
kNotFound
Not currently used
kEndOfFile
Not currently used
MStatus ()
MStatus ( MStatusCode )
MStatus ( const MStatus & )
MStatus & operator= ( const MStatus & rhs)
bool operator== ( const MStatus & rhs ) const
bool operator== ( const MStatusCode rhs ) const
bool operator!= ( const MStatus & rhs ) const
bool operator!= ( const MStatusCode rhs ) const
bool error () const
void clear ()
MStatusCode statusCode () const
MString errorString () const
void perror ( const char * ) const
void perror ( const MString & ) const
void set ( bool status, unsigned char statusCode , unsigned char internalStatusCode)
Internal use only
operator bool () const
NO SCRIPT SUPPORT
friend std::ostream& operator<< ( std::ostream&, MStatus &)
NO SCRIPT SUPPORT
friend inline bool operator== ( const MStatus::MStatusCode code, const MStatus & status )
NO SCRIPT SUPPORT
friend inline bool operator!= ( const MStatus::MStatusCode code, const MStatus & status )
NO SCRIPT SUPPORT

Documentation

Methods for passing status codes between user code and Maya
Description

This class facilitates API level error handling. It encapsulates the status code and the internal MAYA error code as return by API functions. The user can query, set, print the error code along with the error description.

Functions

MStatus:: MStatus ()

Description

The default class constructor. It initializes the internal detailed status code to kSuccess.

MStatus:: MStatus ( MStatus::MStatusCode status )

Description

The constructor that takes a MStatus::MStatusCode. Initializes the internal detailed status code to status

Arguments

  • status The initial detailed status code.

MStatus:: MStatus ( const MStatus & status )

Description

The copy constructor of the class. Initialize a new MStatus object with the values from another MStatus object.

Arguments

  • status The target MStatus object.

MStatus & MStatus:: operator= ( const MStatus & rhs )

Description

The copy operator of the class.

Arguments

  • status The target MStatus object.

Return Value

  • a reference to the MStatus object that has been initialized.

void MStatus:: clear ()

Description

Clear error codes from the MStatus instance. After this call, it will behave as if it contained MS::kSuccess.

MString MStatus:: errorString () const

Description

This method returns the internal error message as a MString object.

Return Value

  • a MString object which contains the error string.

std::ostream& operator << ( std::ostream& out , MStatus & status )

Description

The output operator of the class. This method outputs the detailed status code as well as the internal error description. The format of the output is "(errNumber): errorDescriptiveText".

Arguments

  • out The ostream object that the output should be directed to.
  • status The MStatus object.

Return Value

  • a reference to the ostream object.

void MStatus:: perror ( const char* preString ) const

Description

This method prints the error string preceded by a string supplied by the user to the standard error stream.

Arguments

  • preString A pointer to char that points to a null terminated string.

void MStatus:: perror ( const MString & preString ) const

Description

The second version of the perror() method. This method takes a reference to a MString as the parameter. It prints the error string preceded by the string supplied by the user to the standard error stream.

Arguments

  • preString a reference to a MString object that contains the prefix string.

void MStatus:: set ( bool status, unsigned char statusCode , unsigned char internalStatusCode)

Description

The method is called interally by Maya to construct MStatus objects. It should not be called from plugins.

Arguments

  • status true or false
  • statusCode an element of MStatusCode
  • internalStatusCode an internal Maya error code

void MStatus:: setSuccess ()

Description

The method is called interally by Maya to set the status as success. It should not be called from plugins.

Arguments

bool MStatus:: operator== ( const MStatus & rhs ) const

Description

The equivalence operator that takes another MStatus object.

Arguments

  • rhs a reference to the target object.

Return Value

  • true the two MStatus objects are equal.
  • false the two MStatus objects are not equal.

bool MStatus:: operator== ( const MStatus::MStatusCode rhs ) const

Description

The equivalence operator that takes a MStatus::MStatusCode.

Arguments

  • rhs a MStatus::MStatusCode, e.g. MS::kSuccess.

Return Value

  • true the object has the given detailed status code.
  • false the object does not have the given detailed status code.

bool MStatus:: operator!= ( const MStatus & rhs ) const

Description

The not equal operator for MStatus.

Arguments

  • rhs a reference to the target object for comparison.

Return Value

  • true the two MStatus objects are not equal.
  • false the two MStatus objects are equal.

bool MStatus:: operator!= ( const MStatus::MStatusCode rhs ) const

Description

The not equal operator that takes a MStatus::MStatusCode.

Arguments

  • rhs a MStatus::MStatusCode, e.g. MS::kSuccess.

Return Value

  • true the object does not have the given detailed status code.
  • false the object has the given detailed status code.

MStatus::operator bool () const

Description

The conversion operator that converts a MStatus object to bool. The result it returns will be true if the MStatus does not contain an error, and false if it does.

bool MStatus:: error () const

Description

Determines whether there is an error.

Return Value

  • true an error has occured.
  • false the operation was successful

bool operator== ( const MStatus::MStatusCode code, const MStatus & status )

Description

The equivalence operator that takes a MStatus::MStatusCode on the left side and a MStatus object at the right side.

Arguments

  • code a MStatus::MStatusCode, e.g. MS::kSuccess.
  • status a reference to a MStatus object.

Return Value

  • true the object has the same detailed status code.
  • false the object does not have the same detailed status code.

bool operator!= ( const MStatus::MStatusCode code, const MStatus & status )

Description

The not equal operator that takes a MStatus::MStatusCode on the left side and a MStatus object at the right side.

Arguments

  • code a MStatus::MStatusCode, e.g. MS::kSuccess.
  • status a reference to a MStatus object.

Return Value

  • true the object does not have the same detailed status code.
  • false the object has the same detailed status code.

MStatus::MStatusCode MStatus:: statusCode () const

Description

Retrieve the type of error that occurred, as specified in the MStatusCode enumeration.

Return Value

The type of error that occurred.

This class has no child classes.


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