mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-01 08:29:27 +02:00
New library lib-exceptions
This commit is contained in:
parent
e6c109b2cd
commit
0683d3c158
@ -9,6 +9,7 @@ set( LIBRARIES
|
|||||||
lib-uuid
|
lib-uuid
|
||||||
lib-components
|
lib-components
|
||||||
lib-basic-ui
|
lib-basic-ui
|
||||||
|
lib-exceptions
|
||||||
)
|
)
|
||||||
|
|
||||||
if ( ${_OPT}has_networking )
|
if ( ${_OPT}has_networking )
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "AudacityException.h"
|
#include "AudacityException.h"
|
||||||
|
|
||||||
#include <wx/atomic.h>
|
#include <wx/atomic.h>
|
@ -38,7 +38,7 @@ public:
|
|||||||
//! Action to do in the main thread at idle time of the event loop.
|
//! Action to do in the main thread at idle time of the event loop.
|
||||||
virtual void DelayedHandlerAction() = 0;
|
virtual void DelayedHandlerAction() = 0;
|
||||||
|
|
||||||
AUDACITY_DLL_API static void EnqueueAction(
|
EXCEPTIONS_API static void EnqueueAction(
|
||||||
std::exception_ptr pException,
|
std::exception_ptr pException,
|
||||||
std::function<void(AudacityException*)> delayedHandler);
|
std::function<void(AudacityException*)> delayedHandler);
|
||||||
|
|
||||||
@ -48,16 +48,16 @@ protected:
|
|||||||
|
|
||||||
//! Don't allow moves of this class or subclasses
|
//! Don't allow moves of this class or subclasses
|
||||||
// see https://bugzilla.audacityteam.org/show_bug.cgi?id=2442
|
// see https://bugzilla.audacityteam.org/show_bug.cgi?id=2442
|
||||||
AudacityException( AudacityException&& ) = delete;
|
AudacityException( AudacityException&& ) PROHIBITED;
|
||||||
|
|
||||||
//! Disallow assignment
|
//! Disallow assignment
|
||||||
AudacityException &operator = ( const AudacityException & ) = delete;
|
AudacityException &operator = ( const AudacityException & ) PROHIBITED;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Abstract AudacityException subclass displays a message, specified by further subclass
|
//! Abstract AudacityException subclass displays a message, specified by further subclass
|
||||||
/*! At most one message will be displayed for each pass through the main event idle loop,
|
/*! At most one message will be displayed for each pass through the main event idle loop,
|
||||||
no matter how many exceptions were caught. */
|
no matter how many exceptions were caught. */
|
||||||
class AUDACITY_DLL_API MessageBoxException /* not final */
|
class EXCEPTIONS_API MessageBoxException /* not final */
|
||||||
: public AudacityException
|
: public AudacityException
|
||||||
{
|
{
|
||||||
//! Privatize the inherited function
|
//! Privatize the inherited function
|
||||||
@ -90,7 +90,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! A MessageBoxException that shows a given, unvarying string.
|
//! A MessageBoxException that shows a given, unvarying string.
|
||||||
class AUDACITY_DLL_API SimpleMessageBoxException /* not final */
|
class EXCEPTIONS_API SimpleMessageBoxException /* not final */
|
||||||
: public MessageBoxException
|
: public MessageBoxException
|
||||||
{
|
{
|
||||||
public:
|
public:
|
34
libraries/lib-exceptions/CMakeLists.txt
Normal file
34
libraries/lib-exceptions/CMakeLists.txt
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#[[
|
||||||
|
Toolkit neutral library for exceptions.
|
||||||
|
|
||||||
|
Abstract class AudacityException with a member function for a delayed
|
||||||
|
handler action, enqueued in the main thread;
|
||||||
|
|
||||||
|
Some commonly useful subclasses, with delayed handlers that are no-ops or
|
||||||
|
are displays of messages to the user;
|
||||||
|
|
||||||
|
Function template GuardedCall which stops propagation of exceptions and
|
||||||
|
enqueues the delayed action.
|
||||||
|
|
||||||
|
But this library does NOT define a top-level handler for the whole application,
|
||||||
|
to catch all otherwise uncaught exceptions. That is a responsibility of high
|
||||||
|
level code.
|
||||||
|
]]#
|
||||||
|
|
||||||
|
list( APPEND SOURCES
|
||||||
|
AudacityException.cpp
|
||||||
|
AudacityException.h
|
||||||
|
InconsistencyException.cpp
|
||||||
|
InconsistencyException.h
|
||||||
|
UserException.cpp
|
||||||
|
UserException.h
|
||||||
|
)
|
||||||
|
set( LIBRARIES
|
||||||
|
lib-utility-interface
|
||||||
|
lib-basic-ui-interface
|
||||||
|
PRIVATE
|
||||||
|
wxBase
|
||||||
|
)
|
||||||
|
audacity_library( lib-exceptions "${SOURCES}" "${LIBRARIES}"
|
||||||
|
"" ""
|
||||||
|
)
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "InconsistencyException.h"
|
#include "InconsistencyException.h"
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
|
|
@ -20,7 +20,7 @@
|
|||||||
The error message identifies source file and line number, possibly the function too (depending on
|
The error message identifies source file and line number, possibly the function too (depending on
|
||||||
the compiler), and suggests that the user inform the development team.
|
the compiler), and suggests that the user inform the development team.
|
||||||
*/
|
*/
|
||||||
class AUDACITY_DLL_API InconsistencyException final : public MessageBoxException
|
class EXCEPTIONS_API InconsistencyException final : public MessageBoxException
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InconsistencyException ()
|
InconsistencyException ()
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "UserException.h"
|
#include "UserException.h"
|
||||||
|
|
||||||
UserException::~UserException()
|
UserException::~UserException()
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
//! Can be thrown when user cancels operations, as with a progress dialog. Delayed handler does nothing
|
//! Can be thrown when user cancels operations, as with a progress dialog. Delayed handler does nothing
|
||||||
/*! This class does not inherit from MessageBoxException. */
|
/*! This class does not inherit from MessageBoxException. */
|
||||||
class AUDACITY_DLL_API UserException final : public AudacityException
|
class EXCEPTIONS_API UserException final : public AudacityException
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
UserException() {}
|
UserException() {}
|
@ -88,8 +88,6 @@ list( APPEND SOURCES
|
|||||||
AudacityApp.cpp
|
AudacityApp.cpp
|
||||||
AudacityApp.h
|
AudacityApp.h
|
||||||
$<$<BOOL:${wxIS_MAC}>:AudacityApp.mm>
|
$<$<BOOL:${wxIS_MAC}>:AudacityApp.mm>
|
||||||
AudacityException.cpp
|
|
||||||
AudacityException.h
|
|
||||||
AudacityFileConfig.cpp
|
AudacityFileConfig.cpp
|
||||||
AudacityFileConfig.h
|
AudacityFileConfig.h
|
||||||
AudacityHeaders.cpp
|
AudacityHeaders.cpp
|
||||||
@ -159,8 +157,6 @@ list( APPEND SOURCES
|
|||||||
HitTestResult.h
|
HitTestResult.h
|
||||||
ImageManipulation.cpp
|
ImageManipulation.cpp
|
||||||
ImageManipulation.h
|
ImageManipulation.h
|
||||||
InconsistencyException.cpp
|
|
||||||
InconsistencyException.h
|
|
||||||
InterpolateAudio.cpp
|
InterpolateAudio.cpp
|
||||||
InterpolateAudio.h
|
InterpolateAudio.h
|
||||||
KeyboardCapture.cpp
|
KeyboardCapture.cpp
|
||||||
@ -325,8 +321,6 @@ list( APPEND SOURCES
|
|||||||
UIHandle.h
|
UIHandle.h
|
||||||
UndoManager.cpp
|
UndoManager.cpp
|
||||||
UndoManager.h
|
UndoManager.h
|
||||||
UserException.cpp
|
|
||||||
UserException.h
|
|
||||||
ViewInfo.cpp
|
ViewInfo.cpp
|
||||||
ViewInfo.h
|
ViewInfo.h
|
||||||
VoiceKey.cpp
|
VoiceKey.cpp
|
||||||
|
@ -89,7 +89,7 @@ classes derived from it.
|
|||||||
|
|
||||||
#include "CommandContext.h"
|
#include "CommandContext.h"
|
||||||
|
|
||||||
#include "../AudacityException.h"
|
#include "AudacityException.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ and sample size to help you importing data of an unknown format.
|
|||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
#include "../ProjectSettings.h"
|
#include "../ProjectSettings.h"
|
||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
#include "../UserException.h"
|
#include "UserException.h"
|
||||||
#include "../WaveTrack.h"
|
#include "../WaveTrack.h"
|
||||||
#include "../widgets/ProgressDialog.h"
|
#include "../widgets/ProgressDialog.h"
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include "RawAudioGuess.h"
|
#include "RawAudioGuess.h"
|
||||||
|
|
||||||
#include "../AudacityException.h"
|
#include "AudacityException.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user