Audacity  2.2.0
FileException.h
Go to the documentation of this file.
1 //
2 // FileException.h
3 //
4 //
5 // Created by Paul Licameli on 11/22/16.
6 //
7 //
8 
9 #ifndef __AUDACITY_FILE_EXCEPTION__
10 #define __AUDACITY_FILE_EXCEPTION__
11 
12 #include "AudacityException.h"
13 #include <wx/filename.h>
14 
15 class FileException /* not final */ : public MessageBoxException
16 {
17 public:
18  enum class Cause { Open, Read, Write, Rename };
19 
20  explicit FileException
21  ( Cause cause_, const wxFileName &fileName_,
22  const wxString &caption = _("File Error"),
23  const wxFileName &renameTarget_ = {})
25  , cause{ cause_ }, fileName{ fileName_ }, renameTarget{ renameTarget_ }
26  {}
27 
29  : MessageBoxException(std::move(that))
30  , cause{ that.cause }
31  , fileName{ that.fileName }
32  , renameTarget{ that.renameTarget }
33  {}
34 
36 
37  ~FileException() override;
38 
39 protected:
40  std::unique_ptr< AudacityException > Move() override;
41 
42  // Format a default, internationalized error message for this exception.
43  wxString ErrorMessage() const override;
44 
45 public:
47  wxFileName fileName;
48  wxFileName renameTarget;
49 };
50 
51 #endif
FileException & operator=(FileException &&) PROHIBITED
#define PROHIBITED
Definition: Audacity.h:248
wxFileName renameTarget
Definition: FileException.h:48
root of a hierarchy of classes that are thrown and caught by Audacity.
Definition: AudacityException.h:24
FileException(FileException &&that)
Definition: FileException.h:28
Cause cause
Definition: FileException.h:46
Definition: FileException.h:15
std::unique_ptr< AudacityException > Move() override
Definition: FileException.cpp:17
FileException(Cause cause_, const wxFileName &fileName_, const wxString &caption=_("File Error"), const wxFileName &renameTarget_={})
Definition: FileException.h:21
wxFileName fileName
Definition: FileException.h:47
wxString caption
Definition: AudacityException.h:69
Cause
Definition: FileException.h:18
wxString ErrorMessage() const override
Definition: FileException.cpp:23
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
Definition: TrackControls.cpp:137
an AudacityException that pops up a single message box even if there were multiple exceptions of the ...
Definition: AudacityException.h:50