MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
server_api.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 <mongocxx/v1/server_api-fwd.hpp> // IWYU pragma: export
18
19//
20
22
25
27
28#include <string>
29#include <system_error>
30#include <type_traits>
31
32namespace mongocxx {
33namespace v1 {
34
47 // This class implements `ServerApi`:
48 // - https://specifications.readthedocs.io/en/latest/versioned-api/versioned-api/
49
50 private:
51 class impl;
52 void* _impl;
53
54 public:
60 enum class version {
65 };
66
73
81
88 MONGOCXX_ABI_EXPORT_CDECL(server_api&) operator=(server_api&& other) noexcept;
89
94
99
108
116
124
129
133 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bool>) strict() const;
134
139
144
149
155 enum class errc {
158 };
159
165 static MONGOCXX_ABI_EXPORT_CDECL(std::error_category const&) error_category();
166
172 friend std::error_code make_error_code(errc v) {
173 return {static_cast<int>(v), error_category()};
174 }
175
176 class internal;
177};
178
179} // namespace v1
180} // namespace mongocxx
181
182namespace std {
183
184template <>
185struct is_error_code_enum<mongocxx::v1::server_api::errc> : true_type {};
186
187} // namespace std
188
190
server_api(server_api &&other) noexcept
Move constructor.
static version version_from_string(bsoncxx::v1::stdx::string_view v)
Return the given server API version as an enumerator.
version get_version() const
Return the current "version" field.
server_api & deprecation_errors(bool v)
Set the "deprecationErrors" field.
errc
Errors codes which may be returned by mongocxx::v1::server_api.
Definition server_api.hpp:155
@ invalid_version
The server API version is invalid.
Definition server_api.hpp:157
@ zero
Zero.
Definition server_api.hpp:156
~server_api()
Destroy this object.
friend std::error_code make_error_code(errc v)
Support implicit conversion to std::error_code.
Definition server_api.hpp:172
server_api & strict(bool strict)
Set the "strict" field.
version
The server API version.
Definition server_api.hpp:60
@ k_version_1
Stable API Version 1.
Definition server_api.hpp:64
static std::string version_to_string(version v)
Return the given server API version as a string.
static std::error_category const & error_category()
The error category for mongocxx::v1::server_api::errc.
Provides macros to control the set of symbols exported in the ABI.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
The mongocxx v1 macro guard postlude header.
The mongocxx v1 macro guard prelude header.
The top-level namespace within which all bsoncxx library entities are declared.
Declares entities whose ABI stability is guaranteed for documented symbols.
@ mongocxx
From the mongocxx library.
Definition exception.hpp:42
The top-level namespace within which all mongocxx library entities are declared.
Declares mongocxx::v1::server_api.
Provides std::optional-related polyfills for library API usage.
Provides std::string_view-related polyfills for library API usage.