KiCad PCB EDA Suite
SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER Class Reference

Store a working copy of a library. More...

Public Member Functions

 SYMBOL_BUFFER (LIB_SYMBOL *aSymbol=nullptr, std::unique_ptr< SCH_SCREEN > aScreen=nullptr)
 
 ~SYMBOL_BUFFER ()
 
LIB_SYMBOLGetSymbol () const
 
void SetSymbol (LIB_SYMBOL *aSymbol)
 
LIB_SYMBOLGetOriginal () const
 
void SetOriginal (LIB_SYMBOL *aSymbol)
 
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_SYMBOLm_symbol
 
LIB_SYMBOLm_original
 

Detailed Description

Store a working copy of a library.

Definition at line 274 of file symbol_library_manager.h.

Constructor & Destructor Documentation

◆ SYMBOL_BUFFER()

SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::SYMBOL_BUFFER ( LIB_SYMBOL aSymbol = nullptr,
std::unique_ptr< SCH_SCREEN aScreen = nullptr 
)

Definition at line 825 of file symbol_library_manager.cpp.

826  :
827  m_screen( std::move( aScreen ) ),
828  m_symbol( aSymbol )
829 {
830  m_original = new LIB_SYMBOL( *aSymbol );
831 }
Define a library symbol object.
Definition: lib_symbol.h:96
std::unique_ptr< SCH_SCREEN > m_screen

References m_original, and move.

◆ ~SYMBOL_BUFFER()

SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::~SYMBOL_BUFFER ( )

Definition at line 834 of file symbol_library_manager.cpp.

835 {
836  delete m_symbol;
837  delete m_original;
838 }

Member Function Documentation

◆ GetOriginal()

LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::GetOriginal ( ) const
inline

Definition at line 284 of file symbol_library_manager.h.

References m_original.

◆ GetScreen()

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

Transfer the screen ownership.

Definition at line 288 of file symbol_library_manager.h.

References m_screen.

◆ GetSymbol()

LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::GetSymbol ( ) const
inline

Definition at line 281 of file symbol_library_manager.h.

References m_symbol.

◆ IsModified()

bool SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::IsModified ( ) const

Definition at line 873 of file symbol_library_manager.cpp.

874 {
875  return m_screen && m_screen->IsContentModified();
876 }
std::unique_ptr< SCH_SCREEN > m_screen

◆ RemoveScreen()

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

Definition at line 291 of file symbol_library_manager.h.

292  {
293  return std::move( m_screen );
294  }
std::unique_ptr< SCH_SCREEN > m_screen

References m_screen.

◆ SetOriginal()

void SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::SetOriginal ( LIB_SYMBOL aSymbol)

Definition at line 857 of file symbol_library_manager.cpp.

858 {
859  wxCHECK( m_original != aSymbol, /* void */ );
860  wxASSERT( aSymbol );
861  delete m_original;
862  m_original = aSymbol;
863 
864  // The original is not allowed to have a different library than its symbol
866  {
869  }
870 }
const UTF8 & GetLibItemName() const
Definition: lib_id.h:104
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
LIB_ID GetLibId() const override
Definition: lib_symbol.h:135
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:90
void SetLibId(const LIB_ID &aLibId)
Definition: lib_symbol.h:136

References LIB_SYMBOL::SetLibId().

◆ SetScreen()

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

Definition at line 296 of file symbol_library_manager.h.

297  {
298  bool ret = !!m_screen;
299  m_screen = std::move( aScreen );
300  return ret;
301  }
std::unique_ptr< SCH_SCREEN > m_screen

References m_screen.

◆ SetSymbol()

void SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::SetSymbol ( LIB_SYMBOL aSymbol)

Definition at line 841 of file symbol_library_manager.cpp.

842 {
843  wxCHECK( m_symbol != aSymbol, /* void */ );
844  wxASSERT( aSymbol );
845  delete m_symbol;
846  m_symbol = aSymbol;
847 
848  // If the symbol moves libraries then the original moves with it
850  {
853  }
854 }
const UTF8 & GetLibItemName() const
Definition: lib_id.h:104
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
LIB_ID GetLibId() const override
Definition: lib_symbol.h:135
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:90
void SetLibId(const LIB_ID &aLibId)
Definition: lib_symbol.h:136

References LIB_SYMBOL::SetLibId().

Member Data Documentation

◆ m_original

LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::m_original
private

Definition at line 307 of file symbol_library_manager.h.

Referenced by GetOriginal(), and SYMBOL_BUFFER().

◆ m_screen

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

Definition at line 304 of file symbol_library_manager.h.

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

◆ m_symbol

LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::m_symbol
private

Definition at line 306 of file symbol_library_manager.h.

Referenced by GetSymbol().


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