25#include <unordered_map>
28#include "boost/date_time/posix_time/ptime.hpp"
29#include "boost/iostreams/concepts.hpp"
30#include "boost/iostreams/stream.hpp"
61 std::optional<std::string>
etag;
91 const std::unordered_map<std::string, std::string> &config = {});
118 std::string
read(std::string_view path);
126 void write(std::string_view path, std::string_view data);
142 [[deprecated(
"Use exists() instead.")]]
166 void copy(std::string_view src, std::string_view dst);
174 void rename(std::string_view src, std::string_view dst);
198 std::vector<Entry>
list(std::string_view path);
203 std::unique_ptr<details::Operator> operator_;
216 :
public boost::iostreams::device<boost::iostreams::input_seekable> {
218 Reader(std::unique_ptr<details::Reader> &&reader);
224 std::streamsize
read(
void *s, std::streamsize n);
226 std::streampos
seek(std::streamoff off, std::ios_base::seekdir way);
229 std::unique_ptr<details::Reader> raw_reader_;
243 :
public boost::iostreams::stream<boost::reference_wrapper<Reader>> {
246 : boost::iostreams::stream<boost::reference_wrapper<
Reader>>(
247 boost::ref(reader_)),
248 reader_(std::move(reader)) {}
268 Lister(std::unique_ptr<details::Lister> lister);
289 current_entry_ = lister_.
next();
295 if (current_entry_) {
296 current_entry_ = lister_.
next();
302 return current_entry_ != std::nullopt ||
303 other.current_entry_ != std::nullopt;
312 std::optional<Entry> current_entry_;
328 std::unique_ptr<details::Lister> raw_lister_;
Definition opendal.hpp:280
std::ptrdiff_t difference_type
Definition opendal.hpp:284
Entry operator*()
Definition opendal.hpp:292
Iterator(Lister &lister, bool)
Definition opendal.hpp:308
Iterator(Lister &lister)
Definition opendal.hpp:288
std::input_iterator_tag iterator_category
Definition opendal.hpp:282
Iterator & operator++()
Definition opendal.hpp:294
bool operator!=(const Iterator &other) const
Definition opendal.hpp:301
Lister is designed to list the entries of a directory.
Definition opendal.hpp:266
Lister(std::unique_ptr< details::Lister > lister)
std::optional< Entry > next()
Get the next entry of the lister.
Iterator begin()
Definition opendal.hpp:324
Iterator end()
Definition opendal.hpp:325
Operator is the entry for all public APIs.
Definition opendal.hpp:80
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.
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(std::string_view scheme, const std::unordered_map< std::string, std::string > &config={})
Construct a new Operator object.
Operator & operator=(const Operator &)=delete
bool exists(std::string_view path)
Check if the path exists.
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.
Operator & operator=(Operator &&)
ReaderStream is a stream wrapper of Reader which can provide iostream interface. It will keep a Reade...
Definition opendal.hpp:243
ReaderStream(Reader &&reader)
Definition opendal.hpp:245
Reader is designed to read data from the operator.
Definition opendal.hpp:216
Reader(std::unique_ptr< details::Reader > &&reader)
std::streampos seek(std::streamoff off, std::ios_base::seekdir way)
std::streamsize read(void *s, std::streamsize n)
Definition opendal.hpp:32
EntryMode
The mode of the entry.
Definition opendal.hpp:44
The entry of a file or directory.
Definition opendal.hpp:69
std::string path
Definition opendal.hpp:70