MongoDB C++ Driver mongocxx-3.0.0
Loading...
Searching...
No Matches
write.hpp
1// Copyright 2014 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 <cstdint>
18
19#include <bsoncxx/stdx/optional.hpp>
20#include <mongocxx/write_type.hpp>
21#include <mongocxx/model/insert_one.hpp>
22#include <mongocxx/model/delete_one.hpp>
23#include <mongocxx/model/delete_many.hpp>
24#include <mongocxx/model/update_one.hpp>
25#include <mongocxx/model/update_many.hpp>
26#include <mongocxx/model/replace_one.hpp>
27
28#include <mongocxx/config/prelude.hpp>
29
30namespace mongocxx {
31MONGOCXX_INLINE_NAMESPACE_BEGIN
32namespace model {
33
37class MONGOCXX_API write {
38 public:
39 write(insert_one value);
40 write(update_one value);
41 write(update_many value);
42 write(delete_one value);
43 write(delete_many value);
44 write(replace_one value);
45
46 write(write&& rhs) noexcept;
47 write& operator=(write&& rhs) noexcept;
48
49 write(const write& rhs) = delete;
50 write& operator=(const write& rhs) = delete;
51
52 ~write();
53
54 write_type type() const;
55
56 const insert_one& get_insert_one() const;
57 const update_one& get_update_one() const;
58 const update_many& get_update_many() const;
59 const delete_one& get_delete_one() const;
60 const delete_many& get_delete_many() const;
61 const replace_one& get_replace_one() const;
62
63 private:
64 MONGOCXX_PRIVATE void destroy_member() noexcept;
65
66 write_type _type;
67
68 union {
69 insert_one _insert_one;
70 update_one _update_one;
71 update_many _update_many;
72 delete_one _delete_one;
73 delete_many _delete_many;
74 replace_one _replace_one;
75 };
76};
77
78} // namespace model
79MONGOCXX_INLINE_NAMESPACE_END
80} // namespace mongocxx
81
82#include <mongocxx/config/postlude.hpp>
Class representing a MongoDB delete operation that removes multiple documents.
Definition delete_many.hpp:28
Class representing a MongoDB delete operation that removes a single document.
Definition delete_one.hpp:28
Class representing a MongoDB insert operation that creates a single document.
Definition insert_one.hpp:28
Class representing a MongoDB update operation that replaces a single document.
Definition replace_one.hpp:30
Class representing a MongoDB update operation that modifies multiple documents.
Definition update_many.hpp:30
Class representing a MongoDB update operation that modifies a single document.
Definition update_one.hpp:30
Definition write.hpp:37