xentara-utils v2.0.4
The Xentara Utility Library
|
An iterator that traverses all directories in a standard system search path. More...
#include <xentara/utils/filesystem/StandardPathIterator.hpp>
Public Types | |
using | value_type = std::filesystem::path |
The value type. | |
using | difference_type = std::ptrdiff_t |
Dummy type for non-existend difference type. | |
using | pointer = const std::filesystem::path * |
A pointer to a value. | |
using | reference = const std::filesystem::path & |
A reference to a value. | |
using | iterator_concept = std::input_iterator_tag |
The iterator concept. | |
using | iterator_category = iterator_concept |
The iterator category, for use in pre-C++20 code. | |
Public Member Functions | |
constexpr | StandardPathIterator () noexcept=default |
Default constructor. | |
StandardPathIterator (StandardPath type) | |
Constructor for a certain type of search path. | |
constexpr | StandardPathIterator (std::default_sentinel_t) noexcept |
Constructor for a sentinel. | |
auto | operator== (const StandardPathIterator &rhs) const noexcept -> bool |
Equality operator. | |
auto | operator== (std::default_sentinel_t) const noexcept -> bool |
Comparison with a sentinel. | |
auto | operator* () const noexcept -> const std::filesystem::path & |
Accesses the current directory. | |
auto | operator-> () const noexcept -> const std::filesystem::path * |
Accesses the current directory. | |
auto | operator++ () -> StandardPathIterator & |
Fetches the next directory in the search path. | |
Related Symbols | |
(Note that these are not member symbols.) | |
auto | begin (StandardPathIterator iterator) -> StandardPathIterator |
Gets a begin iterator for a standard path iterator. | |
auto | end (StandardPathIterator) -> std::default_sentinel_t |
Gets an end iterator for a standard path iterator. | |
auto | begin (StandardPath path) -> StandardPathIterator |
Gets a begin iterator for a standard path. | |
auto | end (StandardPath) -> std::default_sentinel_t |
Gets an end iterator for a standard path. | |
An iterator that traverses all directories in a standard system search path.
This is an iterator object that can be used to iterate of all of the standard locations for a certain type of file. Standard path iterators are input iterators and can be used in algorithms that take an input iterator. Standard path iterators also supply freestanding [begin()](xentara::utils::windows::wmi::begin(StandardPathIterator)) and [end()](xentara::utils::windows::wmi::end(StandardPathIterator)) functions, so they can be used in range-based for loops:
Genarally, however, it is easier to use an xentara::utils::filesystem::StandardPath enum value in the for loop directly:
Dummy type for non-existend difference type.
The iterator category, for use in pre-C++20 code.
The iterator concept.
A pointer to a value.
A reference to a value.
The value type.
|
constexprdefaultnoexcept |
Default constructor.
This constructor constructs a dummy itertor that does not iterate over any files.
Default constructed iterator compare equal to exhaused iterator, so they can be used as sentinels in algorithms that require the iterator and sentinel to be of the same type.
xentara::utils::filesystem::StandardPathIterator::StandardPathIterator | ( | StandardPath | type | ) |
Constructor for a certain type of search path.
This constructor constructs an iterator pointing to the first directory in the given search path.
|
constexprnoexcept |
Constructor for a sentinel.
This constructor constructs an object that compares equal to exhaused iterators, so it can be used as a sentinel in algorithms that require the iterator and sentinel to be of the same type.
This constructor is identical to the default constructor.
|
noexcept |
Accesses the current directory.
auto xentara::utils::filesystem::StandardPathIterator::operator++ | ( | ) | -> StandardPathIterator & |
Fetches the next directory in the search path.
|
noexcept |
Accesses the current directory.
|
noexcept |
Equality operator.
A iterator only compares equal to itself, except exhaused iterators, that compare equal to all other exhaused iterators, including default constructed iterators. This allows using default constructed iterators as sentinels in algorithms that require the iterator and sentinel to be of the same type.
|
noexcept |
Comparison with a sentinel.
|
related |
Gets a begin iterator for a standard path.
This function enables the use of StandardPath in range-based for loops
#include <xentara/utils/filesystem/StandardPathIterator.hpp>
path | The type of path to iterate over |
|
related |
Gets a begin iterator for a standard path iterator.
This function enables the use of StandardPathIterator in range-based for loops
iterator | The iterator to iterate over |
|
related |
Gets an end iterator for a standard path.
This function enables the use of StandardPath in range-based for loops
#include <xentara/utils/filesystem/StandardPathIterator.hpp>
|
related |
Gets an end iterator for a standard path iterator.
This function enables the use of StandardPathIterator in range-based for loops