MongoDB C++ Driver 4.4.0
Loading...
Searching...
No Matches
upload.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/result/gridfs/upload-fwd.hpp> // IWYU pragma: export
18
19//
20
21#include <mongocxx/v1/gridfs/upload_result.hpp> // IWYU pragma: export
22
23#include <utility>
24
25#include <bsoncxx/array/value.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
28
30
31namespace mongocxx {
32namespace v_noabi {
33namespace result {
34namespace gridfs {
35
37class upload {
38 public:
39 ~upload() = default;
40
41 upload(upload&& other) noexcept = default;
42 upload& operator=(upload&& other) noexcept = default;
43
44 upload(upload const& other) : _id_owner{other._id_owner}, _id{_id_owner} {}
45
46 upload& operator=(upload const& other) {
47 if (this != &other) {
48 _id_owner = other._id_owner;
49 _id = _id_owner;
50 }
51
52 return *this;
53 }
54
58 upload(bsoncxx::v_noabi::types::bson_value::view id) : _id_owner{id}, _id{_id_owner} {}
59
63 /* explicit(false) */ MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE() upload(v1::gridfs::upload_result opts);
64
69
75 bsoncxx::v_noabi::types::view const& id() const {
76 return _id;
77 }
78
79 friend bool operator==(upload const& lhs, upload const& rhs) {
80 return lhs._id == rhs._id;
81 }
82
83 friend bool operator!=(upload const& lhs, upload const& rhs) {
84 return !(lhs == rhs);
85 }
86
87 private:
90};
91
92} // namespace gridfs
93} // namespace result
94} // namespace v_noabi
95} // namespace mongocxx
96
97namespace mongocxx {
98namespace v_noabi {
99
104 return {std::move(v)};
105}
106
113
114} // namespace v_noabi
115} // namespace mongocxx
116
118
A non-owning variant that can contain any BSON type.
Definition view.hpp:62
Result of uploading a file to a GridFS bucket.
Definition upload_result.hpp:40
The result of a GridFS upload operation.
Definition upload.hpp:37
upload(bsoncxx::v_noabi::types::bson_value::view id)
Definition upload.hpp:58
operator v1::gridfs::upload_result() const
Convert to the mongocxx::v1 equivalent.
bsoncxx::v_noabi::types::view const & id() const
Gets the id of the uploaded GridFS file.
Definition upload.hpp:75
#define MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(...)
Equivalent to MONGOCXX_ABI_EXPORT_UNSTABLE with MONGOCXX_ABI_CDECL.
Definition config.hpp:28
The mongocxx v_noabi macro guard postlude header.
The mongocxx v_noabi macro guard prelude header.
v_noabi::types::bson_value::view view
Equivalent to bsoncxx::v_noabi::types::bson_value::view.
Definition view-fwd.hpp:35
bson_value::value value
Equivalent to bsoncxx::v_noabi::types::bson_value::value.
Definition value-fwd.hpp:35
The top-level namespace within which all bsoncxx library entities are declared.
Declares entities whose ABI stability is guaranteed for documented symbols.
Declares entities representing the result of GridFS commands.
Declares entities representing the result of various commands.
Declares entities whose ABI stability is NOT guaranteed.
bool operator==(std::string str, hint const &hint)
Convenience methods to compare against an index name.
Definition hint.hpp:138
bool operator!=(hint const &hint, std::string str)
Convenience methods to compare against an index name.
Definition hint.hpp:143
v1::bulk_write to_v1(v_noabi::bulk_write v)
Convert to the mongocxx::v1 equivalent of v.
Definition bulk_write.hpp:162
v_noabi::bulk_write from_v1(v1::bulk_write v)
Convert to the mongocxx::v_noabi equivalent of v.
Definition bulk_write.hpp:155
The top-level namespace within which all mongocxx library entities are declared.
Declares mongocxx::v_noabi::result::gridfs::upload.
Provides mongocxx::v1::gridfs::upload_result.
Provides bsoncxx::v_noabi::array::value.
Equivalent to bsoncxx/types/bson_value/value.hpp.
Equivalent to bsoncxx/types/bson_value/view.hpp.