KiCad PCB EDA Suite
gbr_netlist_metadata.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) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef GBR_NETLIST_METADATA_H
26 #define GBR_NETLIST_METADATA_H
27 
28 
42 {
43 public:
44  // This enum enables the different net attributes attache to the object
45  // the values can be ORed for items which can have more than one attribute
46  // (A flashed pad has all allowed attributes)
48  {
53  };
54 
55  // these members are used in the %TO object attributes command.
57  bool m_NotInNet;
59  wxString m_Padname;
62  wxString m_Cmpref;
63  wxString m_Netname;
64 
65  GBR_NETLIST_METADATA(): m_NetAttribType( GBR_NETINFO_UNSPECIFIED ), m_NotInNet( false )
66  {
67  }
68 
74  void ClearAttribute( const wxString* aName )
75  {
76  if( m_NetAttribType == GBR_NETINFO_UNSPECIFIED )
77  {
78  m_Padname.clear();
79  m_Cmpref.clear();
80  m_Netname.clear();
81  return;
82  }
83 
84  if( !aName || aName->IsEmpty() || *aName == ".CN" )
85  {
86  m_NetAttribType = GBR_NETINFO_UNSPECIFIED;
87  m_Padname.clear();
88  m_Cmpref.clear();
89  m_Netname.clear();
90  return;
91  }
92 
93  if( *aName == ".C" )
94  {
95  m_NetAttribType &= ~GBR_NETINFO_CMP;
96  m_Cmpref.clear();
97  return;
98  }
99 
100  if( *aName == ".N" )
101  {
102  m_NetAttribType &= ~GBR_NETINFO_NET;
103  m_Netname.clear();
104  return;
105  }
106 
107  if( *aName == ".P" )
108  {
109  m_NetAttribType &= ~GBR_NETINFO_PAD;
110  m_Padname.clear();
111  return;
112  }
113  }
114 };
115 
116 // Flashed pads use the full attribute set: this is a helper for flashed pads
117 #define GBR_NETINFO_ALL (GBR_NETLIST_METADATA::GBR_NETINFO_PAD\
118  | GBR_NETLIST_METADATA::GBR_NETINFO_NET\
119  | GBR_NETLIST_METADATA::GBR_NETINFO_CMP )
120 
121 #endif // GBR_NETLIST_METADATA_H
print info associated to a component (TO.C attribute)
wxString m_Cmpref
the component reference parent of the data
this class handle info which can be added in a gerber file as attribute of an obtect the GBR_INFO_TYP...
wxString m_Padname
for a flashed pad: the pad name ((TO.P attribute)
wxString m_Netname
for items associated to a net: the netname
print info associated to a flashed pad (TO.P attribute)
void ClearAttribute(const wxString *aName)
remove the net attribute specified by aName If aName == NULL or empty, remove all attributes ...
bool m_NotInNet
true if a pad of a footprint cannot be connected (for instance a mechanical NPTH, ot a not named pad)...
print info associated to a net (TO.N attribute)
int m_NetAttribType
the type of net info (used to define the gerber string to create)