20 inline Status Status::OK() {
24 inline Status::Status(
const Status& other) : _error(other._error) {
31 _error = other._error;
35 #if __cplusplus >= 201103L
36 inline Status::Status(
Status&& other) noexcept : _error(other._error) {
37 other._error =
nullptr;
40 inline Status& Status::operator=(
Status&& other) noexcept {
42 _error = other._error;
43 other._error =
nullptr;
46 #endif // __cplusplus >= 201103L
48 inline Status::~Status() {
52 inline bool Status::isOK()
const {
53 return code() == ErrorCodes::OK;
56 inline ErrorCodes::Error Status::code()
const {
57 return _error ? _error->code : ErrorCodes::OK;
60 inline std::string Status::codeString()
const {
61 return ErrorCodes::errorString(code());
64 inline std::string Status::reason()
const {
65 return _error ? _error->reason : std::string();
68 inline int Status::location()
const {
69 return _error ? _error->location : 0;
72 inline AtomicUInt32::WordType Status::refCount()
const {
73 return _error ? _error->refs.load() : 0;
76 inline Status::Status() : _error(NULL) {}
78 inline void Status::ref(ErrorInfo* error) {
80 error->refs.fetchAndAdd(1);
83 inline void Status::unref(ErrorInfo* error) {
84 if (error && (error->refs.subtractAndFetch(1) == 0))
88 inline bool MONGO_CLIENT_FUNC operator==(
const ErrorCodes::Error lhs,
const Status& rhs) {
92 inline bool MONGO_CLIENT_FUNC operator!=(
const ErrorCodes::Error lhs,
const Status& rhs) {
Utility functions for parsing numbers from strings.
Definition: compare_numbers.h:20
Status(ErrorCodes::Error code, const std::string &reason, int location=0)
Builds an error status given the error code, a textual description of what caused the error...
MONGO_CLIENT_API Status(MONGO_CLIENT_FUNC *saslClientAuthenticate)(DBClientWithCommands *client
Attempts to authenticate "client" using the SASL protocol.