Loading...
Searching...
No Matches
uploader.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/gridfs/uploader-fwd.hpp> // IWYU pragma: export
//
#include <mongocxx/v1/gridfs/uploader.hpp> // IWYU pragma: export
#include <cstddef>
#include <cstdint>
#include <memory> // IWYU pragma: keep: backward compatibility, to be removed.
#include <utility>
#include <mongocxx/gridfs/bucket-fwd.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
#include <bsoncxx/document/value.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
#include <bsoncxx/stdx/optional.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
#include <bsoncxx/stdx/string_view.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
#include <bsoncxx/types/bson_value/view.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
#include <bsoncxx/view_or_value.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
#include <mongocxx/client_session.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
#include <mongocxx/collection.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
#include <mongocxx/result/gridfs/upload.hpp>
#include <mongocxx/config/prelude.hpp>
namespace mongocxx {
namespace v_noabi {
namespace gridfs {
class uploader {
private:
v1::gridfs::uploader _uploader;
public:
uploader() noexcept {}
uploader(uploader&&) noexcept = default;
uploader& operator=(uploader&&) noexcept = default;
uploader(uploader const& other) = delete;
uploader& operator=(uploader const& other) = delete;
~uploader() = default;
/* explicit(false) */ uploader(v1::gridfs::uploader uploader) : _uploader{std::move(uploader)} {}
explicit operator v1::gridfs::uploader() && {
return std::move(_uploader);
}
explicit operator v1::gridfs::uploader() const& = delete;
explicit operator bool() const noexcept {
return _uploader.operator bool();
}
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(void) write(std::uint8_t const* bytes, std::size_t length);
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(result::gridfs::upload) close();
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(void) abort();
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(std::int32_t) chunk_size() const;
class internal;
};
} // namespace gridfs
} // namespace v_noabi
} // namespace mongocxx
namespace mongocxx {
namespace v_noabi {
inline v_noabi::gridfs::uploader from_v1(v1::gridfs::uploader v) {
return {std::move(v)};
}
inline v1::gridfs::uploader to_v1(v_noabi::gridfs::uploader v) {
return v1::gridfs::uploader{std::move(v)};
}
} // namespace v_noabi
} // namespace mongocxx
#include <mongocxx/config/postlude.hpp>
mongocxx::gridfs::uploader::uploader
uploader() noexcept
Default constructs an uploader object. The uploader is equivalent to the state of a moved from upload...
Definition uploader.hpp:59
mongocxx::v1::gridfs::uploader
Support for uploading files to a GridFS bucket.
Definition uploader.hpp:42
mongocxx::v_noabi::gridfs::uploader
Used to upload a GridFS file.
Definition uploader.hpp:49
mongocxx::v_noabi::gridfs::uploader::abort
void abort()
Aborts uploading the file.
mongocxx::v_noabi::gridfs::uploader::uploader
uploader() noexcept
Default constructs an uploader object. The uploader is equivalent to the state of a moved from upload...
Definition uploader.hpp:59
mongocxx::v_noabi::gridfs::uploader::chunk_size
std::int32_t chunk_size() const
Gets the chunk size of the file being uploaded.
mongocxx::v_noabi::gridfs::uploader::uploader
uploader(uploader &&) noexcept=default
Move constructs an uploader.
mongocxx::v_noabi::gridfs::uploader::write
void write(std::uint8_t const *bytes, std::size_t length)
Writes a specified number of bytes to a GridFS file.
mongocxx::v_noabi::gridfs::uploader::close
result::gridfs::upload close()
Closes the uploader stream.
mongocxx::v_noabi::result::gridfs::upload
The result of a GridFS upload operation.
Definition upload.hpp:37
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.
mongocxx::v1
Declares entities whose ABI stability is guaranteed for documented symbols.
mongocxx::v_noabi::gridfs
Declares entities related to GridFS.
mongocxx::v_noabi
Declares entities whose ABI stability is NOT guaranteed.
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.hpp
Provides mongocxx::v_noabi::result::gridfs::upload.
uploader.hpp
Provides mongocxx::v1::gridfs::uploader.
value.hpp
Provides bsoncxx::v_noabi::document::value.
optional.hpp
Provides std::optional-related polyfills for library API usage.
string_view.hpp
Provides std::string_view-related polyfills for library API usage.
view.hpp
Provides bsoncxx::v_noabi::types::bson_value::view.
client_session.hpp
Provides mongocxx::v_noabi::client_session.
collection.hpp
Provides mongocxx::v_noabi::collection.
bucket-fwd.hpp
Declares mongocxx::v_noabi::gridfs::bucket.
uploader-fwd.hpp
Declares utilities to upload GridFS files.
view_or_value.hpp
Provides bsoncxx::v_noabi::view_or_value.