mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-26 07:13:49 +01:00
Define an AudacityException subclass for unready on-demand data
This commit is contained in:
28
src/blockfile/NotYetAvailableException.cpp
Normal file
28
src/blockfile/NotYetAvailableException.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// NotYetAvailableException.cpp
|
||||
//
|
||||
//
|
||||
// Created by Paul Licameli on 12/25/16.
|
||||
//
|
||||
//
|
||||
|
||||
#include "../Audacity.h"
|
||||
#include "NotYetAvailableException.h"
|
||||
|
||||
NotYetAvailableException::~NotYetAvailableException()
|
||||
{
|
||||
}
|
||||
|
||||
std::unique_ptr< AudacityException > NotYetAvailableException::Move()
|
||||
{
|
||||
return std::unique_ptr< AudacityException >
|
||||
{ safenew NotYetAvailableException{ std::move( *this ) } };
|
||||
}
|
||||
|
||||
wxString NotYetAvailableException::ErrorMessage() const
|
||||
{
|
||||
return wxString::Format(
|
||||
_("This operation cannot be done until importation of %s completes."),
|
||||
mFileName.GetFullName()
|
||||
);
|
||||
}
|
||||
34
src/blockfile/NotYetAvailableException.h
Normal file
34
src/blockfile/NotYetAvailableException.h
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// NotYetAvailableException.h
|
||||
//
|
||||
//
|
||||
// Created by Paul Licameli on 12/25/16.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef __AUDACITY_NOT_YET_AVAILABLE_EXCEPTION__
|
||||
#define __AUDACITY_NOT_YET_AVAILABLE_EXCEPTION__
|
||||
|
||||
#include "../FileException.h"
|
||||
#include <wx/filename.h>
|
||||
|
||||
// This exception can be thrown when attempting read of on-demand block files
|
||||
// that have not yet completed loading.
|
||||
class NotYetAvailableException final : public FileException
|
||||
{
|
||||
public:
|
||||
NotYetAvailableException( const wxFileName &fileName )
|
||||
: FileException{ Cause::Read, fileName } {}
|
||||
NotYetAvailableException(NotYetAvailableException &&that)
|
||||
: FileException( std::move( that ) ) {}
|
||||
~NotYetAvailableException();
|
||||
|
||||
protected:
|
||||
std::unique_ptr< AudacityException > Move() override;
|
||||
wxString ErrorMessage() const override;
|
||||
|
||||
private:
|
||||
wxFileName mFileName;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user