KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KICAD_DIFF::SHEET_SCOPE Class Reference

RAII guard that temporarily swaps SCHEMATIC::CurrentSheet to a given path for the duration of a scope, restoring it on exit. More...

#include <sch_diff_utils.h>

Public Member Functions

 SHEET_SCOPE (const SCHEMATIC *aSch, const SCH_SHEET_PATH *aPath)
 
 ~SHEET_SCOPE ()
 
 SHEET_SCOPE (const SHEET_SCOPE &)=delete
 
SHEET_SCOPEoperator= (const SHEET_SCOPE &)=delete
 

Private Attributes

const SCHEMATICm_sch
 
SCH_SHEET_PATH m_saved
 

Detailed Description

RAII guard that temporarily swaps SCHEMATIC::CurrentSheet to a given path for the duration of a scope, restoring it on exit.

SCH_SYMBOL / SCH_FIELD property and bounding-box getters look up the active instance through SCHEMATIC::CurrentSheet(); the differ and the geometry extractor both need that to point at the item's own sheet path while they read it. SCHEMATIC::CurrentSheet() returns a non-const reference even off a const SCHEMATIC*, so no const_cast on the schematic itself is needed.

A null aPath leaves CurrentSheet untouched (only the original value is saved and restored), matching the differ's nullable-path call sites.

Definition at line 46 of file sch_diff_utils.h.

Constructor & Destructor Documentation

◆ SHEET_SCOPE() [1/2]

KICAD_DIFF::SHEET_SCOPE::SHEET_SCOPE ( const SCHEMATIC * aSch,
const SCH_SHEET_PATH * aPath )
inline

Definition at line 49 of file sch_diff_utils.h.

References m_saved, and m_sch.

Referenced by operator=(), and SHEET_SCOPE().

◆ ~SHEET_SCOPE()

KICAD_DIFF::SHEET_SCOPE::~SHEET_SCOPE ( )
inline

Definition at line 57 of file sch_diff_utils.h.

References m_saved, and m_sch.

◆ SHEET_SCOPE() [2/2]

KICAD_DIFF::SHEET_SCOPE::SHEET_SCOPE ( const SHEET_SCOPE & )
delete

References SHEET_SCOPE().

Member Function Documentation

◆ operator=()

SHEET_SCOPE & KICAD_DIFF::SHEET_SCOPE::operator= ( const SHEET_SCOPE & )
delete

References SHEET_SCOPE().

Member Data Documentation

◆ m_saved

SCH_SHEET_PATH KICAD_DIFF::SHEET_SCOPE::m_saved
private

Definition at line 68 of file sch_diff_utils.h.

Referenced by SHEET_SCOPE(), and ~SHEET_SCOPE().

◆ m_sch

const SCHEMATIC* KICAD_DIFF::SHEET_SCOPE::m_sch
private

Definition at line 67 of file sch_diff_utils.h.

Referenced by SHEET_SCOPE(), and ~SHEET_SCOPE().


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