KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcad_nets.cpp
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) 2007, 2008 Lubo Racko <
[email protected]
>
5
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <
[email protected]
>
6
* Copyright The KiCad Developers, see AUTHORS.TXT for contributors.
7
*
8
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public License
10
* as published by the Free Software Foundation; either version 2
11
* of the License, or (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, you may find one here:
20
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21
* or you may search the http://www.gnu.org website for the version 2 license,
22
* or you may write to the Free Software Foundation, Inc.,
23
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24
*/
25
26
#include <
pcad/pcad_nets.h
>
27
28
#include <
xnode.h
>
29
30
#include <wx/string.h>
31
32
namespace
PCAD2KICAD
{
33
34
PCAD_NET_NODE::PCAD_NET_NODE
()
35
{
36
m_CompRef
= wxEmptyString;
37
m_PinRef
= wxEmptyString;
38
}
39
40
41
PCAD_NET_NODE::~PCAD_NET_NODE
()
42
{
43
}
44
45
46
PCAD_NET::PCAD_NET
(
int
aNetCode ) :
m_NetCode
( aNetCode )
47
{
48
m_Name
= wxEmptyString;
49
}
50
51
52
PCAD_NET::~PCAD_NET
()
53
{
54
int
i;
55
56
for
( i = 0; i < (int)
m_NetNodes
.GetCount(); i++ )
57
{
58
delete
m_NetNodes
[i];
59
}
60
}
61
62
63
void
PCAD_NET::Parse
(
XNODE
* aNode )
64
{
65
wxString propValue, s1, s2;
66
PCAD_NET_NODE
* netNode;
67
XNODE
* lNode;
68
69
aNode->GetAttribute( wxT(
"Name"
), &propValue );
70
propValue.Trim(
false
);
71
propValue.Trim(
true
);
72
m_Name
= propValue;
73
74
lNode =
FindNode
( aNode, wxT(
"node"
) );
75
76
while
( lNode )
77
{
78
lNode->GetAttribute( wxT(
"Name"
), &s2 );
79
s2.Trim(
false
);
80
s1 = wxEmptyString;
81
82
while
( s2.Len() > 0 && s2[0] != wxT(
' '
) )
83
{
84
s1 = s1 + s2[0];
85
s2 = s2.Mid( 1 );
86
}
87
88
netNode =
new
PCAD_NET_NODE
;
89
s1.Trim(
false
);
90
s1.Trim(
true
);
91
netNode->
m_CompRef
= s1;
92
93
s2.Trim(
false
);
94
s2.Trim(
true
);
95
netNode->
m_PinRef
= s2;
96
m_NetNodes
.Add( netNode );
97
lNode = lNode->
GetNext
();
98
}
99
}
100
101
}
// namespace PCAD2KICAD
PCAD2KICAD::PCAD_NET_NODE
Definition
pcad_nets.h:39
PCAD2KICAD::PCAD_NET_NODE::m_CompRef
wxString m_CompRef
Definition
pcad_nets.h:45
PCAD2KICAD::PCAD_NET_NODE::~PCAD_NET_NODE
~PCAD_NET_NODE()
Definition
pcad_nets.cpp:41
PCAD2KICAD::PCAD_NET_NODE::PCAD_NET_NODE
PCAD_NET_NODE()
Definition
pcad_nets.cpp:34
PCAD2KICAD::PCAD_NET_NODE::m_PinRef
wxString m_PinRef
Definition
pcad_nets.h:46
PCAD2KICAD::PCAD_NET::m_NetNodes
PCAD_NET_NODES_ARRAY m_NetNodes
Definition
pcad_nets.h:60
PCAD2KICAD::PCAD_NET::m_Name
wxString m_Name
Definition
pcad_nets.h:58
PCAD2KICAD::PCAD_NET::m_NetCode
int m_NetCode
Definition
pcad_nets.h:59
PCAD2KICAD::PCAD_NET::Parse
void Parse(XNODE *aNode)
Definition
pcad_nets.cpp:63
PCAD2KICAD::PCAD_NET::PCAD_NET
PCAD_NET(int aNetCode)
Definition
pcad_nets.cpp:46
PCAD2KICAD::PCAD_NET::~PCAD_NET
~PCAD_NET()
Definition
pcad_nets.cpp:52
XNODE
Hold an XML or S-expression element.
Definition
xnode.h:43
XNODE::GetNext
XNODE * GetNext() const
Definition
xnode.h:66
PCAD2KICAD
Definition
pcad2kicad_common.cpp:39
PCAD2KICAD::FindNode
XNODE * FindNode(XNODE *aChild, const wxString &aTag)
Definition
pcad2kicad_common.cpp:558
pcad_nets.h
xnode.h
src
pcbnew
pcb_io
pcad
pcad_nets.cpp
Generated on Sun Sep 21 2025 01:05:30 for KiCad PCB EDA Suite by
1.13.2