KiCad PCB EDA Suite
Loading...
Searching...
No Matches
DOWNGRADE_FILE_TRANSACTION Class Reference

Stage related design and library files together, retaining originals until every write is ready. More...

#include <downgrade_scan.h>

Classes

struct  ENTRY
 

Public Member Functions

 DOWNGRADE_FILE_TRANSACTION ()=default
 
 DOWNGRADE_FILE_TRANSACTION (const DOWNGRADE_FILE_TRANSACTION &)=delete
 
DOWNGRADE_FILE_TRANSACTION & operator= (const DOWNGRADE_FILE_TRANSACTION &)=delete
 
 ~DOWNGRADE_FILE_TRANSACTION ()
 
wxString Stage (const wxString &aDestination)
 Return an exclusively-created sibling staging file, or empty if it cannot be created.
 
void Discard (const wxString &aTemporary)
 Forget a skipped conversion without exposing its empty staging file as an output.
 
wxString Commit ()
 Replace all destinations, rolling back earlier replacements if a rename fails.
 
const wxString & GetRecoveryError () const
 Recovery details are nonempty only if restoring an original or removing a new output failed.
 

Private Member Functions

void rollback ()
 

Static Private Member Functions

static void removeOwnedFile (const wxString &aPath)
 
static bool ownedFileExists (const wxString &aPath)
 
static std::filesystem::path nativePath (const wxString &aPath)
 

Private Attributes

std::vector< ENTRY > m_entries
 
bool m_finished = false
 
wxString m_recoveryError
 

Detailed Description

Stage related design and library files together, retaining originals until every write is ready.

Definition at line 248 of file downgrade_scan.h.

Constructor & Destructor Documentation

◆ DOWNGRADE_FILE_TRANSACTION() [1/2]

DOWNGRADE_FILE_TRANSACTION::DOWNGRADE_FILE_TRANSACTION ( )
default

◆ DOWNGRADE_FILE_TRANSACTION() [2/2]

DOWNGRADE_FILE_TRANSACTION::DOWNGRADE_FILE_TRANSACTION ( const DOWNGRADE_FILE_TRANSACTION & )
delete

◆ ~DOWNGRADE_FILE_TRANSACTION()

DOWNGRADE_FILE_TRANSACTION::~DOWNGRADE_FILE_TRANSACTION ( )
inline

Definition at line 255 of file downgrade_scan.h.

References m_entries, and removeOwnedFile().

Member Function Documentation

◆ Commit()

wxString DOWNGRADE_FILE_TRANSACTION::Commit ( )
inline

Replace all destinations, rolling back earlier replacements if a rename fails.

Returns the failed destination, or empty after a successful commit.

Definition at line 311 of file downgrade_scan.h.

References m_entries, m_finished, nativePath(), and rollback().

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), DowngradeLibraryFilesInPlace(), EESCHEMA_JOBS_HANDLER::JobDowngrade(), and PCBNEW_JOBS_HANDLER::JobDowngrade().

◆ Discard()

void DOWNGRADE_FILE_TRANSACTION::Discard ( const wxString & aTemporary)
inline

Forget a skipped conversion without exposing its empty staging file as an output.

Definition at line 296 of file downgrade_scan.h.

References m_entries, and removeOwnedFile().

Referenced by BOOST_AUTO_TEST_CASE(), and DowngradeLibraryFilesInPlace().

◆ GetRecoveryError()

const wxString & DOWNGRADE_FILE_TRANSACTION::GetRecoveryError ( ) const
inline

Recovery details are nonempty only if restoring an original or removing a new output failed.

Definition at line 393 of file downgrade_scan.h.

References m_recoveryError.

Referenced by BOOST_AUTO_TEST_CASE(), DowngradeLibraryFilesInPlace(), EESCHEMA_JOBS_HANDLER::JobDowngrade(), and PCBNEW_JOBS_HANDLER::JobDowngrade().

◆ nativePath()

static std::filesystem::path DOWNGRADE_FILE_TRANSACTION::nativePath ( const wxString & aPath)
inlinestaticprivate

Definition at line 421 of file downgrade_scan.h.

Referenced by Commit(), and ownedFileExists().

◆ operator=()

DOWNGRADE_FILE_TRANSACTION & DOWNGRADE_FILE_TRANSACTION::operator= ( const DOWNGRADE_FILE_TRANSACTION & )
delete

◆ ownedFileExists()

static bool DOWNGRADE_FILE_TRANSACTION::ownedFileExists ( const wxString & aPath)
inlinestaticprivate

Definition at line 412 of file downgrade_scan.h.

References nativePath().

Referenced by removeOwnedFile(), and rollback().

◆ removeOwnedFile()

static void DOWNGRADE_FILE_TRANSACTION::removeOwnedFile ( const wxString & aPath)
inlinestaticprivate

Definition at line 406 of file downgrade_scan.h.

References ownedFileExists().

Referenced by Discard(), and ~DOWNGRADE_FILE_TRANSACTION().

◆ rollback()

◆ Stage()

wxString DOWNGRADE_FILE_TRANSACTION::Stage ( const wxString & aDestination)
inline

Member Data Documentation

◆ m_entries

std::vector<ENTRY> DOWNGRADE_FILE_TRANSACTION::m_entries
private

Definition at line 462 of file downgrade_scan.h.

Referenced by Commit(), Discard(), rollback(), Stage(), and ~DOWNGRADE_FILE_TRANSACTION().

◆ m_finished

bool DOWNGRADE_FILE_TRANSACTION::m_finished = false
private

Definition at line 463 of file downgrade_scan.h.

Referenced by Commit(), and Stage().

◆ m_recoveryError

wxString DOWNGRADE_FILE_TRANSACTION::m_recoveryError
private

Definition at line 464 of file downgrade_scan.h.

Referenced by GetRecoveryError(), and rollback().


The documentation for this class was generated from the following file: