MongoDB C++ Driver 4.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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==(hint const& index_hint, std::string index);
64
72 friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(hint const& index_hint, bsoncxx::v_noabi::document::view index);
73
81 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::types::bson_value::view) to_value() const;
82
90 operator bsoncxx::v_noabi::types::bson_value::view() const {
91 return to_value();
92 }
93
94 private:
97};
98
105
107MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(std::string index, hint const& index_hint);
108
110MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(hint const& index_hint, std::string index);
111
113MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(std::string index, hint const& index_index);
114
117
124
127operator==(bsoncxx::v_noabi::document::view index, hint const& index_hint);
130operator!=(hint const& index_hint, bsoncxx::v_noabi::document::view index);
133operator!=(bsoncxx::v_noabi::document::view index, hint const& index_hint);
134
137
138} // namespace v_noabi
139} // namespace mongocxx
140
141namespace mongocxx {
142
143using ::mongocxx::v_noabi::operator==;
144using ::mongocxx::v_noabi::operator!=;
145
146} // namespace mongocxx
147
149
A polyfill for std::optional<T>.
Definition optional.hpp:800
hint(bsoncxx::v_noabi::document::view_or_value index)
Constructs a new hint.
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:90
bool operator==(std::string index, hint const &index_hint)
Convenience methods to compare against an index name.
bool operator!=(hint const &index_hint, std::string index)
Convenience methods to compare against an index name.
hint(bsoncxx::v_noabi::document::view_or_value index)
Constructs a new hint.
bool operator!=(std::string index, hint const &index_index)
Convenience methods to compare against an index name.
Provides bsoncxx::v_noabi::document::value.
Provides bsoncxx::v_noabi::document::view_or_value.
Declares mongocxx::v_noabi::hint.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
The mongocxx v_noabi macro guard postlude header.
The mongocxx v_noabi macro guard prelude header.
The top-level namespace within which all bsoncxx library entities are declared.
Declares entities whose ABI stability is NOT guaranteed.
The top-level namespace within which all mongocxx library entities are declared.
Provides bsoncxx::v_noabi::string::view_or_value.
Provides bsoncxx::v_noabi::types::bson_value::view.
Provides std::optional-related polyfills for library API usage.