KiCad PCB EDA Suite
Loading...
Searching...
No Matches
match_properties.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
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef MATCH_PROPERTIES_H
21#define MATCH_PROPERTIES_H
22
23#include <set>
24#include <vector>
25
26#include <wx/string.h>
27
28class EDA_ITEM;
29
30
32{
33 explicit operator bool() const { return m_Error.IsEmpty(); }
34
35 int m_Changed = 0;
36 wxString m_Error;
37};
38
39
41{
42
43wxString Family( const EDA_ITEM& aItem );
44wxString DisplayLabel( const wxString& aKey );
45
47wxString FamilyLabel( const wxString& aFamily );
48
50wxString PropertyLabel( const wxString& aKey );
51
53std::set<wxString> FamiliesFor( const wxString& aKey );
54
56bool PropertyIsRegistered( const wxString& aFamily, const wxString& aName );
57bool Compatible( const EDA_ITEM& aSource, const EDA_ITEM& aTarget );
58std::vector<EDA_ITEM*> CompatibleTargets( const EDA_ITEM& aSource, const std::vector<EDA_ITEM*>& aCandidates );
59
61bool AnyEnabledFor( const EDA_ITEM& aItem, const std::set<wxString>& aEnabledKeys );
62
69const std::set<wxString>& AllSafeKeys();
70
72const std::set<wxString>& DefaultKeys();
73
74MATCH_PROPERTIES_RESULT Copy( const EDA_ITEM& aSource, EDA_ITEM& aTarget,
75 const std::set<wxString>& aEnabledKeys );
76
77}
78
79#endif
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
MATCH_PROPERTIES_RESULT Copy(const EDA_ITEM &aSource, EDA_ITEM &aTarget, const std::set< wxString > &aEnabledKeys)
bool Compatible(const EDA_ITEM &aSource, const EDA_ITEM &aTarget)
const std::set< wxString > & AllSafeKeys()
Every property Match Properties may copy, keyed as "family/Property Name".
bool PropertyIsRegistered(const wxString &aFamily, const wxString &aName)
Whether aFamily registers a property of that name. Used to prune the common table.
wxString PropertyLabel(const wxString &aKey)
The translated property name alone, without the family it belongs to.
const std::set< wxString > & DefaultKeys()
The subset enabled until the user says otherwise.
bool AnyEnabledFor(const EDA_ITEM &aItem, const std::set< wxString > &aEnabledKeys)
True if any enabled key names a property of this item's family.
std::vector< EDA_ITEM * > CompatibleTargets(const EDA_ITEM &aSource, const std::vector< EDA_ITEM * > &aCandidates)
wxString FamilyLabel(const wxString &aFamily)
The translated name of a family, for the heading of its group.
std::set< wxString > FamiliesFor(const wxString &aKey)
The families a key reaches. One for a family key, several for a common one.
wxString Family(const EDA_ITEM &aItem)
wxString DisplayLabel(const wxString &aKey)