MongoDB C++ Driver 4.2.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 <bsoncxx/array/value.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
26
28
29namespace mongocxx {
30namespace v_noabi {
31namespace result {
32namespace gridfs {
33
35class upload {
36 public:
37 ~upload() = default;
38
39 upload(upload&& other) noexcept = default;
40 upload& operator=(upload&& other) noexcept = default;
41
42 upload(upload const& other) : _id_owner{other._id_owner}, _id{_id_owner} {}
43
44 upload& operator=(upload const& other) {
45 if (this != &other) {
46 _id_owner = other._id_owner;
47 _id = _id_owner;
48 }
49
50 return *this;
51 }
52
56 upload(bsoncxx::v_noabi::types::bson_value::view id) : _id_owner{id}, _id{_id_owner} {}
57
61 /* explicit(false) */ MONGOCXX_ABI_EXPORT_CDECL() upload(v1::gridfs::upload_result opts);
62
66 explicit MONGOCXX_ABI_EXPORT_CDECL() operator v1::gridfs::upload_result() const;
67
73 bsoncxx::v_noabi::types::view const& id() const {
74 return _id;
75 }
76
77 friend bool operator==(upload const& lhs, upload const& rhs) {
78 return lhs._id == rhs._id;
79 }
80
81 friend bool operator!=(upload const& lhs, upload const& rhs) {
82 return !(lhs == rhs);
83 }
84
85 private:
88};
89
90} // namespace gridfs
91} // namespace result
92} // namespace v_noabi
93} // namespace mongocxx
94
96
A non-owning variant that can contain any BSON type.
Definition view.hpp:62
The result of a GridFS upload operation.
Definition upload.hpp:35
upload(bsoncxx::v_noabi::types::bson_value::view id)
Definition upload.hpp:56
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:73
#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.
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
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.