Audacity  2.2.2
InconsistencyException.h
Go to the documentation of this file.
1 //
2 // InconsistencyException.h
3 //
4 //
5 // Created by Paul Licameli on 11/27/16.
6 //
7 // Some errors that formerly were assertion violations now throw exceptions,
8 // even in production code. These may be violations of function preconditions
9 // or the results of logical errors internal to functions. These conditions
10 // are supposed to be deducible statically as never happening.
11 //
12 
13 #ifndef __AUDACITY_INCONSISTENCY_EXCEPTION__
14 #define __AUDACITY_INCONSISTENCY_EXCEPTION__
15 
16 #include "AudacityException.h"
17 
19 {
20 public:
22 
23  explicit InconsistencyException
24  ( const char *fn, const char *f, unsigned l )
25  : MessageBoxException{ _("Internal Error") }
26  , func { fn }, file { f }, line { l }
27  {}
28 
30  : MessageBoxException(std::move(that))
31  , func{ that.func }
32  , file{ that.file }
33  , line{ that.line }
34  {}
36  {
37  if (this != &that) {
38  MessageBoxException::operator= (std::move(that));
39  func = that.func;
40  file = that.file;
41  line = that.line;
42  }
43  return *this;
44  }
45 
46  ~InconsistencyException() override;
47 
48  unsigned GetLine() const { return line; }
49 
50 private:
51  // Format a default, internationalized error message for this exception.
52  wxString ErrorMessage() const override;
53 
54  const char *func {};
55  const char *file {};
56  unsigned line {};
57 };
58 
59 // This macro constructs this exception type, using C++ preprocessor to identify
60 // the source code location.
61 
62 #ifdef __func__
63 
64 #define CONSTRUCT_INCONSISTENCY_EXCEPTION \
65  InconsistencyException( __func__, __FILE__ , __LINE__ )
66 
67 #else
68 
69 #define CONSTRUCT_INCONSISTENCY_EXCEPTION \
70  InconsistencyException( "", __FILE__ , __LINE__ )
71 
72 #endif
73 
74 #define THROW_INCONSISTENCY_EXCEPTION throw CONSTRUCT_INCONSISTENCY_EXCEPTION
75 
76 #endif
InconsistencyException(InconsistencyException &&that)
InconsistencyException & operator=(InconsistencyException &&that)
wxString ErrorMessage() const override
MessageBoxException & operator=(MessageBoxException &&)
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
an AudacityException that pops up a single message box even if there were multiple exceptions of the ...