KiCad PCB EDA Suite
FILE_NAME_WITH_PATH_CHAR_VALIDATOR Class Reference

Class FILE_NAME_WITH_PATH_CHAR_VALIDATOR. More...

#include <validators.h>

Inheritance diagram for FILE_NAME_WITH_PATH_CHAR_VALIDATOR:

Public Member Functions

 FILE_NAME_WITH_PATH_CHAR_VALIDATOR (wxString *aValue=NULL)
 

Detailed Description

Class FILE_NAME_WITH_PATH_CHAR_VALIDATOR.

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 58 of file validators.h.

Constructor & Destructor Documentation

FILE_NAME_WITH_PATH_CHAR_VALIDATOR::FILE_NAME_WITH_PATH_CHAR_VALIDATOR ( wxString *  aValue = NULL)

Definition at line 54 of file validators.cpp.

54  :
55  wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST | wxFILTER_EMPTY, aValue )
56 {
57  // The Windows (DOS) file system forbidden characters already include the forbidden
58  // file name characters for both Posix and OSX systems. The characters *?|"<> are
59  // illegal and filtered by the validator, but /\: are valid (\ and : only on Windows.
60  wxString illegalChars = wxFileName::GetForbiddenChars( wxPATH_DOS );
61  wxTextValidator nameValidator( wxFILTER_EXCLUDE_CHAR_LIST );
62  wxArrayString illegalCharList;
63 
64  for( unsigned i = 0; i < illegalChars.size(); i++ )
65  {
66  if( illegalChars[i] == '/' )
67  continue;
68 
69 #if defined (__WINDOWS__)
70  if( illegalChars[i] == '\\' || illegalChars[i] == ':' )
71  continue;
72 #endif
73  illegalCharList.Add( wxString( illegalChars[i] ) );
74  }
75 
76  SetExcludes( illegalCharList );
77 }

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