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
 
LIB_PARTm_original
 

Detailed Description

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

Definition at line 302 of file lib_manager.h.

Member Typedef Documentation

◆ PTR

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

Definition at line 330 of file lib_manager.h.

◆ WEAK_PTR

Definition at line 331 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 654 of file lib_manager.cpp.

654  :
655  m_screen( std::move( aScreen ) ),
656  m_part( aPart )
657 {
658  m_original = new LIB_PART( *aPart );
659 }
std::unique_ptr< SCH_SCREEN > m_screen
Definition: lib_manager.h:334
Define a library symbol object.

References LIB_PART::LIB_PART(), and m_original.

◆ ~PART_BUFFER()

LIB_MANAGER::PART_BUFFER::~PART_BUFFER ( )

Definition at line 662 of file lib_manager.cpp.

663 {
664  delete m_part;
665  delete m_original;
666 }

Member Function Documentation

◆ GetOriginal()

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

Definition at line 311 of file lib_manager.h.

311 { return m_original; }

References m_original.

◆ GetPart()

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

Definition at line 308 of file lib_manager.h.

308 { return m_part; }

References m_part.

◆ GetScreen()

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

Definition at line 315 of file lib_manager.h.

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

References m_screen.

◆ IsModified()

bool LIB_MANAGER::PART_BUFFER::IsModified ( ) const

Definition at line 701 of file lib_manager.cpp.

702 {
703  return m_screen && m_screen->IsModify();
704 }
std::unique_ptr< SCH_SCREEN > m_screen
Definition: lib_manager.h:334

◆ RemoveScreen()

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

Transfer the screen ownership

Definition at line 318 of file lib_manager.h.

319  {
320  return std::move( m_screen );
321  }
std::unique_ptr< SCH_SCREEN > m_screen
Definition: lib_manager.h:334

References m_screen.

◆ SetOriginal()

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

Definition at line 685 of file lib_manager.cpp.

686 {
687  wxCHECK( m_original != aPart, /* void */ );
688  wxASSERT( aPart );
689  delete m_original;
690  m_original = aPart;
691 
692  // The original is not allowed to have a different library than its part
694  {
697  }
698 }
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
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
void SetLibId(const LIB_ID &aLibId)

References LIB_PART::SetLibId().

◆ SetPart()

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

Definition at line 669 of file lib_manager.cpp.

670 {
671  wxCHECK( m_part != aPart, /* void */ );
672  wxASSERT( aPart );
673  delete m_part;
674  m_part = aPart;
675 
676  // If the part moves libraries then the original moves with it
678  {
681  }
682 }
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
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
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 323 of file lib_manager.h.

324  {
325  bool ret = !!m_screen;
326  m_screen = std::move( aScreen );
327  return ret;
328  }
std::unique_ptr< SCH_SCREEN > m_screen
Definition: lib_manager.h:334

References m_screen.

Member Data Documentation

◆ m_original

LIB_PART* LIB_MANAGER::PART_BUFFER::m_original
private

Definition at line 337 of file lib_manager.h.

Referenced by GetOriginal(), and PART_BUFFER().

◆ m_part

LIB_PART* LIB_MANAGER::PART_BUFFER::m_part
private

Definition at line 336 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 334 of file lib_manager.h.

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


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