MongoDB C++ Driver mongocxx-4.0.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
28
29namespace mongocxx {
30namespace v_noabi {
31
35class hint {
36 public:
46 MONGOCXX_ABI_EXPORT_CDECL() hint(bsoncxx::v_noabi::document::view_or_value index);
47
54 explicit MONGOCXX_ABI_EXPORT_CDECL() hint(bsoncxx::v_noabi::string::view_or_value index);
55
63 friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const hint& index_hint, std::string index);
64
72 friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const hint& index_hint,
73 bsoncxx::v_noabi::document::view index);
74
82 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::types::bson_value::view) to_value() const;
83
91 operator bsoncxx::v_noabi::types::bson_value::view() const {
92 return to_value();
93 }
94
95 private:
98};
99
106
108MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(std::string index, const hint& index_hint);
109
111MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(const hint& index_hint, std::string index);
112
114MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(std::string index, const hint& index_index);
115
118
125
128operator==(bsoncxx::v_noabi::document::view index, const hint& index_hint);
131operator!=(const hint& index_hint, bsoncxx::v_noabi::document::view index);
134operator!=(bsoncxx::v_noabi::document::view index, const hint& index_hint);
135
138
139} // namespace v_noabi
140} // namespace mongocxx
141
142namespace mongocxx {
143
144using ::mongocxx::v_noabi::operator==;
145using ::mongocxx::v_noabi::operator!=;
146
147} // namespace mongocxx
148
150
155
156#if defined(MONGOCXX_PRIVATE_DOXYGEN_PREPROCESSOR)
157
158namespace mongocxx {
159
161bool operator==(std::string index, const v_noabi::hint& index_hint);
162
164bool operator!=(const v_noabi::hint& index_hint, std::string index);
165
167bool operator!=(std::string index, const v_noabi::hint& index_index);
168
171
174
177
178} // namespace mongocxx
179
180#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:826
Class representing a hint to be passed to a database operation.
Definition hint.hpp:35
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:91
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:204
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.
Provides bsoncxx::v_noabi::string::view_or_value.
Provides bsoncxx::v_noabi::types::bson_value::view.