EchoMap 2026-07-25 6d3977c
An experimental cross-platform digital signal processing application for sound-source localisation.
Loading...
Searching...
No Matches
echomap::FilesystemCombo::EntryCache Struct Reference

A cache of Entry objects under a single root directory. More...

Public Member Functions

 EntryCache (const std::filesystem::path &directory)
 Creates a new EntryCache and populates it for the given root directory.

Public Attributes

std::filesystem::path directory
 The root directory on the file-system.
std::vector< Entryentries
 The first-level children of the root.

Detailed Description

A cache of Entry objects under a single root directory.

Definition at line 135 of file FilesystemCombo.hpp.

Constructor & Destructor Documentation

◆ EntryCache()

echomap::FilesystemCombo::EntryCache::EntryCache ( const std::filesystem::path & directory)
explicit

Creates a new EntryCache and populates it for the given root directory.

Upon constructing the EntryCache, the (immediate) children of the given directory are packed into Entry objects and collated into the cache. Exceptions may be thrown from the std::filesystem API. Symbolic links are followed.

Parameters
directoryThe path of the directory root to be traversed.

Definition at line 86 of file FilesystemCombo.cpp.

88 :
90{
91 std::error_code error_code;
92
93 std::filesystem::directory_iterator iterator{
95 std::filesystem::directory_options::skip_permission_denied |
96 std::filesystem::directory_options::follow_directory_symlink,
97 error_code
98 };
99
100 const std::filesystem::directory_iterator end{};
101
102 while (!error_code && iterator != end) {
103 const std::filesystem::directory_entry& directory_entry = *iterator;
104 std::error_code entry_error_code;
105 const std::filesystem::file_status status = directory_entry.status(entry_error_code);
106
107 if (!entry_error_code) {
108 // ReSharper disable CppTooWideScopeInitStatement
109 const bool is_directory = std::filesystem::is_directory(status);
111 // ReSharper restore CppTooWideScopeInitStatement
112
113 if (is_directory || is_regular_file)
114 entries.emplace_back(directory_entry.path(), is_directory);
115 }
116
117 iterator.increment(error_code);
118 }
119
121}
T end(T... args)
T sort(T... args)
std::filesystem::path directory
The root directory on the file-system.
std::vector< Entry > entries
The first-level children of the root.

Member Data Documentation

◆ directory

std::filesystem::path echomap::FilesystemCombo::EntryCache::directory

The root directory on the file-system.

Definition at line 148 of file FilesystemCombo.hpp.

◆ entries

std::vector<Entry> echomap::FilesystemCombo::EntryCache::entries

The first-level children of the root.

Definition at line 149 of file FilesystemCombo.hpp.


The documentation for this struct was generated from the following files: