capydi
Loading...
Searching...
No Matches
FileIterator.hpp
Go to the documentation of this file.
1#ifndef FILE_ITERATOR_HPP_
2#define FILE_ITERATOR_HPP_
3
4#include "FileSystem.hpp"
5#include <optional>
6#include <filesystem>
7#include <regex>
8
10{
11private:
12 using IteratorType = std::filesystem::recursive_directory_iterator;
13public:
16
17#ifdef USE_WIDE_CHAR_PATH
18 using RegexType = std::wregex;
19#else
20 using RegexType = std::regex;
21#endif
22
23public:
24 FileIterator(const PathType& folder_path, const PathStringType& regex);
25
26public:
27 std::optional<PathType> next_file() noexcept;
28
29private:
30 void skip_all_unneeded() noexcept;
31 bool is_needed(const PathType& path) const noexcept;
32
33private:
34 IteratorType iterator_;
35 RegexType regular_expression_;
36};
37
38#endif // !FILE_ITERATOR_HPP_
FileIterator(const PathType &folder_path, const PathStringType &regex)
Definition FileIterator.cpp:3
std::optional< PathType > next_file() noexcept
Definition FileIterator.cpp:10
typename FileSystem::PathType PathType
Definition FileIterator.hpp:14
std::regex RegexType
Definition FileIterator.hpp:20
typename FileSystem::PathStringType PathStringType
Definition FileIterator.hpp:15
typename PathType::string_type PathStringType
Definition FileSystem.hpp:10
std::filesystem::path PathType
Definition FileSystem.hpp:9