Loading...
Searching...
No Matches
upload.hpp
Go to the documentation of this file.
// Copyright 2009-present MongoDB, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <mongocxx/result/gridfs/upload-fwd.hpp> // IWYU pragma: export
//
#include <mongocxx/v1/gridfs/upload_result.hpp> // IWYU pragma: export
#include <utility>
#include <bsoncxx/array/value.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
#include <bsoncxx/types/value.hpp>
#include <bsoncxx/types/view.hpp>
#include <mongocxx/config/prelude.hpp>
namespace mongocxx {
namespace v_noabi {
namespace result {
namespace gridfs {
class upload {
public:
~upload() = default;
upload(upload&& other) noexcept = default;
upload& operator=(upload&& other) noexcept = default;
upload(upload const& other) : _id_owner{other._id_owner}, _id{_id_owner} {}
upload& operator=(upload const& other) {
if (this != &other) {
_id_owner = other._id_owner;
_id = _id_owner;
}
return *this;
}
upload(bsoncxx::v_noabi::types::bson_value::view id) : _id_owner{id}, _id{_id_owner} {}
/* explicit(false) */ MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE() upload(v1::gridfs::upload_result opts);
explicit MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE() operator v1::gridfs::upload_result() const;
bsoncxx::v_noabi::types::view const& id() const {
return _id;
}
friend bool operator==(upload const& lhs, upload const& rhs) {
return lhs._id == rhs._id;
}
friend bool operator!=(upload const& lhs, upload const& rhs) {
return !(lhs == rhs);
}
private:
bsoncxx::v_noabi::types::value _id_owner;
bsoncxx::v_noabi::types::view _id;
};
} // namespace gridfs
} // namespace result
} // namespace v_noabi
} // namespace mongocxx
namespace mongocxx {
namespace v_noabi {
inline v_noabi::result::gridfs::upload from_v1(v1::gridfs::upload_result v) {
return {std::move(v)};
}
inline v1::gridfs::upload_result to_v1(v_noabi::result::gridfs::upload const& v) {
return v1::gridfs::upload_result{v};
}
} // namespace v_noabi
} // namespace mongocxx
#include <mongocxx/config/postlude.hpp>
bsoncxx::v_noabi::types::bson_value::view
A non-owning variant that can contain any BSON type.
Definition view.hpp:62
mongocxx::v1::gridfs::upload_result
Result of uploading a file to a GridFS bucket.
Definition upload_result.hpp:40
mongocxx::v_noabi::result::gridfs::upload
The result of a GridFS upload operation.
Definition upload.hpp:37
mongocxx::v_noabi::result::gridfs::upload::upload
upload(bsoncxx::v_noabi::types::bson_value::view id)
Definition upload.hpp:58
mongocxx::v_noabi::result::gridfs::upload::upload_result
operator v1::gridfs::upload_result() const
Convert to the mongocxx::v1 equivalent.
mongocxx::v_noabi::result::gridfs::upload::id
bsoncxx::v_noabi::types::view const & id() const
Gets the id of the uploaded GridFS file.
Definition upload.hpp:75
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE
#define MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(...)
Equivalent to MONGOCXX_ABI_EXPORT_UNSTABLE with MONGOCXX_ABI_CDECL.
Definition config.hpp:28
postlude.hpp
The mongocxx v_noabi macro guard postlude header.
prelude.hpp
The mongocxx v_noabi macro guard prelude header.
bsoncxx::v_noabi::types::view
v_noabi::types::bson_value::view view
Equivalent to bsoncxx::v_noabi::types::bson_value::view.
Definition view-fwd.hpp:35
bsoncxx::v_noabi::types::value
bson_value::value value
Equivalent to bsoncxx::v_noabi::types::bson_value::value.
Definition value-fwd.hpp:35
bsoncxx
The top-level namespace within which all bsoncxx library entities are declared.
mongocxx::v1
Declares entities whose ABI stability is guaranteed for documented symbols.
mongocxx::v_noabi::result::gridfs
Declares entities representing the result of GridFS commands.
mongocxx::v_noabi::result
Declares entities representing the result of various commands.
mongocxx::v_noabi
Declares entities whose ABI stability is NOT guaranteed.
mongocxx::v_noabi::operator==
bool operator==(std::string str, hint const &hint)
Convenience methods to compare against an index name.
Definition hint.hpp:138
mongocxx::v_noabi::operator!=
bool operator!=(hint const &hint, std::string str)
Convenience methods to compare against an index name.
Definition hint.hpp:143
mongocxx::v_noabi::to_v1
v1::bulk_write to_v1(v_noabi::bulk_write v)
Convert to the mongocxx::v1 equivalent of v.
Definition bulk_write.hpp:162
mongocxx::v_noabi::from_v1
v_noabi::bulk_write from_v1(v1::bulk_write v)
Convert to the mongocxx::v_noabi equivalent of v.
Definition bulk_write.hpp:155
mongocxx
The top-level namespace within which all mongocxx library entities are declared.
upload-fwd.hpp
Declares mongocxx::v_noabi::result::gridfs::upload.
upload_result.hpp
Provides mongocxx::v1::gridfs::upload_result.
value.hpp
Provides bsoncxx::v_noabi::array::value.
value.hpp
Equivalent to bsoncxx/types/bson_value/value.hpp.
view.hpp
Equivalent to bsoncxx/types/bson_value/view.hpp.