24#include <unordered_map>
27#include "boost/iostreams/concepts.hpp"
28#include "boost/iostreams/stream.hpp"
57 const std::unordered_map<std::
string, std::
string> &config = {});
84 std::
string read(std::string_view path);
92 void write(std::string_view path, std::string_view data);
108 [[deprecated("Use
exists() instead.")]]
132 void copy(std::string_view src, std::string_view dst);
140 void rename(std::string_view src, std::string_view dst);
169 void destroy() noexcept;
184 :
public boost::iostreams::device<boost::iostreams::input_seekable> {
190 std::streamsize
read(
void *s, std::streamsize n);
192 std::streampos
seek(std::streamoff off, std::ios_base::seekdir way);
199 void destroy() noexcept;
201 ffi::
Reader *reader_{
nullptr};
215 :
public boost::iostreams::stream<boost::reference_wrapper<Reader>> {
218 : boost::iostreams::stream<boost::reference_wrapper<
Reader>>(
219 boost::ref(reader_)),
220 reader_(std::move(reader)) {}
259 current_entry_ = lister_.next();
265 if (current_entry_) {
266 current_entry_ = lister_.next();
272 return current_entry_ != std::nullopt ||
273 other.current_entry_ != std::nullopt;
284 std::optional<Entry> current_entry_;
300 Lister(ffi::Lister *pointer)
noexcept;
302 void destroy() noexcept;
304 ffi::
Lister *lister_{
nullptr};
The entry of a file or directory.
Definition data_structure.hpp:60
Definition opendal.hpp:250
std::ptrdiff_t difference_type
Definition opendal.hpp:254
Entry operator*()
Definition opendal.hpp:262
Iterator(Lister &lister)
Definition opendal.hpp:258
std::input_iterator_tag iterator_category
Definition opendal.hpp:252
Iterator(Lister &lister, bool) noexcept
Definition opendal.hpp:278
Iterator & operator++()
Definition opendal.hpp:264
bool operator!=(const Iterator &other) const
Definition opendal.hpp:271
Lister is designed to list the entries of a directory.
Definition opendal.hpp:238
std::optional< Entry > next()
Get the next entry of the lister.
Lister(Lister &&other) noexcept
Iterator begin()
Definition opendal.hpp:294
Iterator end()
Definition opendal.hpp:295
Operator is the entry for all public APIs.
Definition opendal.hpp:46
void rename(std::string_view src, std::string_view dst)
Rename a file from src to dst.
Lister lister(std::string_view path)
void create_dir(std::string_view path)
Create a directory.
void remove(std::string_view path)
Remove a file or directory.
Metadata stat(std::string_view path)
Get the metadata of a file or directory.
void write(std::string_view path, std::string_view data)
Write data to the operator.
std::vector< Entry > list(std::string_view path)
List the entries of a directory.
Operator(Operator &&other) noexcept
std::string read(std::string_view path)
Read data from the operator.
Operator(const Operator &)=delete
bool is_exist(std::string_view path)
Check if the path exists.
Operator & operator=(const Operator &)=delete
bool exists(std::string_view path)
Check if the path exists.
Operator & operator=(Operator &&other) noexcept
Reader reader(std::string_view path)
Read data from the operator.
void copy(std::string_view src, std::string_view dst)
Copy a file from src to dst.
bool available() const
Check if the operator is available.
ReaderStream is a stream wrapper of Reader which can provide iostream interface. It will keep a Reade...
Definition opendal.hpp:215
ReaderStream(Reader &&reader)
Definition opendal.hpp:217
Reader is designed to read data from the operator.
Definition opendal.hpp:184
Reader(Reader &&other) noexcept
std::streampos seek(std::streamoff off, std::ios_base::seekdir way)
std::streamsize read(void *s, std::streamsize n)
Definition data_structure.hpp:28