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

A drawable and selectable representation of a file or directory on the file-system. More...

Public Member Functions

 Entry (const std::filesystem::path &path, bool is_directory_hint)
 Create a new Entry for a regular file or directory.
bool draw () const noexcept
 Draws the Entry as a Dear ImGui Selectable.

Public Attributes

std::filesystem::path path
 The path represented by the Entry.
std::string name
 The cached display name of the path.
bool is_directory
 Directory sentinel flag.

Private Attributes

std::string imgui_id
 Dear ImGui display name, including ID disambiguator.
ImGuiSelectableFlags flags
 Dear ImGui flags for rendering the Selectable.

Friends

std::strong_ordering operator<=> (const Entry &lhs, const Entry &rhs) noexcept
 Determines the ordering between two Entry objects.
bool operator== (const Entry &, const Entry &)=default
 Determines equality between two Entry objects.

Detailed Description

A drawable and selectable representation of a file or directory on the file-system.

Definition at line 60 of file FilesystemCombo.hpp.

Constructor & Destructor Documentation

◆ Entry()

echomap::FilesystemCombo::Entry::Entry ( const std::filesystem::path & path,
bool is_directory_hint )

Create a new Entry for a regular file or directory.

Parameters
pathThe path of the file to represent in the Entry.
is_directory_hintShould the Entry represent a directory?
Precondition
The directory hint matches metadata from std::filesystem::is_directory.

Definition at line 63 of file FilesystemCombo.cpp.

66 :
67 path(path),
68 name(path.filename().string()),
69 is_directory(is_directory_hint),
70 imgui_id((is_directory ? name + '/' : name) + "##" + path.string()),
71 flags(is_directory ? ImGuiSelectableFlags_NoAutoClosePopups : ImGuiSelectableFlags_None)
72{
74}
T is_directory(T... args)
bool is_directory
Directory sentinel flag.
std::string name
The cached display name of the path.
std::string imgui_id
Dear ImGui display name, including ID disambiguator.
std::filesystem::path path
The path represented by the Entry.
ImGuiSelectableFlags flags
Dear ImGui flags for rendering the Selectable.

Member Function Documentation

◆ draw()

bool echomap::FilesystemCombo::Entry::draw ( ) const
nodiscardnoexcept

Draws the Entry as a Dear ImGui Selectable.

Returns
Is the Entry selected?

Definition at line 76 of file FilesystemCombo.cpp.

77{
78 return ImGui::Selectable(imgui_id.c_str(), false, flags);
79}

◆ operator<=>

std::strong_ordering operator<=> ( const Entry & lhs,
const Entry & rhs )
friend

Determines the ordering between two Entry objects.

Parameters
lhsThe LHS Entry.
rhsThe RHS Entry.
Returns
The std::strong_ordering between the LHS and the RHS.

Definition at line 88 of file FilesystemCombo.hpp.

88 =>(
89 const Entry& lhs,
90 const Entry& rhs
91 ) noexcept
92 {
93 if (lhs.is_directory != rhs.is_directory)
94 return lhs.is_directory ? std::strong_ordering::less : std::strong_ordering::greater;
95
96 return lhs.name <=> rhs.name;
97 }
Entry(const std::filesystem::path &path, bool is_directory_hint)
Create a new Entry for a regular file or directory.

◆ operator==

bool operator== ( const Entry & ,
const Entry &  )
friend

Determines equality between two Entry objects.

Returns
Are the two entry objects considered equal?

Member Data Documentation

◆ flags

ImGuiSelectableFlags echomap::FilesystemCombo::Entry::flags
private

Dear ImGui flags for rendering the Selectable.

Definition at line 119 of file FilesystemCombo.hpp.

◆ imgui_id

std::string echomap::FilesystemCombo::Entry::imgui_id
private

Dear ImGui display name, including ID disambiguator.

Definition at line 118 of file FilesystemCombo.hpp.

◆ is_directory

bool echomap::FilesystemCombo::Entry::is_directory

Directory sentinel flag.

Definition at line 113 of file FilesystemCombo.hpp.

◆ name

std::string echomap::FilesystemCombo::Entry::name

The cached display name of the path.

Definition at line 112 of file FilesystemCombo.hpp.

◆ path

std::filesystem::path echomap::FilesystemCombo::Entry::path

The path represented by the Entry.

Definition at line 111 of file FilesystemCombo.hpp.


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