KiCad PCB EDA Suite
Loading...
Searching...
No Matches
symbol.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2024 KiCad Developers, see change_log.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef SYMBOL_H
25#define SYMBOL_H
26
27#include <lib_id.h>
28#include <sch_item.h>
29
33class SYMBOL : public SCH_ITEM
34{
35public:
36 SYMBOL( KICAD_T idType ) :
37 SYMBOL( nullptr, idType )
38 { }
39
40 SYMBOL( EDA_ITEM* aParent, KICAD_T idType ) :
41 SCH_ITEM( aParent, idType ),
42 m_pinNameOffset( 0 ),
43 m_showPinNames( true ),
44 m_showPinNumbers( true ),
45 m_excludedFromSim( false ),
46 m_excludedFromBOM( false ),
47 m_excludedFromBoard( false ),
48 m_DNP( false )
49 { }
50
51 SYMBOL( const SYMBOL& base ) :
52 SCH_ITEM( base ),
59 m_DNP( base.m_DNP )
60 { }
61
62 SYMBOL& operator=( const SYMBOL& aItem )
63 {
64 SCH_ITEM::operator=( aItem );
65
69
73 m_DNP = aItem.m_DNP;
74
75 return *this;
76 };
77
78 ~SYMBOL() override { };
79
80 virtual const LIB_ID& GetLibId() const = 0;
81 virtual wxString GetDescription() const = 0;
82 virtual wxString GetKeyWords() const = 0;
83
84 virtual bool IsPower() const = 0;
85 virtual bool IsNormal() const = 0;
86
92 virtual bool HasAlternateBodyStyle() const = 0;
93
97 virtual bool IsMulti() const = 0;
98
102 virtual int GetUnitCount() const = 0;
103
104 virtual const wxString GetRef( const SCH_SHEET_PATH* aSheet,
105 bool aIncludeUnit = false ) const = 0;
106
107 virtual const wxString GetValue( bool aResolve, const SCH_SHEET_PATH* aPath,
108 bool aAllowExtraText ) const = 0;
109
117 void SetPinNameOffset( int aOffset ) { m_pinNameOffset = aOffset; }
118 int GetPinNameOffset() const { return m_pinNameOffset; }
119
123 virtual void SetShowPinNames( bool aShow ) { m_showPinNames = aShow; }
124 virtual bool GetShowPinNames() const { return m_showPinNames; }
125
129 virtual void SetShowPinNumbers( bool aShow ) { m_showPinNumbers = aShow; }
130 virtual bool GetShowPinNumbers() const { return m_showPinNumbers; }
131
135 void SetExcludedFromSim( bool aExcludeFromSim ) override { m_excludedFromSim = aExcludeFromSim; }
136 bool GetExcludedFromSim() const override { return m_excludedFromSim; }
137
141 void SetExcludedFromBOM( bool aExcludeFromBOM ) { m_excludedFromBOM = aExcludeFromBOM; }
142 bool GetExcludedFromBOM() const { return m_excludedFromBOM; }
143
147 void SetExcludedFromBoard( bool aExcludeFromBoard ) { m_excludedFromBoard = aExcludeFromBoard; }
149
153 bool GetDNP() const { return m_DNP; }
154 void SetDNP( bool aDNP ) { m_DNP = aDNP; }
155
156 void ViewGetLayers( int aLayers[], int& aCount ) const override;
157
158protected:
163
167 bool m_DNP;
168};
169
170#endif // SYMBOL_H
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:89
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:166
SCH_ITEM & operator=(const SCH_ITEM &aPin)
Definition: sch_item.cpp:101
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
A base class for LIB_SYMBOL and SCH_SYMBOL.
Definition: symbol.h:34
SYMBOL(EDA_ITEM *aParent, KICAD_T idType)
Definition: symbol.h:40
bool m_DNP
True if symbol is set to 'Do Not Populate'.
Definition: symbol.h:167
void SetDNP(bool aDNP)
Definition: symbol.h:154
~SYMBOL() override
Definition: symbol.h:78
virtual bool IsMulti() const =0
bool m_showPinNumbers
Definition: symbol.h:162
bool GetExcludedFromBoard() const
Definition: symbol.h:148
virtual int GetUnitCount() const =0
virtual const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const =0
SYMBOL(KICAD_T idType)
Definition: symbol.h:36
bool m_excludedFromSim
Definition: symbol.h:164
virtual bool IsPower() const =0
virtual void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
Definition: symbol.h:129
bool GetExcludedFromBOM() const
Definition: symbol.h:142
bool m_showPinNames
Definition: symbol.h:161
void SetExcludedFromSim(bool aExcludeFromSim) override
Set or clear the exclude from simulation flag.
Definition: symbol.h:135
int GetPinNameOffset() const
Definition: symbol.h:118
virtual void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
Definition: symbol.h:123
bool m_excludedFromBOM
Definition: symbol.h:165
virtual bool IsNormal() const =0
virtual wxString GetDescription() const =0
SYMBOL(const SYMBOL &base)
Definition: symbol.h:51
virtual const wxString GetValue(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const =0
bool GetDNP() const
Set or clear the 'Do Not Populate' flaga.
Definition: symbol.h:153
bool m_excludedFromBoard
Definition: symbol.h:166
virtual bool GetShowPinNames() const
Definition: symbol.h:124
void SetExcludedFromBOM(bool aExcludeFromBOM)
Set or clear the exclude from schematic bill of materials flag.
Definition: symbol.h:141
void SetPinNameOffset(int aOffset)
Set the offset in mils of the pin name text from the pin symbol.
Definition: symbol.h:117
virtual wxString GetKeyWords() const =0
SYMBOL & operator=(const SYMBOL &aItem)
Definition: symbol.h:62
void SetExcludedFromBoard(bool aExcludeFromBoard)
Set or clear exclude from board netlist flag.
Definition: symbol.h:147
virtual bool GetShowPinNumbers() const
Definition: symbol.h:130
virtual const LIB_ID & GetLibId() const =0
virtual bool HasAlternateBodyStyle() const =0
Test if symbol has more than one body conversion type (DeMorgan).
int m_pinNameOffset
The offset in mils to draw the pin name.
Definition: symbol.h:159
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: symbol.cpp:27
bool GetExcludedFromSim() const override
Definition: symbol.h:136
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78