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

◆ PTR

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

Definition at line 319 of file lib_manager.h.

◆ WEAK_PTR

Definition at line 320 of file lib_manager.h.

Constructor & Destructor Documentation

◆ PART_BUFFER()

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

Definition at line 713 of file lib_manager.cpp.

714  : m_screen( std::move( aScreen ) ), m_part( aPart )
715 {
716  m_original = new LIB_PART( *aPart );
717 }
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

References m_original.

◆ ~PART_BUFFER()

LIB_MANAGER::PART_BUFFER::~PART_BUFFER ( )

Definition at line 720 of file lib_manager.cpp.

721 {
722  delete m_part;
723  delete m_original;
724 }
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

◆ GetOriginal()

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

Definition at line 300 of file lib_manager.h.

300 { return m_original; }
LIB_PART * m_original
Initial state of the part
Definition: lib_manager.h:329

References m_original.

◆ GetPart()

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

Definition at line 297 of file lib_manager.h.

297 { return m_part; }
LIB_PART * m_part
Working copy
Definition: lib_manager.h:326

References m_part.

◆ GetScreen()

SCH_SCREEN* LIB_MANAGER::PART_BUFFER::GetScreen ( ) const
inline

Definition at line 304 of file lib_manager.h.

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

References m_screen.

◆ IsModified()

bool LIB_MANAGER::PART_BUFFER::IsModified ( ) const

Definition at line 759 of file lib_manager.cpp.

760 {
761  return m_screen && m_screen->IsModify();
762 }
std::unique_ptr< SCH_SCREEN > m_screen
Definition: lib_manager.h:323

◆ RemoveScreen()

std::unique_ptr<SCH_SCREEN> LIB_MANAGER::PART_BUFFER::RemoveScreen ( )
inline

Transfer the screen ownership

Definition at line 307 of file lib_manager.h.

308  {
309  return std::move( m_screen );
310  }
std::unique_ptr< SCH_SCREEN > m_screen
Definition: lib_manager.h:323

References m_screen.

◆ SetOriginal()

void LIB_MANAGER::PART_BUFFER::SetOriginal ( LIB_PART aPart)

Definition at line 743 of file lib_manager.cpp.

744 {
745  wxCHECK( m_original != aPart, /* void */ );
746  wxASSERT( aPart );
747  delete m_original;
748  m_original = aPart;
749 
750  // The original is not allowed to have a different library than its part
752  {
755  }
756 }
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
LIB_PART * m_part
Working copy
Definition: lib_manager.h:326
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
const LIB_ID & GetLibId() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
LIB_PART * m_original
Initial state of the part
Definition: lib_manager.h:329
void SetLibId(const LIB_ID &aLibId)

References LIB_PART::SetLibId().

◆ SetPart()

void LIB_MANAGER::PART_BUFFER::SetPart ( LIB_PART aPart)

Definition at line 727 of file lib_manager.cpp.

728 {
729  wxCHECK( m_part != aPart, /* void */ );
730  wxASSERT( aPart );
731  delete m_part;
732  m_part = aPart;
733 
734  // If the part moves libraries then the original moves with it
736  {
739  }
740 }
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
LIB_PART * m_part
Working copy
Definition: lib_manager.h:326
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
const LIB_ID & GetLibId() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
LIB_PART * m_original
Initial state of the part
Definition: lib_manager.h:329
void SetLibId(const LIB_ID &aLibId)

References LIB_PART::SetLibId().

◆ SetScreen()

bool LIB_MANAGER::PART_BUFFER::SetScreen ( std::unique_ptr< SCH_SCREEN aScreen)
inline

Definition at line 312 of file lib_manager.h.

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

References m_screen.

Member Data Documentation

◆ m_original

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(), and PART_BUFFER().

◆ m_part

LIB_PART* LIB_MANAGER::PART_BUFFER::m_part
private

Working copy

Definition at line 326 of file lib_manager.h.

Referenced by GetPart().

◆ m_screen

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

Definition at line 323 of file lib_manager.h.

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


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