void wxTextValidator::SetCharExcludes(const wxString& chars) { wxArrayString arr; for ( wxString::const_iterator i = chars.begin(); i != chars.end(); ++i ) arr.Add(*i); SetExcludes(arr); }
FILE_NAME_CHAR_VALIDATOR::FILE_NAME_CHAR_VALIDATOR( wxString* aValue ) : wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST, aValue ) { // The Windows (DOS) file system forbidden characters already include the forbidden // file name characters for both Posix and OSX systems. The characters \/:*?|"<> are // illegal and filtered by the validator. wxString illegalChars = wxFileName::GetForbiddenChars( wxPATH_DOS ); wxTextValidator nameValidator( wxFILTER_EXCLUDE_CHAR_LIST ); wxArrayString illegalCharList; for( unsigned i = 0; i < illegalChars.size(); i++ ) illegalCharList.Add( wxString( illegalChars[i] ) ); SetExcludes( illegalCharList ); }
FILE_NAME_WITH_PATH_CHAR_VALIDATOR::FILE_NAME_WITH_PATH_CHAR_VALIDATOR( wxString* aValue ) : wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST, aValue ) { // The Windows (DOS) file system forbidden characters already include the forbidden // file name characters for both Posix and OSX systems. The characters *?|"<> are // illegal and filtered by the validator, but /\: are valid (\ and : only on Windows. wxString illegalChars = wxFileName::GetForbiddenChars(wxPATH_DOS ); wxTextValidator nameValidator( wxFILTER_EXCLUDE_CHAR_LIST ); wxArrayString illegalCharList; for( unsigned i = 0; i < illegalChars.size(); i++ ) { if( illegalChars[i] == '/' ) continue; #if defined (__WINDOWS__) if( illegalChars[i] == '\\' || illegalChars[i] == ':' ) continue; #endif illegalCharList.Add( wxString( illegalChars[i] ) ); } SetExcludes( illegalCharList ); }