KiCad PCB EDA Suite
SYMBOL_LIBRARY_MANAGER::PART_BUFFER Class Reference

Store a working copy of a library. 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
 Transfer the screen ownership. More...
 
std::unique_ptr< SCH_SCREENRemoveScreen ()
 
bool SetScreen (std::unique_ptr< SCH_SCREEN > aScreen)
 

Private Attributes

std::unique_ptr< SCH_SCREENm_screen
 
LIB_PARTm_part
 
LIB_PARTm_original
 

Detailed Description

Store a working copy of a library.

Definition at line 321 of file symbol_library_manager.h.

Member Typedef Documentation

◆ PTR

Definition at line 349 of file symbol_library_manager.h.

◆ WEAK_PTR

Definition at line 350 of file symbol_library_manager.h.

Constructor & Destructor Documentation

◆ PART_BUFFER()

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

Definition at line 816 of file symbol_library_manager.cpp.

817  :
818  m_screen( std::move( aScreen ) ),
819  m_part( aPart )
820 {
821  m_original = new LIB_PART( *aPart );
822 }
std::unique_ptr< SCH_SCREEN > m_screen
Define a library symbol object.
Definition: lib_symbol.h:93

References m_original.

◆ ~PART_BUFFER()

SYMBOL_LIBRARY_MANAGER::PART_BUFFER::~PART_BUFFER ( )

Definition at line 825 of file symbol_library_manager.cpp.

826 {
827  delete m_part;
828  delete m_original;
829 }

Member Function Documentation

◆ GetOriginal()

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

Definition at line 330 of file symbol_library_manager.h.

References m_original.

◆ GetPart()

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

Definition at line 327 of file symbol_library_manager.h.

References m_part.

◆ GetScreen()

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

Transfer the screen ownership.

Definition at line 334 of file symbol_library_manager.h.

References m_screen.

◆ IsModified()

bool SYMBOL_LIBRARY_MANAGER::PART_BUFFER::IsModified ( ) const

Definition at line 864 of file symbol_library_manager.cpp.

865 {
866  return m_screen && m_screen->IsModify();
867 }
std::unique_ptr< SCH_SCREEN > m_screen

◆ RemoveScreen()

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

Definition at line 337 of file symbol_library_manager.h.

338  {
339  return std::move( m_screen );
340  }
std::unique_ptr< SCH_SCREEN > m_screen

References m_screen.

◆ SetOriginal()

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

Definition at line 848 of file symbol_library_manager.cpp.

849 {
850  wxCHECK( m_original != aPart, /* void */ );
851  wxASSERT( aPart );
852  delete m_original;
853  m_original = aPart;
854 
855  // The original is not allowed to have a different library than its part
857  {
860  }
861 }
const UTF8 & GetLibItemName() const
Definition: lib_id.h:106
LIB_ID GetLibId() const override
Definition: lib_symbol.h:131
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:92
void SetLibId(const LIB_ID &aLibId)
Definition: lib_symbol.h:132

References LIB_PART::SetLibId().

◆ SetPart()

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

Definition at line 832 of file symbol_library_manager.cpp.

833 {
834  wxCHECK( m_part != aPart, /* void */ );
835  wxASSERT( aPart );
836  delete m_part;
837  m_part = aPart;
838 
839  // If the part moves libraries then the original moves with it
841  {
844  }
845 }
const UTF8 & GetLibItemName() const
Definition: lib_id.h:106
LIB_ID GetLibId() const override
Definition: lib_symbol.h:131
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:92
void SetLibId(const LIB_ID &aLibId)
Definition: lib_symbol.h:132

References LIB_PART::SetLibId().

◆ SetScreen()

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

Definition at line 342 of file symbol_library_manager.h.

343  {
344  bool ret = !!m_screen;
345  m_screen = std::move( aScreen );
346  return ret;
347  }
std::unique_ptr< SCH_SCREEN > m_screen

References m_screen.

Member Data Documentation

◆ m_original

LIB_PART* SYMBOL_LIBRARY_MANAGER::PART_BUFFER::m_original
private

Definition at line 356 of file symbol_library_manager.h.

Referenced by GetOriginal(), and PART_BUFFER().

◆ m_part

LIB_PART* SYMBOL_LIBRARY_MANAGER::PART_BUFFER::m_part
private

Definition at line 355 of file symbol_library_manager.h.

Referenced by GetPart().

◆ m_screen

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

Definition at line 353 of file symbol_library_manager.h.

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


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