MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
instance.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/instance-fwd.hpp> // IWYU pragma: export
18
19//
20
22
24
26
27#include <memory>
28#include <system_error>
29#include <type_traits>
30
31namespace mongocxx {
32namespace v1 {
33
66class instance {
67 private:
68 class impl;
69 std::unique_ptr<impl> _impl;
70
71 public:
78
82 instance(instance&&) = delete;
83
88
92 instance(instance const&) = delete;
93
97 instance& operator=(instance const&) = delete;
98
115
130 explicit MONGOCXX_ABI_EXPORT_CDECL() instance(std::unique_ptr<v1::logger> handler);
131
144
150 enum class errc {
153 };
154
160 static MONGOCXX_ABI_EXPORT_CDECL(std::error_category const&) error_category();
161
167 friend std::error_code make_error_code(errc v) {
168 return {static_cast<int>(v), error_category()};
169 }
170};
171
172} // namespace v1
173} // namespace mongocxx
174
175template <>
176struct std::is_error_code_enum<mongocxx::v1::instance::errc> : true_type {};
177
179
A tag type representing mongoc's default unstructured log handler.
Definition logger.hpp:117
static std::error_category const & error_category()
The error category for mongocxx::v1::instance::errc.
instance & operator=(instance &&)=delete
This class is not moveable.
~instance()
Cleanup the mongocxx (and mongoc) library.
friend std::error_code make_error_code(errc v)
Support implicit conversion to std::error_code.
Definition instance.hpp:167
instance(instance const &)=delete
This class is not copyable.
instance(instance &&)=delete
This class is not moveable.
errc
Errors codes which may be returned by mongocxx::v1::instance.
Definition instance.hpp:150
@ multiple_instances
Cannot construct multiple instance objects in a given process.
Definition instance.hpp:152
@ zero
Zero.
Definition instance.hpp:151
instance & operator=(instance const &)=delete
This class is not copyable.
The interface for an unstructured log message handler.
Definition logger.hpp:59
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.
Declares entities whose ABI stability is guaranteed for documented symbols.
The top-level namespace within which all mongocxx library entities are declared.
Declares mongocxx::v1::instance.
Declares mongocxx::v1::logger.