Audacity 3.2.0
Classes | Macros | Functions | Variables
ProjectFileIO.cpp File Reference
#include "ProjectFileIO.h"
#include <atomic>
#include <sqlite3.h>
#include <optional>
#include <cstring>
#include <wx/app.h>
#include <wx/crt.h>
#include <wx/frame.h>
#include <wx/log.h>
#include <wx/sstream.h>
#include "ActiveProjects.h"
#include "CodeConversions.h"
#include "DBConnection.h"
#include "Project.h"
#include "ProjectHistory.h"
#include "ProjectSerializer.h"
#include "ProjectWindows.h"
#include "SampleBlock.h"
#include "TempDirectory.h"
#include "TransactionScope.h"
#include "WaveTrack.h"
#include "widgets/AudacityMessageBox.h"
#include "BasicUI.h"
#include "widgets/ProgressDialog.h"
#include "wxFileNameWrapper.h"
#include "XMLFileReader.h"
#include "SentryHelper.h"
#include "MemoryX.h"
#include "ProjectFormatExtensionsRegistry.h"
#include "BufferedStreamReader.h"
#include "FromChars.h"
Include dependency graph for ProjectFileIO.cpp:

Go to the source code of this file.

Classes

class  SQLiteIniter
 
class  SQLiteBlobStream
 
class  BufferedProjectBlobStream
 

Macros

#define AUDACITY_FILE_FORMAT_VERSION   "1.3.0"
 
#define PACK(b1, b2, b3, b4)   ((b1 << 24) | (b2 << 16) | (b3 << 8) | b4)
 

Functions

 wxDEFINE_EVENT (EVT_PROJECT_TITLE_CHANGE, wxCommandEvent)
 
 wxDEFINE_EVENT (EVT_CHECKPOINT_FAILURE, wxCommandEvent)
 
 wxDEFINE_EVENT (EVT_RECONNECTION_FAILURE, wxCommandEvent)
 
static void RefreshAllTitles (bool bShowProjectNumbers)
 
static int ExecCallback (void *data, int cols, char **vals, char **names)
 

Variables

static const int ProjectFileID = PACK('A', 'U', 'D', 'Y')
 
static const char * ProjectFileSchema
 
static const AudacityProject::AttachedObjects::RegisteredFactory sFileIOKey
 
static ProjectHistory::AutoSave::Scope scope
 Install the callback from undo manager. More...
 

Macro Definition Documentation

◆ AUDACITY_FILE_FORMAT_VERSION

#define AUDACITY_FILE_FORMAT_VERSION   "1.3.0"

Definition at line 50 of file ProjectFileIO.cpp.

◆ PACK

#define PACK (   b1,
  b2,
  b3,
  b4 
)    ((b1 << 24) | (b2 << 16) | (b3 << 8) | b4)

Definition at line 66 of file ProjectFileIO.cpp.

Function Documentation

◆ ExecCallback()

static int ExecCallback ( void *  data,
int  cols,
char **  vals,
char **  names 
)
static

Definition at line 726 of file ProjectFileIO.cpp.

727{
728 auto &cb = *static_cast<const ProjectFileIO::ExecCB *>(data);
729 // Be careful not to throw anything across sqlite3's stack frames.
730 return GuardedCall<int>(
731 [&]{ return cb(cols, vals, names); },
732 MakeSimpleGuard( 1 )
733 );
734}
SimpleGuard< R > MakeSimpleGuard(R value) noexcept(noexcept(SimpleGuard< R >{ value }))
Convert a value to a handler function returning that value, suitable for GuardedCall<R>
static TranslatableStrings names
Definition: TagsEditor.cpp:151
std::function< int(int cols, char **vals, char **names)> ExecCB

References MakeSimpleGuard(), and names.

Referenced by ProjectFileIO::Exec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RefreshAllTitles()

static void RefreshAllTitles ( bool  bShowProjectNumbers)
static

Definition at line 432 of file ProjectFileIO.cpp.

433{
434 for ( auto pProject : AllProjects{} ) {
435 if ( !GetProjectFrame( *pProject ).IsIconized() ) {
437 bShowProjectNumbers ? pProject->GetProjectNumber() : -1 );
438 }
439 }
440}
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...
void SetProjectTitle(int number=-1)
static ProjectFileIO & Get(AudacityProject &project)

References ProjectFileIO::Get(), GetProjectFrame(), and ProjectFileIO::SetProjectTitle().

Referenced by TitleRestorer::TitleRestorer(), and TitleRestorer::~TitleRestorer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wxDEFINE_EVENT() [1/3]

wxDEFINE_EVENT ( EVT_CHECKPOINT_FAILURE  ,
wxCommandEvent   
)

◆ wxDEFINE_EVENT() [2/3]

wxDEFINE_EVENT ( EVT_PROJECT_TITLE_CHANGE  ,
wxCommandEvent   
)

◆ wxDEFINE_EVENT() [3/3]

wxDEFINE_EVENT ( EVT_RECONNECTION_FAILURE  ,
wxCommandEvent   
)

Variable Documentation

◆ ProjectFileID

const int ProjectFileID = PACK('A', 'U', 'D', 'Y')
static

Definition at line 71 of file ProjectFileIO.cpp.

Referenced by ProjectFileIO::CheckVersion(), and ProjectFileIO::InstallSchema().

◆ ProjectFileSchema

const char* ProjectFileSchema
static

Definition at line 97 of file ProjectFileIO.cpp.

Referenced by ProjectFileIO::InstallSchema().

◆ scope

ProjectHistory::AutoSave::Scope scope
static
Initial value:
{
[](AudacityProject &project) {
auto &projectFileIO = ProjectFileIO::Get(project);
if ( !projectFileIO.AutoSave() )
XO("Automatic database backup failed."),
XO("Warning"),
"Error:_Disk_full_or_not_writable"
};
} }
@ Internal
Indicates internal failure from Audacity.
#define XO(s)
Definition: Internat.h:31
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
A MessageBoxException that shows a given, unvarying string.

Install the callback from undo manager.

Definition at line 2707 of file ProjectFileIO.cpp.

◆ sFileIOKey

Initial value:
{
[]( AudacityProject &parent ){
auto result = std::make_shared< ProjectFileIO >( parent );
return result;
}
}

Definition at line 474 of file ProjectFileIO.cpp.

Referenced by ProjectFileIO::Get().