|
KiCad PCB EDA Suite
|
Move-only RAII wrapper for "load a KiCad document into a non-active scratch PROJECT and clean up after. More...
#include <scratch_doc.h>
Public Types | |
| using | CLEAR_FN = std::function<void( DOC* )> |
Public Member Functions | |
| SCRATCH_DOC ()=default | |
| SCRATCH_DOC (const SCRATCH_DOC &)=delete | |
| SCRATCH_DOC & | operator= (const SCRATCH_DOC &)=delete |
| SCRATCH_DOC (SCRATCH_DOC &&aOther) noexcept | |
| SCRATCH_DOC & | operator= (SCRATCH_DOC &&aOther) noexcept |
| ~SCRATCH_DOC () | |
Public Attributes | |
| SETTINGS_MANAGER * | mgr = nullptr |
| std::unique_ptr< DOC > | doc |
| PROJECT * | project = nullptr |
| CLEAR_FN | clearProject |
| bool | ownsProject = false |
| True when this load created the project (LoadScratchDoc found the path not yet in the SettingsManager). | |
Private Member Functions | |
| void | release () |
Move-only RAII wrapper for "load a KiCad document into a non-active scratch PROJECT and clean up after.
" Pattern used by the diff/merge JOB handlers so they can load ancestor/ours/theirs documents without disturbing the active editor's project settings.
The destructor sequences cleanup in the only safe order:
Construct via the factory LoadScratchDoc() so the call site doesn't have to spell the LoadProject/GetProject dance.
Definition at line 164 of file scratch_doc.h.
| using SCRATCH_DOC< DOC >::CLEAR_FN = std::function<void( DOC* )> |
Definition at line 166 of file scratch_doc.h.
|
default |
Referenced by operator=(), operator=(), SCRATCH_DOC(), and SCRATCH_DOC().
|
delete |
References SCRATCH_DOC().
|
inlinenoexcept |
Definition at line 186 of file scratch_doc.h.
References SCRATCH_DOC().
|
inline |
Definition at line 204 of file scratch_doc.h.
References release().
|
delete |
References SCRATCH_DOC().
|
inlinenoexcept |
Definition at line 188 of file scratch_doc.h.
References clearProject, doc, mgr, ownsProject, project, release(), and SCRATCH_DOC().
|
inlineprivate |
Definition at line 207 of file scratch_doc.h.
References clearProject, doc, mgr, ownsProject, and project.
Referenced by operator=(), and ~SCRATCH_DOC().
| CLEAR_FN SCRATCH_DOC< DOC >::clearProject |
Definition at line 171 of file scratch_doc.h.
Referenced by LoadScratchDoc(), operator=(), and release().
| std::unique_ptr<DOC> SCRATCH_DOC< DOC >::doc |
Definition at line 169 of file scratch_doc.h.
Referenced by PCBNEW_JOBS_HANDLER::JobDiff(), EESCHEMA_JOBS_HANDLER::JobSchDiff(), LoadScratchDoc(), EESCHEMA_JOBS_HANDLER::OpenDiffDialog(), PCBNEW_JOBS_HANDLER::OpenDiffDialog(), operator=(), release(), PCBNEW_JOBS_HANDLER::runPcbMerge(), and EESCHEMA_JOBS_HANDLER::runSchMerge().
| SETTINGS_MANAGER* SCRATCH_DOC< DOC >::mgr = nullptr |
Definition at line 168 of file scratch_doc.h.
Referenced by LoadScratchDoc(), operator=(), and release().
| bool SCRATCH_DOC< DOC >::ownsProject = false |
True when this load created the project (LoadScratchDoc found the path not yet in the SettingsManager).
False when the project was already loaded by a previous call (e.g. ancestor and ours share a path, or the caller is diffing against the active editor's project). Only owners unload — otherwise two SCRATCH_DOCs holding the same PROJECT* would double-unload it and the second would dangle.
Definition at line 179 of file scratch_doc.h.
Referenced by LoadScratchDoc(), operator=(), and release().
| PROJECT* SCRATCH_DOC< DOC >::project = nullptr |
Definition at line 170 of file scratch_doc.h.
Referenced by LoadScratchDoc(), operator=(), release(), and EESCHEMA_JOBS_HANDLER::runSchMerge().