KiCad PCB EDA Suite
Loading...
Searching...
No Matches
erc_exclusion.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 * @author Jon Evans <[email protected]>
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef KICAD_ERC_EXCLUSION_H
22#define KICAD_ERC_EXCLUSION_H
23
24#include <memory>
25#include <nlohmann/json_fwd.hpp>
26#include <wx/string.h>
27
28class SCH_MARKER;
29class SCH_SHEET_LIST;
30
32{
33class ErcExclusion;
34}
35
36
43{
44public:
46 ERC_EXCLUSION( const ERC_EXCLUSION& aOther );
47 ERC_EXCLUSION& operator=( const ERC_EXCLUSION& aOther );
49
50 static ERC_EXCLUSION FromMarker( const SCH_MARKER& aMarker );
51 static ERC_EXCLUSION FromProto( const kiapi::schematic::ErcExclusion& aMessage );
52 static ERC_EXCLUSION FromLegacyStrings( const SCH_SHEET_LIST& aSheetList, const wxString& aMarkerData,
53 const wxString& aComment );
54
55 const kiapi::schematic::ErcExclusion& ToProto() const;
56 std::string GetSortKey() const;
57
58 wxString GetComment() const;
59 void SetComment( const wxString& aComment );
60
61 friend bool operator==( const ERC_EXCLUSION& a, const ERC_EXCLUSION& b )
62 {
63 return a.GetSortKey() == b.GetSortKey();
64 }
65
66 friend bool operator!=( const ERC_EXCLUSION& a, const ERC_EXCLUSION& b )
67 {
68 return !( a == b );
69 }
70
71private:
72 struct IMPL;
73 std::unique_ptr<IMPL> m_impl;
74
75 friend void to_json( nlohmann::json& aJson, const ERC_EXCLUSION& aEx );
76 friend void from_json( const nlohmann::json& aJson, ERC_EXCLUSION& aEx );
77};
78
79void to_json( nlohmann::json& aJson, const ERC_EXCLUSION& aEx );
80void from_json( const nlohmann::json& aJson, ERC_EXCLUSION& aEx );
81
83{
84 bool operator()( const ERC_EXCLUSION& a, const ERC_EXCLUSION& b ) const
85 {
86 return a.GetSortKey() < b.GetSortKey();
87 }
88};
89
90#endif //KICAD_ERC_EXCLUSION_H
Container for an ERC exclusion, which is a SCH_MARKER plus an optional comment.
static ERC_EXCLUSION FromLegacyStrings(const SCH_SHEET_LIST &aSheetList, const wxString &aMarkerData, const wxString &aComment)
ERC_EXCLUSION & operator=(const ERC_EXCLUSION &aOther)
friend void from_json(const nlohmann::json &aJson, ERC_EXCLUSION &aEx)
std::unique_ptr< IMPL > m_impl
const kiapi::schematic::ErcExclusion & ToProto() const
void SetComment(const wxString &aComment)
static ERC_EXCLUSION FromMarker(const SCH_MARKER &aMarker)
wxString GetComment() const
friend void to_json(nlohmann::json &aJson, const ERC_EXCLUSION &aEx)
friend bool operator!=(const ERC_EXCLUSION &a, const ERC_EXCLUSION &b)
std::string GetSortKey() const
static ERC_EXCLUSION FromProto(const kiapi::schematic::ErcExclusion &aMessage)
friend bool operator==(const ERC_EXCLUSION &a, const ERC_EXCLUSION &b)
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void from_json(const nlohmann::json &aJson, ERC_EXCLUSION &aEx)
void to_json(nlohmann::json &aJson, const ERC_EXCLUSION &aEx)
bool operator()(const ERC_EXCLUSION &a, const ERC_EXCLUSION &b) const