|
KiCad PCB EDA Suite
|
Move-only RAII wrapper for "load a foreign PROJECT non-active and unload it on scope exit. More...
#include <scratch_doc.h>
Public Member Functions | |
| SCRATCH_PROJECT ()=default | |
| SCRATCH_PROJECT (SETTINGS_MANAGER &aMgr, const wxString &aDocOrProjectPath, bool aRequireProjectFile=false) | |
| ~SCRATCH_PROJECT () | |
| SCRATCH_PROJECT (const SCRATCH_PROJECT &)=delete | |
| SCRATCH_PROJECT & | operator= (const SCRATCH_PROJECT &)=delete |
| SCRATCH_PROJECT (SCRATCH_PROJECT &&aOther) noexcept | |
| SCRATCH_PROJECT & | operator= (SCRATCH_PROJECT &&aOther) noexcept |
| PROJECT * | GetProject () const |
| bool | IsValid () const |
| True iff the project loaded (or was already loaded). | |
Private Member Functions | |
| void | release () |
Private Attributes | |
| SETTINGS_MANAGER * | m_mgr = nullptr |
| PROJECT * | m_project = nullptr |
| bool | m_owned = false |
Move-only RAII wrapper for "load a foreign PROJECT non-active and unload it on scope exit.
" Project-only counterpart to SCRATCH_DOC (which adds a dependent document); use when only the project's settings are needed.
The aRequireProjectFile flag splits two real use cases. The diff/merge JOB handlers load from temp blobs that often have no sibling .kicad_pro, so they pass false and accept a SETTINGS_MANAGER defaults-only slot. The Import-Settings dialogs pass true because a missing .kicad_pro means there's no meaningful settings source to import from.
If the project was already loaded in the SETTINGS_MANAGER before the wrapper was constructed, the destructor leaves it alone so the slot belongs to whoever opened it first.
Definition at line 54 of file scratch_doc.h.
|
default |
Referenced by operator=(), operator=(), SCRATCH_PROJECT(), and SCRATCH_PROJECT().
|
inline |
Definition at line 59 of file scratch_doc.h.
References SETTINGS_MANAGER::GetProject(), SETTINGS_MANAGER::LoadProject(), m_mgr, m_owned, m_project, FILEEXT::ProjectFileExtension, and release().
|
inline |
Definition at line 102 of file scratch_doc.h.
References release().
|
delete |
References SCRATCH_PROJECT().
|
inlinenoexcept |
Definition at line 107 of file scratch_doc.h.
References SCRATCH_PROJECT().
|
inline |
Definition at line 123 of file scratch_doc.h.
References m_project.
Referenced by DIALOG_BOARD_SETUP::onAuxiliaryAction(), and DIALOG_SCHEMATIC_SETUP::onAuxiliaryAction().
|
inline |
True iff the project loaded (or was already loaded).
False on parse failure or, when require-file was set, on missing .kicad_pro.
Definition at line 127 of file scratch_doc.h.
References m_project.
Referenced by DIALOG_BOARD_SETUP::onAuxiliaryAction(), and DIALOG_SCHEMATIC_SETUP::onAuxiliaryAction().
|
delete |
References SCRATCH_PROJECT().
|
inlinenoexcept |
Definition at line 109 of file scratch_doc.h.
References m_mgr, m_owned, m_project, release(), and SCRATCH_PROJECT().
|
inlineprivate |
Definition at line 130 of file scratch_doc.h.
References m_mgr, m_owned, and m_project.
Referenced by operator=(), SCRATCH_PROJECT(), and ~SCRATCH_PROJECT().
|
private |
Definition at line 138 of file scratch_doc.h.
Referenced by operator=(), release(), and SCRATCH_PROJECT().
|
private |
Definition at line 140 of file scratch_doc.h.
Referenced by operator=(), release(), and SCRATCH_PROJECT().
|
private |
Definition at line 139 of file scratch_doc.h.
Referenced by GetProject(), IsValid(), operator=(), release(), and SCRATCH_PROJECT().