MongoDB C++ Driver mongocxx-3.11.0
Loading...
Searching...
No Matches
hint.hpp
Go to the documentation of this file.
1// Copyright 2009-present MongoDB, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <string>
18
19#include <mongocxx/hint-fwd.hpp>
20
26
27#include <mongocxx/stdx.hpp>
28
30
31namespace mongocxx {
32namespace v_noabi {
33
37class hint {
38 public:
48 MONGOCXX_ABI_EXPORT_CDECL() hint(bsoncxx::v_noabi::document::view_or_value index);
49
56 explicit MONGOCXX_ABI_EXPORT_CDECL() hint(bsoncxx::v_noabi::string::view_or_value index);
57
65 friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const hint& index_hint, std::string index);
66
74 friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const hint& index_hint,
75 bsoncxx::v_noabi::document::view index);
76
84 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::types::bson_value::view) to_value() const;
85
93 operator bsoncxx::v_noabi::types::bson_value::view() const {
94 return to_value();
95 }
96
97 private:
100};
101
108
110MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(std::string index, const hint& index_hint);
111
113MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(const hint& index_hint, std::string index);
114
116MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(std::string index, const hint& index_index);
117
120
127
130operator==(bsoncxx::v_noabi::document::view index, const hint& index_hint);
133operator!=(const hint& index_hint, bsoncxx::v_noabi::document::view index);
136operator!=(bsoncxx::v_noabi::document::view index, const hint& index_hint);
137
140
141} // namespace v_noabi
142} // namespace mongocxx
143
144namespace mongocxx {
145
146using ::mongocxx::v_noabi::operator==;
147using ::mongocxx::v_noabi::operator!=;
148
149} // namespace mongocxx
150
152
157
158#if defined(MONGOCXX_PRIVATE_DOXYGEN_PREPROCESSOR)
159
160namespace mongocxx {
161
163bool operator==(std::string index, const v_noabi::hint& index_hint);
164
166bool operator!=(const v_noabi::hint& index_hint, std::string index);
167
169bool operator!=(std::string index, const v_noabi::hint& index_index);
170
173
176
179
180} // namespace mongocxx
181
182#endif // defined(MONGOCXX_PRIVATE_DOXYGEN_PREPROCESSOR)
A read-only, non-owning view of a BSON document.
Definition view.hpp:35
A polyfill for std::optional<T>.
Definition optional.hpp:874
Class representing a hint to be passed to a database operation.
Definition hint.hpp:37
bsoncxx::v_noabi::types::bson_value::view to_value() const
Returns a types::bson_value::view representing this hint.
operator bsoncxx::v_noabi::types::bson_value::view() const
Returns a types::bson_value::view representing this hint.
Definition hint.hpp:93
bool operator==(std::string index, const hint &index_hint)
Convenience methods to compare against an index name.
bool operator!=(const hint &index_hint, std::string index)
Convenience methods to compare against an index name.
bool operator!=(std::string index, const hint &index_index)
Convenience methods to compare against an index name.
Provides bsoncxx::v_noabi::document::value.
Provides bsoncxx::v_noabi::document::view_or_value.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition fwd.hpp:222
Declares mongocxx::v_noabi::hint.
The mongocxx macro guard postlude header.
The mongocxx macro guard prelude header.
The top-level namespace within which all bsoncxx library entities are declared.
The top-level namespace within which all mongocxx library entities are declared.
bool operator!=(const v_noabi::hint &index_hint, std::string index)
mongocxx::v_noabi::operator!=(const v_noabi::hint& index_hint, std::string index)
bool operator==(std::string index, const v_noabi::hint &index_hint)
mongocxx::v_noabi::operator==(std::string index, const v_noabi::hint& index_hint)
The top-level namespace reserved for the C++ standard library.
Provides std::optional-related polyfills for library API usage.
Redeclares bsoncxx::v_noabi::stdx in mongocxx::v_noabi::stdx for internal use.
Provides bsoncxx::v_noabi::string::view_or_value.
Provides bsoncxx::v_noabi::types::bson_value::view.