KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Jon Evans <[email protected]>
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 <vector>
27#include <wx/arrstr.h>
28
29
31{
32public:
33 BUS_ALIAS() = default;
34
36 { }
37
38 std::shared_ptr<BUS_ALIAS> Clone() const
39 {
40 return std::make_shared<BUS_ALIAS>( *this );
41 }
42
43 wxString GetName() const { return m_name; }
44
45 void SetName( const wxString& aName ) { m_name = aName.Strip( wxString::both ); }
46
47 const std::vector<wxString>& Members() const { return m_members; }
48
49 void SetMembers( const std::vector<wxString>& aMembers )
50 {
51 m_members.clear();
52
53 for( const wxString& member : aMembers )
54 {
55 wxString trimmed = member.Strip( wxString::both );
56
57 if( !trimmed.IsEmpty() )
58 m_members.push_back( trimmed );
59 }
60 }
61
62 void AddMember( const wxString& aMember )
63 {
64 wxString trimmed = aMember.Strip( wxString::both );
65
66 if( !trimmed.IsEmpty() )
67 m_members.push_back( trimmed );
68 }
69
70 void ClearMembers() { m_members.clear(); }
71
72protected:
73 wxString m_name;
74 std::vector<wxString> m_members;
75};
76
77#endif
void SetName(const wxString &aName)
Definition bus_alias.h:45
void SetMembers(const std::vector< wxString > &aMembers)
Definition bus_alias.h:49
std::shared_ptr< BUS_ALIAS > Clone() const
Definition bus_alias.h:38
void ClearMembers()
Definition bus_alias.h:70
wxString m_name
Definition bus_alias.h:73
std::vector< wxString > m_members
Definition bus_alias.h:74
wxString GetName() const
Definition bus_alias.h:43
BUS_ALIAS()=default
const std::vector< wxString > & Members() const
Definition bus_alias.h:47
void AddMember(const wxString &aMember)
Definition bus_alias.h:62