KiCad PCB EDA Suite
SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER Class Reference

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

#include <symbol_library_manager.h>

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 262 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 828 of file symbol_library_manager.cpp.

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

References m_original, and move.

◆ ~SYMBOL_BUFFER()

SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::~SYMBOL_BUFFER ( )

Definition at line 837 of file symbol_library_manager.cpp.

838{
839 delete m_symbol;
840 delete m_original;
841}

Member Function Documentation

◆ GetOriginal()

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

Definition at line 272 of file symbol_library_manager.h.

272{ return m_original; }

References m_original.

◆ GetScreen()

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

Transfer the screen ownership.

Definition at line 276 of file symbol_library_manager.h.

References m_screen.

◆ GetSymbol()

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

Definition at line 269 of file symbol_library_manager.h.

269{ return m_symbol; }

References m_symbol.

◆ IsModified()

bool SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::IsModified ( ) const

Definition at line 876 of file symbol_library_manager.cpp.

877{
878 return m_screen && m_screen->IsContentModified();
879}

◆ RemoveScreen()

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

Definition at line 279 of file symbol_library_manager.h.

280 {
281 return std::move( m_screen );
282 }

References m_screen.

◆ SetOriginal()

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

Definition at line 860 of file symbol_library_manager.cpp.

861{
862 wxCHECK( m_original != aSymbol, /* void */ );
863 wxASSERT( aSymbol );
864 delete m_original;
865 m_original = aSymbol;
866
867 // The original is not allowed to have a different library than its symbol
869 {
872 }
873}
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
const UTF8 & GetLibItemName() const
Definition: lib_id.h:101
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:87
LIB_ID GetLibId() const override
Definition: lib_symbol.h:139
void SetLibId(const LIB_ID &aLibId)
Definition: lib_symbol.h:140

References LIB_SYMBOL::SetLibId().

◆ SetScreen()

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

Definition at line 284 of file symbol_library_manager.h.

285 {
286 bool ret = !!m_screen;
287 m_screen = std::move( aScreen );
288 return ret;
289 }

References m_screen.

◆ SetSymbol()

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

Definition at line 844 of file symbol_library_manager.cpp.

845{
846 wxCHECK( m_symbol != aSymbol, /* void */ );
847 wxASSERT( aSymbol );
848 delete m_symbol;
849 m_symbol = aSymbol;
850
851 // If the symbol moves libraries then the original moves with it
853 {
856 }
857}

References LIB_SYMBOL::SetLibId().

Member Data Documentation

◆ m_original

LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::m_original
private

Definition at line 295 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 292 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 294 of file symbol_library_manager.h.

Referenced by GetSymbol().


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