Loading...
Searching...
No Matches
hint.hpp
Go to the documentation of this file.
// Copyright 2009-present MongoDB, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <mongocxx/v1/hint-fwd.hpp> // IWYU pragma: export
//
#include <mongocxx/v1/detail/prelude.hpp>
#include <bsoncxx/v1/document/value-fwd.hpp>
#include <bsoncxx/v1/types/view-fwd.hpp>
#include <bsoncxx/v1/document/view.hpp>
#include <bsoncxx/v1/stdx/optional.hpp>
#include <bsoncxx/v1/stdx/string_view.hpp>
#include <mongocxx/v1/config/export.hpp>
#include <string>
namespace mongocxx {
namespace v1 {
class hint {
private:
class impl;
void* _impl;
public:
MONGOCXX_ABI_EXPORT_CDECL() ~hint();
MONGOCXX_ABI_EXPORT_CDECL() hint(hint&& other) noexcept;
MONGOCXX_ABI_EXPORT_CDECL(hint&) operator=(hint&& other) noexcept;
MONGOCXX_ABI_EXPORT_CDECL() hint(hint const& other);
MONGOCXX_ABI_EXPORT_CDECL(hint&) operator=(hint const& other);
MONGOCXX_ABI_EXPORT_CDECL() hint();
explicit MONGOCXX_ABI_EXPORT_CDECL() hint(std::string str);
explicit MONGOCXX_ABI_EXPORT_CDECL() hint(bsoncxx::v1::document::value doc);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::stdx::string_view>) str() const;
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) doc() const;
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::types::view) to_value() const;
/* explicit(false) */ MONGOCXX_ABI_EXPORT_CDECL() operator bsoncxx::v1::types::view() const;
friend bool operator==(hint const& lhs, hint const& rhs) {
return lhs.str() == rhs.str() && lhs.doc() == rhs.doc();
}
friend bool operator!=(hint const& lhs, hint const& rhs) {
return !(lhs == rhs);
}
friend bool operator==(hint const& h, bsoncxx::v1::stdx::string_view str) {
return h.str() == str;
}
friend bool operator!=(hint const& h, bsoncxx::v1::stdx::string_view str) {
return h.str() != str;
}
friend bool operator==(bsoncxx::v1::stdx::string_view str, hint const& h) {
return str == h.str();
}
friend bool operator!=(bsoncxx::v1::stdx::string_view str, hint const& h) {
return str != h.str();
}
friend bool operator==(hint const& h, bsoncxx::v1::document::view doc) {
return h.doc() == doc;
}
friend bool operator!=(hint const& h, bsoncxx::v1::document::view doc) {
return h.doc() != doc;
}
friend bool operator==(bsoncxx::v1::document::view doc, hint const& h) {
return doc == h.doc();
}
friend bool operator!=(bsoncxx::v1::document::view doc, hint const& h) {
return doc != h.doc();
}
class internal;
};
} // namespace v1
} // namespace mongocxx
#include <mongocxx/v1/detail/postlude.hpp>
bsoncxx::v1::document::view
A non-owning, read-only BSON document.
Definition view.hpp:52
bsoncxx::v1::stdx::string_view
A polyfill for std::string_view.
Definition string_view.hpp:412
mongocxx::v1::hint::operator!=
friend bool operator!=(bsoncxx::v1::document::view doc, hint const &h)
Equivalent to comparing h.doc() and doc.
Definition hint.hpp:179
mongocxx::v1::hint::operator!=
friend bool operator!=(bsoncxx::v1::stdx::string_view str, hint const &h)
Equivalent to comparing h.str() with str.
Definition hint.hpp:157
mongocxx::v1::hint::operator!=
friend bool operator!=(hint const &h, bsoncxx::v1::stdx::string_view str)
Equivalent to comparing h.str() with str.
Definition hint.hpp:149
mongocxx::v1::hint::operator==
friend bool operator==(hint const &h, bsoncxx::v1::document::view doc)
Equivalent to comparing h.doc() and doc.
Definition hint.hpp:167
mongocxx::v1::hint::operator==
friend bool operator==(bsoncxx::v1::document::view doc, hint const &h)
Equivalent to comparing h.doc() and doc.
Definition hint.hpp:175
mongocxx::v1::hint::operator!=
friend bool operator!=(hint const &h, bsoncxx::v1::document::view doc)
Equivalent to comparing h.doc() and doc.
Definition hint.hpp:171
mongocxx::v1::hint::hint
hint(hint &&other) noexcept
Move constructor.
mongocxx::v1::hint::operator==
friend bool operator==(bsoncxx::v1::stdx::string_view str, hint const &h)
Equivalent to comparing h.str() with str.
Definition hint.hpp:153
mongocxx::v1::hint::operator!=
friend bool operator!=(hint const &lhs, hint const &rhs)
Compare equal when the underlying "hint" values compare equal.
Definition hint.hpp:135
mongocxx::v1::hint::str
bsoncxx::v1::stdx::optional< bsoncxx::v1::stdx::string_view > str() const
Return the current "hint" value as a string.
mongocxx::v1::hint::operator==
friend bool operator==(hint const &h, bsoncxx::v1::stdx::string_view str)
Equivalent to comparing h.str() with str.
Definition hint.hpp:145
mongocxx::v1::hint::to_value
bsoncxx::v1::types::view to_value() const
Return the current "hint" value as a BSON type value.
mongocxx::v1::hint::view
operator bsoncxx::v1::types::view() const
Equivalent to to_value() const.
mongocxx::v1::hint::doc
bsoncxx::v1::stdx::optional< bsoncxx::v1::document::view > doc() const
Return the current "hint" value as a document.
mongocxx::v1::hint::~hint
~hint()
Destroy this object.
export.hpp
Provides macros to control the set of symbols exported in the ABI.
MONGOCXX_ABI_EXPORT_CDECL
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
postlude.hpp
The mongocxx v1 macro guard postlude header.
prelude.hpp
The mongocxx v1 macro guard prelude header.
bsoncxx
The top-level namespace within which all bsoncxx library entities are declared.
mongocxx::v1
Declares entities whose ABI stability is guaranteed for documented symbols.
mongocxx
The top-level namespace within which all mongocxx library entities are declared.
value-fwd.hpp
Declares bsoncxx::v1::document::value.
view.hpp
Provides bsoncxx::v1::document::view.
hint-fwd.hpp
Declares mongocxx::v1::hint.
optional.hpp
Provides std::optional-related polyfills for library API usage.
string_view.hpp
Provides std::string_view-related polyfills for library API usage.
view-fwd.hpp
Declares non-owning, read-only entities representing a BSON type value.