KiCad PCB EDA Suite
Loading...
Searching...
No Matches
cvpcb_association.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) 2019 Ian McInerney <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef CVPCB_ASSOCIATION_H
22#define CVPCB_ASSOCIATION_H
23
24#include <lib_id.h>
25#include <core/utf8.h>
26
31{
32public:
41 CVPCB_ASSOCIATION( unsigned int aComponentIndex, const LIB_ID& aNewFootprint,
42 const LIB_ID& aOldFootprint = LIB_ID() ) :
43 m_componentIndex( aComponentIndex ),
44 m_newFootprint( aNewFootprint ),
45 m_oldFootprint( aOldFootprint )
46 {}
47
48 CVPCB_ASSOCIATION( unsigned int aComponentIndex, const wxString& aNewFootprint,
49 const wxString& aOldFootprint = "" ) :
50 m_componentIndex( aComponentIndex )
51 {
52 m_newFootprint.Parse( aNewFootprint );
53 m_oldFootprint.Parse( aOldFootprint );
54 }
55
62 {
64 }
65
71 unsigned int GetComponentIndex() const
72 {
73 return m_componentIndex;
74 }
75
82 {
83 return m_newFootprint;
84 }
85
92 {
93 return m_oldFootprint;
94 }
95
101 void SetNewFootprint( const LIB_ID& aNewFootprint )
102 {
103 m_newFootprint = aNewFootprint;
104 }
105
111 void SetOldFootprint( const LIB_ID& aOldFootprint )
112 {
113 m_oldFootprint = aOldFootprint;
114 }
115
116private:
117 unsigned int m_componentIndex;
120};
121
122
123#endif
A class to define a footprint association to be made in cvpcb.
unsigned int GetComponentIndex() const
Get the index of the component to modify the association of.
void SetOldFootprint(const LIB_ID &aOldFootprint)
Set the footprint that was associated with the component before this association event.
unsigned int m_componentIndex
CVPCB_ASSOCIATION(unsigned int aComponentIndex, const LIB_ID &aNewFootprint, const LIB_ID &aOldFootprint=LIB_ID())
Create an association event that contains all the information needed to modify the footprint associat...
void SetNewFootprint(const LIB_ID &aNewFootprint)
Set the footprint that should be associated with the component.
LIB_ID GetOldFootprint() const
Get the old footprint of the component.
CVPCB_ASSOCIATION Reverse() const
Reverse the association.
LIB_ID GetNewFootprint() const
Get the new footprint to associate to the component.
CVPCB_ASSOCIATION(unsigned int aComponentIndex, const wxString &aNewFootprint, const wxString &aOldFootprint="")
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:52