KiCad PCB EDA Suite
FILE_NAME_WITH_PATH_CHAR_VALIDATOR Class Reference

This class provides a custom wxValidator object for limiting the allowable characters when defining file names with path, for instance in schematic sheet file names. More...

#include <validators.h>

Inheritance diagram for FILE_NAME_WITH_PATH_CHAR_VALIDATOR:

Public Member Functions

 FILE_NAME_WITH_PATH_CHAR_VALIDATOR (wxString *aValue=nullptr)
 

Detailed Description

This class provides a custom wxValidator object for limiting the allowable characters when defining file names with path, for instance in schematic sheet file names.

The characters *?|"<> are illegal and filtered by the validator, but /\: are valid (\ and : only on Windows.)

Definition at line 76 of file validators.h.

Constructor & Destructor Documentation

◆ FILE_NAME_WITH_PATH_CHAR_VALIDATOR()

FILE_NAME_WITH_PATH_CHAR_VALIDATOR::FILE_NAME_WITH_PATH_CHAR_VALIDATOR ( wxString *  aValue = nullptr)

Definition at line 82 of file validators.cpp.

82 :
83 wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST | wxFILTER_EMPTY, aValue )
84{
85 // The Windows (DOS) file system forbidden characters already include the forbidden
86 // file name characters for both Posix and OSX systems. The characters *?|"<> are
87 // illegal and filtered by the validator, but /\: are valid (\ and : only on Windows.
88 wxString illegalChars = wxFileName::GetForbiddenChars( wxPATH_DOS );
89 wxTextValidator nameValidator( wxFILTER_EXCLUDE_CHAR_LIST );
90 wxArrayString illegalCharList;
91
92 for( unsigned i = 0; i < illegalChars.size(); i++ )
93 {
94 if( illegalChars[i] == '/' )
95 continue;
96
97#if defined (__WINDOWS__)
98 if( illegalChars[i] == '\\' || illegalChars[i] == ':' )
99 continue;
100#endif
101 illegalCharList.Add( wxString( illegalChars[i] ) );
102 }
103
104 SetExcludes( illegalCharList );
105}

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