27 #ifndef UTIL_STATUS_MACROS_H_ 28 #define UTIL_STATUS_MACROS_H_ 40 #define RETURN_IF_ERROR(expr) \ 43 const ::util::Status _status = (expr); \ 44 if (!_status.ok()) return _status; \ 48 #define STATUS_MACROS_CONCAT_NAME_INNER(x, y) x##y 49 #define STATUS_MACROS_CONCAT_NAME(x, y) STATUS_MACROS_CONCAT_NAME_INNER(x, y) 59 #define ASSIGN_OR_RETURN_IMPL(status, lhs, rexpr) \ 60 ::util::Status status = DoAssignOrReturn(lhs, (rexpr)); \ 61 if (!status.ok()) return status; 72 #define ASSIGN_OR_RETURN(lhs, rexpr) \ 73 ASSIGN_OR_RETURN_IMPL( \ 74 STATUS_MACROS_CONCAT_NAME(_status_or_value, __COUNTER__), lhs, rexpr); 78 #endif // UTIL_STATUS_MACROS_H_
const Status & status() const
Status DoAssignOrReturn(T &lhs, StatusOr< T > result)
const T & ValueOrDie() const