sdi_toolBox
Classes | Public Member Functions | Protected Attributes | List of all members
Wildcard Class Reference

#include <wildcard.h>

Detailed Description

Manages a list of file wildcard entries for use in wxWidgets file dialogs.

The Wildcard class provides a convenient way to build and format wildcard filter strings compatible with wxWidgets file dialogs (e.g., wxFileDialog).

Each entry consists of a human-readable description and a file pattern (e.g., *.txt). The formatted string follows the wxWidgets wildcard format:

"Description (*.ext)|*.ext|Other (*.other)|*.other"
Example
wc.addEntry("Text files", "*.txt");
wc.addEntry("CSV files", "*.csv");
wxString filter = wc.getWildcards(true); // includes "All files (*.*)|*.*"
wxFileDialog dlg(this, "Open file", "", "", filter, wxFD_OPEN);
Manages a list of file wildcard entries for use in wxWidgets file dialogs.
Definition wildcard.h:43
void addEntry(const wxString &description, const wxString &pattern)
Adds a new wildcard filter entry.
Definition wildcard.h:122
wxString getWildcards(bool addAllFiles=false) const
Builds and returns the formatted wildcard string for use in wxWidgets file dialogs.
Definition wildcard.h:128

Definition at line 42 of file wildcard.h.

Classes

struct  WildcardEntry
 Represents a single wildcard filter entry. More...
 

Public Member Functions

 Wildcard ()=default
 Default constructor.
 
virtual ~Wildcard ()=default
 Default destructor.
 
 Wildcard (const Wildcard &other)=default
 Copy constructor.
 
 Wildcard (Wildcard &&other) noexcept=default
 Move constructor.
 
Wildcardoperator= (const Wildcard &other)=default
 Copy assignment operator.
 
Wildcardoperator= (Wildcard &&other) noexcept=default
 Move assignment operator.
 
void clear ()
 Removes all wildcard entries.
 
void addEntry (const wxString &description, const wxString &pattern)
 Adds a new wildcard filter entry.
 
wxString getWildcards (bool addAllFiles=false) const
 Builds and returns the formatted wildcard string for use in wxWidgets file dialogs.
 

Protected Attributes

std::vector< WildcardEntrym_wildcards
 

Constructor & Destructor Documentation

◆ Wildcard() [1/3]

Wildcard ( )
default

Default constructor.

◆ ~Wildcard()

virtual ~Wildcard ( )
virtualdefault

Default destructor.

◆ Wildcard() [2/3]

Wildcard ( const Wildcard other)
default

Copy constructor.

Parameters
otherThe Wildcard instance to copy from.

◆ Wildcard() [3/3]

Wildcard ( Wildcard &&  other)
defaultnoexcept

Move constructor.

Parameters
otherThe Wildcard instance to move from.

Member Function Documentation

◆ operator=() [1/2]

Wildcard & operator= ( const Wildcard other)
default

Copy assignment operator.

Parameters
otherThe Wildcard instance to copy from.
Returns
Reference to this instance.

◆ operator=() [2/2]

Wildcard & operator= ( Wildcard &&  other)
defaultnoexcept

Move assignment operator.

Parameters
otherThe Wildcard instance to move from.
Returns
Reference to this instance.

◆ clear()

void clear ( )
inline

Removes all wildcard entries.

Definition at line 116 of file wildcard.h.

◆ addEntry()

void addEntry ( const wxString &  description,
const wxString &  pattern 
)
inline

Adds a new wildcard filter entry.

Parameters
descriptionHuman-readable description of the file type (e.g., "Text files").
patternFile pattern used for filtering (e.g., "*.txt").

Definition at line 122 of file wildcard.h.

◆ getWildcards()

wxString getWildcards ( bool  addAllFiles = false) const
inline

Builds and returns the formatted wildcard string for use in wxWidgets file dialogs.

Parameters
addAllFilesIf true, appends an "All files (*.*)|*.*" entry at the end.
Returns
A formatted wildcard string compatible with wxWidgets file dialog filters.

Definition at line 128 of file wildcard.h.

Member Data Documentation

◆ m_wildcards

std::vector<WildcardEntry> m_wildcards
protected

Definition at line 112 of file wildcard.h.