KiCad PCB EDA Suite
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 <Ian.S.McInerney@ieee.org>
5  * Copyright (C) 2019 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 <utf8.h>
26 
31 {
32 
33 public:
34 
44  unsigned int aComponentIndex, LIB_ID aNewFootprint, LIB_ID aOldFootprint = LIB_ID() ) :
45  m_componentIndex( aComponentIndex ),
46  m_newFootprint( aNewFootprint ),
47  m_oldFootprint( aOldFootprint )
48  {}
49 
51  unsigned int aComponentIndex, wxString aNewFootprint, wxString aOldFootprint = "" ) :
52  m_componentIndex( aComponentIndex )
53  {
54  m_newFootprint.Parse( aNewFootprint, LIB_ID::ID_PCB );
55  m_oldFootprint.Parse( aOldFootprint, LIB_ID::ID_PCB );
56  }
57 
64  {
66  }
67 
73  unsigned int GetComponentIndex() const
74  {
75  return m_componentIndex;
76  }
77 
84  {
85  return m_newFootprint;
86  }
87 
94  {
95  return m_oldFootprint;
96  }
97 
103  void SetNewFootprint( const LIB_ID& aNewFootprint )
104  {
105  m_newFootprint = aNewFootprint;
106  }
107 
113  void SetOldFootprint( const LIB_ID& aOldFootprint )
114  {
115  m_oldFootprint = aOldFootprint;
116  }
117 
118 
119 private:
120  unsigned int m_componentIndex;
123 
124 };
125 
126 
127 #endif
CVPCB_ASSOCIATION(unsigned int aComponentIndex, wxString aNewFootprint, wxString aOldFootprint="")
LIB_ID GetNewFootprint() const
Get the new footprint to associate to the component.
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
unsigned int GetComponentIndex() const
Get the index of the component to modify the association of.
void SetNewFootprint(const LIB_ID &aNewFootprint)
Set the footprint that should be associated with the component.
unsigned int m_componentIndex
CVPCB_ASSOCIATION Reverse() const
Reverse the association.
void SetOldFootprint(const LIB_ID &aOldFootprint)
Set the footprint that was associated with the component before this association event.
LIB_ID GetOldFootprint() const
Get the old footprint of the component.
A class to define a footprint association to be made in cvpcb.
CVPCB_ASSOCIATION(unsigned int aComponentIndex, LIB_ID aNewFootprint, LIB_ID aOldFootprint=LIB_ID())
Create an association event that contains all the information needed to modify the footprint associat...
int Parse(const UTF8 &aId, LIB_ID_TYPE aType, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:122