C++ API Reference
|
Manipulate Maya Status codes. More...
#include <MStatus.h>
Public Types | |
enum | MStatusCode { kSuccess = 0, kFailure, kInsufficientMemory, kInvalidParameter, kLicenseFailure, kUnknownParameter, kNotImplemented, kNotFound, kEndOfFile } |
Available Status Codes. More... | |
Public Member Functions | |
MStatus () | |
The default class constructor. More... | |
MStatus (MStatusCode) | |
The constructor that takes a MStatus::MStatusCode. More... | |
MStatus (const MStatus &) | |
The copy constructor of the class. More... | |
MStatus & | operator= (const MStatus &rhs) |
The copy operator of the class. More... | |
bool | operator== (const MStatus &rhs) const |
The equivalence operator that takes another MStatus object. More... | |
bool | operator== (const MStatusCode rhs) const |
The equivalence operator that takes a MStatus::MStatusCode. More... | |
bool | operator!= (const MStatus &rhs) const |
The not equal operator for MStatus. More... | |
bool | operator!= (const MStatusCode rhs) const |
The not equal operator that takes a MStatus::MStatusCode. More... | |
bool | error () const |
Determines whether there is an error. More... | |
void | clear () |
Clear error codes from the MStatus instance. More... | |
MStatusCode | statusCode () const |
Retrieve the type of error that occurred, as specified in the MStatusCode enumeration. More... | |
MString | errorString () const |
This method returns the internal error message as a MString object. More... | |
void | perror (const char *) const |
This method prints the error string preceded by a string supplied by the user to the standard error stream. More... | |
void | pAPIerror (const char *file, int line) const |
This method prints the API error string to the standard error stream. More... | |
void | perror (const MString &) const |
The second version of the perror() method. More... | |
void | set (bool status, unsigned char statusCode, unsigned char internalStatusCode) |
Internal use only. More... | |
void | setSuccess () |
The method is called interally by Maya to set the status as success. More... | |
operator bool () const | |
NO SCRIPT SUPPORT. More... | |
Friends | |
OPENMAYA_EXPORT std::ostream & | operator<< (std::ostream &, MStatus &) |
NO SCRIPT SUPPORT. More... | |
OPENMAYA_EXPORT bool | operator== (const MStatus::MStatusCode code, const MStatus &status) |
NO SCRIPT SUPPORT. | |
OPENMAYA_EXPORT bool | operator!= (const MStatus::MStatusCode code, const MStatus &status) |
NO SCRIPT SUPPORT. | |
Manipulate Maya Status codes.
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.
enum MStatusCode |
Available Status Codes.
Enumerator | |
---|---|
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 |
|
kNotFound |
|
kEndOfFile |
|
|
inline |
The default class constructor.
It initializes the internal detailed status code to kSuccess.
MStatus | ( | MStatus::MStatusCode | status | ) |
The constructor that takes a MStatus::MStatusCode.
Initializes the internal detailed status code to status
[in] | status | The initial detailed status code. |
|
inline |
|
inline |
The equivalence operator that takes a MStatus::MStatusCode.
[in] | rhs | a MStatus::MStatusCode, e.g. MS::kSuccess. |
|
inline |
|
inline |
The not equal operator that takes a MStatus::MStatusCode.
[in] | rhs | a MStatus::MStatusCode, e.g. MS::kSuccess. |
|
inline |
Determines whether there is an error.
|
inline |
Clear error codes from the MStatus instance.
After this call, it will behave as if it contained MS::kSuccess.
|
inline |
Retrieve the type of error that occurred, as specified in the MStatusCode enumeration.
MString errorString | ( | ) | const |
void perror | ( | const char * | preString | ) | const |
This method prints the error string preceded by a string supplied by the user to the standard error stream.
[in] | preString | A pointer to char that points to a null terminated string. |
void pAPIerror | ( | const char * | file, |
int | line | ||
) | const |
This method prints the API error string to the standard error stream.
[in] | file | Filename where the error occured __FILE__. |
[in] | line | Line number of the error __LINE__. |
void perror | ( | const MString & | preString | ) | const |
|
inline |
Internal use only.
The method is called interally by Maya to construct MStatus objects.
It should not be called from plugins.
[in] | status | true or false |
[in] | statusCode | an element of MStatusCode |
[in] | internalStatusCode | an internal Maya error code |
|
inline |
The method is called interally by Maya to set the status as success.
It should not be called from plugins.
|
inline |
|
friend |
NO SCRIPT SUPPORT.
This method outputs the detailed status code as well as the internal error description. The format of the output is "(errNumber): errorDescriptiveText".
[in] | out | The ostream object that the output should be directed to. |
[in] | status | The MStatus object. |