Audacity 3.2.0
SelectFile.h
Go to the documentation of this file.
1/*!********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file SelectFile.h
6
7 Paul Licameli split from FileNames.h
8
9 **********************************************************************/
10
11#ifndef __AUDACITY_SELECT_FILE__
12#define __AUDACITY_SELECT_FILE__
13
14#include "Identifier.h" // for FilePath
15#include <vector>
16class wxWindow;
17
19namespace FileNames {
20 enum class Operation;
21 struct FileType;
22}
23using FileTypes = std::vector< FileNames::FileType >;
24
25WX_INIT_API FilePath
26SelectFile(FileNames::Operation op, // op matters only when default_path is empty
27 const TranslatableString& message,
28 const FilePath& default_path,
29 const FilePath& default_filename,
30 const FileExtension& default_extension,
31 const FileTypes& fileTypes,
32 int flags,
33 wxWindow *parent);
34
37#if defined(__WXMSW__)
38WX_INIT_API char *VerifyFilename(const wxString &s, bool input = true);
39#endif
40
41// Use this macro to wrap all filenames and pathnames that get
42// passed directly to a system call, like opening a file, creating
43// a directory, checking to see that a file exists, etc...
44#if defined(__WXMSW__)
45// Note, on Windows we don't define an OSFILENAME() to prevent accidental use.
46// See VerifyFilename() for an explanation.
47#define OSINPUT(X) VerifyFilename(X, true)
48#define OSOUTPUT(X) VerifyFilename(X, false)
49#elif defined(__WXMAC__)
50#define OSFILENAME(X) ((char *) (const char *)(X).fn_str())
51#define OSINPUT(X) OSFILENAME(X)
52#define OSOUTPUT(X) OSFILENAME(X)
53#else
54#define OSFILENAME(X) ((char *) (const char *)(X).mb_str())
55#define OSINPUT(X) OSFILENAME(X)
56#define OSOUTPUT(X) OSFILENAME(X)
57#endif
58
59#endif
wxString FileExtension
File extension, not including any leading dot.
Definition: Identifier.h:224
wxString FilePath
Definition: Project.h:21
WX_INIT_API FilePath SelectFile(FileNames::Operation op, const TranslatableString &message, const FilePath &default_path, const FilePath &default_filename, const FileExtension &default_extension, const FileTypes &fileTypes, int flags, wxWindow *parent)
Definition: SelectFile.cpp:17
WX_INIT_API char * VerifyFilename(const wxString &s, bool input=true)
Protect against Unicode to multi-byte conversion failures on Windows.
Definition: SelectFile.cpp:45
std::vector< FileNames::FileType > FileTypes
Definition: SelectFile.h:23
Holds a msgid for the translation catalog; may also bind format arguments.