Changeset View
Changeset View
Standalone View
Standalone View
extern/draco/draco/src/draco/core/status.h
- This file was moved from extern/draco/dracoenc/src/draco/core/status.h.
| Show All 25 Lines | public: | ||||
| enum Code { | enum Code { | ||||
| OK = 0, | OK = 0, | ||||
| DRACO_ERROR = -1, // Used for general errors. | DRACO_ERROR = -1, // Used for general errors. | ||||
| IO_ERROR = -2, // Error when handling input or output stream. | IO_ERROR = -2, // Error when handling input or output stream. | ||||
| INVALID_PARAMETER = -3, // Invalid parameter passed to a function. | INVALID_PARAMETER = -3, // Invalid parameter passed to a function. | ||||
| UNSUPPORTED_VERSION = -4, // Input not compatible with the current version. | UNSUPPORTED_VERSION = -4, // Input not compatible with the current version. | ||||
| UNKNOWN_VERSION = -5, // Input was created with an unknown version of | UNKNOWN_VERSION = -5, // Input was created with an unknown version of | ||||
| // the library. | // the library. | ||||
| UNSUPPORTED_FEATURE = -6, // Input contains feature that is not supported. | |||||
| }; | }; | ||||
| Status() : code_(OK) {} | Status() : code_(OK) {} | ||||
| Status(const Status &status) = default; | Status(const Status &status) = default; | ||||
| Status(Status &&status) = default; | Status(Status &&status) = default; | ||||
| explicit Status(Code code) : code_(code) {} | explicit Status(Code code) : code_(code) {} | ||||
| Status(Code code, const std::string &error_msg) | Status(Code code, const std::string &error_msg) | ||||
| : code_(code), error_msg_(error_msg) {} | : code_(code), error_msg_(error_msg) {} | ||||
| Show All 19 Lines | |||||
| inline Status OkStatus() { return Status(Status::OK); } | inline Status OkStatus() { return Status(Status::OK); } | ||||
| // Evaluates an expression that returns draco::Status. If the status is not OK, | // Evaluates an expression that returns draco::Status. If the status is not OK, | ||||
| // the macro returns the status object. | // the macro returns the status object. | ||||
| #define DRACO_RETURN_IF_ERROR(expression) \ | #define DRACO_RETURN_IF_ERROR(expression) \ | ||||
| { \ | { \ | ||||
| const draco::Status _local_status = (expression); \ | const draco::Status _local_status = (expression); \ | ||||
| if (!_local_status.ok()) \ | if (!_local_status.ok()) { \ | ||||
| return _local_status; \ | return _local_status; \ | ||||
| } \ | |||||
| } | } | ||||
| } // namespace draco | } // namespace draco | ||||
| #endif // DRACO_CORE_STATUS_H_ | #endif // DRACO_CORE_STATUS_H_ | ||||