KiCad PCB EDA Suite
LIB_MANAGER::PART_BUFFER Class Reference

Class to store a working copy of a LIB_PART object and editor context.

More...

Public Types

typedef std::shared_ptr< PART_BUFFERPTR
 
typedef std::weak_ptr< PART_BUFFERWEAK_PTR
 

Public Member Functions

 PART_BUFFER (LIB_PART *aPart=nullptr, std::unique_ptr< SCH_SCREEN > aScreen=nullptr)
 
 ~PART_BUFFER ()
 
LIB_PARTGetPart () const
 
void SetPart (LIB_PART *aPart)
 
LIB_PARTGetOriginal () const
 
void SetOriginal (LIB_PART *aPart)
 
bool IsModified () const
 
SCH_SCREENGetScreen () const
 
std::unique_ptr< SCH_SCREENRemoveScreen ()
 

Transfer the screen ownership

More...
 
bool SetScreen (std::unique_ptr< SCH_SCREEN > aScreen)
 

Private Attributes

std::unique_ptr< SCH_SCREENm_screen
 
LIB_PARTm_part
 

Working copy

More...
 
LIB_PARTm_original
 

Initial state of the part

More...
 

Detailed Description

Class to store a working copy of a LIB_PART object and editor context.

Definition at line 291 of file lib_manager.h.

Member Typedef Documentation

typedef std::shared_ptr<PART_BUFFER> LIB_MANAGER::PART_BUFFER::PTR

Definition at line 319 of file lib_manager.h.

Definition at line 320 of file lib_manager.h.

Constructor & Destructor Documentation

LIB_MANAGER::PART_BUFFER::PART_BUFFER ( LIB_PART aPart = nullptr,
std::unique_ptr< SCH_SCREEN aScreen = nullptr 
)

Definition at line 703 of file lib_manager.cpp.

References m_original.

704  : m_screen( std::move( aScreen ) ), m_part( aPart )
705 {
706  m_original = new LIB_PART( *aPart );
707 }
std::unique_ptr< SCH_SCREEN > m_screen
Definition: lib_manager.h:323
LIB_PART * m_part
Working copy
Definition: lib_manager.h:326
Define a library symbol object.
LIB_PART * m_original
Initial state of the part
Definition: lib_manager.h:329
LIB_MANAGER::PART_BUFFER::~PART_BUFFER ( )

Definition at line 710 of file lib_manager.cpp.

References m_original, and m_part.

711 {
712  delete m_part;
713  delete m_original;
714 }
LIB_PART * m_part
Working copy
Definition: lib_manager.h:326
LIB_PART * m_original
Initial state of the part
Definition: lib_manager.h:329

Member Function Documentation

LIB_PART* LIB_MANAGER::PART_BUFFER::GetOriginal ( ) const
inline

Definition at line 300 of file lib_manager.h.

References IsModified(), m_original, and SetOriginal().

300 { return m_original; }
LIB_PART * m_original
Initial state of the part
Definition: lib_manager.h:329
LIB_PART* LIB_MANAGER::PART_BUFFER::GetPart ( ) const
inline

Definition at line 297 of file lib_manager.h.

References m_part, and SetPart().

297 { return m_part; }
LIB_PART * m_part
Working copy
Definition: lib_manager.h:326
SCH_SCREEN* LIB_MANAGER::PART_BUFFER::GetScreen ( ) const
inline

Definition at line 304 of file lib_manager.h.

References m_screen.

304 { return m_screen.get(); }
std::unique_ptr< SCH_SCREEN > m_screen
Definition: lib_manager.h:323
bool LIB_MANAGER::PART_BUFFER::IsModified ( ) const

Definition at line 735 of file lib_manager.cpp.

References m_screen.

Referenced by GetOriginal().

736 {
737  return m_screen && m_screen->IsModify();
738 }
std::unique_ptr< SCH_SCREEN > m_screen
Definition: lib_manager.h:323
std::unique_ptr<SCH_SCREEN> LIB_MANAGER::PART_BUFFER::RemoveScreen ( )
inline

Transfer the screen ownership

Definition at line 307 of file lib_manager.h.

References m_screen.

308  {
309  return std::move( m_screen );
310  }
std::unique_ptr< SCH_SCREEN > m_screen
Definition: lib_manager.h:323
void LIB_MANAGER::PART_BUFFER::SetOriginal ( LIB_PART aPart)

Definition at line 726 of file lib_manager.cpp.

References m_original.

Referenced by GetOriginal().

727 {
728  wxCHECK( m_original != aPart, /* void */ );
729  wxASSERT( aPart );
730  delete m_original;
731  m_original = aPart;
732 }
LIB_PART * m_original
Initial state of the part
Definition: lib_manager.h:329
void LIB_MANAGER::PART_BUFFER::SetPart ( LIB_PART aPart)

Definition at line 717 of file lib_manager.cpp.

References m_part.

Referenced by GetPart().

718 {
719  wxCHECK( m_part != aPart, /* void */ );
720  wxASSERT( aPart );
721  delete m_part;
722  m_part = aPart;
723 }
LIB_PART * m_part
Working copy
Definition: lib_manager.h:326
bool LIB_MANAGER::PART_BUFFER::SetScreen ( std::unique_ptr< SCH_SCREEN aScreen)
inline

Definition at line 312 of file lib_manager.h.

References m_screen.

313  {
314  bool ret = !!m_screen;
315  m_screen = std::move( aScreen );
316  return ret;
317  }
std::unique_ptr< SCH_SCREEN > m_screen
Definition: lib_manager.h:323

Member Data Documentation

LIB_PART* LIB_MANAGER::PART_BUFFER::m_original
private

Initial state of the part

Definition at line 329 of file lib_manager.h.

Referenced by GetOriginal(), PART_BUFFER(), SetOriginal(), and ~PART_BUFFER().

LIB_PART* LIB_MANAGER::PART_BUFFER::m_part
private

Working copy

Definition at line 326 of file lib_manager.h.

Referenced by GetPart(), SetPart(), and ~PART_BUFFER().

std::unique_ptr<SCH_SCREEN> LIB_MANAGER::PART_BUFFER::m_screen
private

Definition at line 323 of file lib_manager.h.

Referenced by GetScreen(), IsModified(), RemoveScreen(), and SetScreen().


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