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