KiCad PCB EDA Suite
Loading...
Searching...
No Matches
jumper_group.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <kicommon.h>
23
24#include <optional>
25#include <set>
26#include <vector>
27
28#include <wx/string.h>
29
30
39{
40public:
46 static std::optional<JUMPER_GROUP> Make( std::set<wxString> aNames );
47
48 bool Contains( const wxString& aName ) const;
49 const std::set<wxString>& GetNames() const { return m_names; }
50
51 bool operator==( const JUMPER_GROUP& aOther ) const = default;
52
53private:
54 explicit JUMPER_GROUP( std::set<wxString> aNames );
55
56 // This should never be empty
57 std::set<wxString> m_names;
58};
59
60
68{
69public:
73 void Add( JUMPER_GROUP aGroup );
74
79 void Add( std::set<wxString> aNames );
80
81 void Clear() { m_groups.clear(); }
82
83 const std::vector<JUMPER_GROUP>& GetAll() const { return m_groups; }
84 bool IsEmpty() const { return m_groups.empty(); }
85
89 const JUMPER_GROUP* FindContaining( const wxString& aName ) const;
90
91 bool operator==( const JUMPER_GROUP_SET& aOther ) const = default;
92
93private:
94 std::vector<JUMPER_GROUP> m_groups;
95};
Represents an (ordered) list of JUMPER_GROUP objects.
void Add(JUMPER_GROUP aGroup)
Add a JUMPER_GROUP to the set.
std::vector< JUMPER_GROUP > m_groups
const std::vector< JUMPER_GROUP > & GetAll() const
bool operator==(const JUMPER_GROUP_SET &aOther) const =default
bool IsEmpty() const
Represents a group of jumper pins or pads, keyed by name.
static std::optional< JUMPER_GROUP > Make(std::set< wxString > aNames)
Factory method to create a JUMPER_GROUP from a set of names.
bool operator==(const JUMPER_GROUP &aOther) const =default
std::set< wxString > m_names
const std::set< wxString > & GetNames() const
JUMPER_GROUP(std::set< wxString > aNames)
bool Contains(const wxString &aName) const
#define KICOMMON_API
Definition kicommon.h:27