KiCad PCB EDA Suite
bus_alias.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) 2018 CERN
5  * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
6  * @author Jon Evans <jon@craftyjon.com>
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 along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef _BUS_ALIAS_H
23 #define _BUS_ALIAS_H
24 
25 #include <memory>
26 #include <wx/string.h>
27 #include <wx/arrstr.h>
28 
29 
30 class SCH_SCREEN;
31 
32 
33 class BUS_ALIAS
34 {
35 public:
36  BUS_ALIAS( SCH_SCREEN* aParent = nullptr );
37 
38  ~BUS_ALIAS();
39 
40  std::shared_ptr< BUS_ALIAS > Clone() const
41  {
42  return std::make_shared< BUS_ALIAS >( *this );
43  }
44 
45  wxString GetName()
46  {
47  return m_name;
48  }
49 
50  void SetName( const wxString& aName )
51  {
52  m_name = aName;
53  }
54 
55  void ClearMembers()
56  {
57  m_members.clear();
58  }
59 
60  void AddMember( const wxString& aName )
61  {
62  m_members.push_back( aName );
63  }
64 
66  {
67  return m_members.size();
68  }
69 
70  wxArrayString& Members()
71  {
72  return m_members;
73  }
74 
75  bool Contains( const wxString& aName );
76 
78  {
79  return m_parent;
80  }
81 
82  void SetParent( SCH_SCREEN* aParent )
83  {
84  m_parent = aParent;
85  }
86 
87 protected:
88 
89  wxString m_name;
90 
91  wxArrayString m_members;
92 
99 };
100 
101 #endif
void ClearMembers()
Definition: bus_alias.h:55
int GetMemberCount()
Definition: bus_alias.h:65
wxString m_name
Definition: bus_alias.h:89
wxArrayString & Members()
Definition: bus_alias.h:70
std::shared_ptr< BUS_ALIAS > Clone() const
Definition: bus_alias.h:40
SCH_SCREEN * m_parent
The bus alias editor dialog can edit aliases from all open sheets.
Definition: bus_alias.h:98
void SetName(const wxString &aName)
Definition: bus_alias.h:50
wxArrayString m_members
Definition: bus_alias.h:91
void SetParent(SCH_SCREEN *aParent)
Definition: bus_alias.h:82
SCH_SCREEN * GetParent()
Definition: bus_alias.h:77
BUS_ALIAS(SCH_SCREEN *aParent=nullptr)
Definition: bus_alias.cpp:25
void AddMember(const wxString &aName)
Definition: bus_alias.h:60
wxString GetName()
Definition: bus_alias.h:45
bool Contains(const wxString &aName)
Definition: bus_alias.cpp:36