4#include <sshpp/config.hpp>
8#include <sshpp/export.hpp>
29 explicit operator
bool() const noexcept {
return native_ !=
nullptr; }
33 std::optional<Attributes> next();
34 bool eof() const noexcept;
35 const
ErrorInfo& last_error() const noexcept {
return last_error_; }
40 : native_(n), sftp_(sftp), core_(
std::move(core)), path_(
std::move(
path)) {}
60 : dir_(&
dir), skip_dot_(skip_dot_entries) {
73 bool this_end = !current_.has_value();
74 bool other_end = !other.current_.has_value();
75 return this_end && other_end;
81 if (dir_ ==
nullptr) { current_.reset();
return; }
83 current_ = dir_->next();
84 if (!current_)
return;
85 if (!skip_dot_ || (current_->name !=
"." && current_->name !=
".."))
return;
89 Directory* dir_ =
nullptr;
90 bool skip_dot_ =
true;
91 std::optional<Attributes> current_;
InputIterator over a Directory. Skips "." and ".." by default.
Definition directory.hpp:50
bool operator!=(const DirectoryIterator &other) const noexcept
Definition directory.hpp:77
bool operator==(const DirectoryIterator &other) const noexcept
Definition directory.hpp:72
std::ptrdiff_t difference_type
Definition directory.hpp:53
std::input_iterator_tag iterator_category
Definition directory.hpp:56
DirectoryIterator & operator++()
Definition directory.hpp:67
const Attributes & operator*() const
Definition directory.hpp:64
DirectoryIterator(Directory &dir, bool skip_dot_entries=true)
Definition directory.hpp:59
const Attributes * operator->() const
Definition directory.hpp:65
DirectoryIterator()=default
Range adapter: for (const auto& e : sftp::DirectoryRange{std::move(dir)}).
Definition directory.hpp:95
DirectoryIterator begin()
Definition directory.hpp:98
DirectoryIterator end()
Definition directory.hpp:99
DirectoryRange(Directory dir)
Definition directory.hpp:97
An open SFTP directory handle. See docs/design/06 §6.4.
Definition directory.hpp:21
const RemotePath & path() const noexcept
Definition directory.hpp:30
The SFTP subsystem session. See docs/design/06 §6.2.
Definition sftp.hpp:45
std::shared_ptr< SessionCore > SessionCorePtr
Definition session_core.hpp:43
Definition algorithms.ipp:10
::sftp_session_struct * native_sftp
Definition native_fwd.hpp:31
::sftp_dir_struct * native_sftp_dir
Definition native_fwd.hpp:33
std::filesystem::path path
Definition server_sftp_subsystem.ipp:38
DIR * dir
Definition server_sftp_subsystem.ipp:37
Value-type copy of libssh's sftp_attributes. See docs/design/06 §6.1.
Definition attributes.hpp:19