KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drc_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_DRC_EXCLUSION_H
22#define KICAD_DRC_EXCLUSION_H
23
24#include <memory>
25#include <nlohmann/json_fwd.hpp>
26
27class PCB_MARKER;
28
29namespace kiapi::board
30{
31class DrcExclusion;
32}
33
34
41{
42public:
44 DRC_EXCLUSION( const DRC_EXCLUSION& aOther );
45 DRC_EXCLUSION& operator=( const DRC_EXCLUSION& aOther );
47
48 static DRC_EXCLUSION FromMarker( const PCB_MARKER& aMarker );
49 static DRC_EXCLUSION FromProto( const kiapi::board::DrcExclusion& aMessage );
50 static DRC_EXCLUSION FromLegacyStrings( const wxString& aMarkerData, const wxString& aComment );
51
52 const kiapi::board::DrcExclusion& ToProto() const;
53 std::string GetSortKey() const;
54
55 wxString GetComment() const;
56 void SetComment( const wxString& aComment );
57
58 friend bool operator==( const DRC_EXCLUSION& a, const DRC_EXCLUSION& b )
59 {
60 return a.GetSortKey() == b.GetSortKey();
61 }
62
63 friend bool operator!=( const DRC_EXCLUSION& a, const DRC_EXCLUSION& b )
64 {
65 return !( a == b );
66 }
67
68private:
69 struct IMPL;
70 std::unique_ptr<IMPL> m_impl;
71
72 friend void to_json( nlohmann::json& aJson, const DRC_EXCLUSION& aEx );
73 friend void from_json( const nlohmann::json& aJson, DRC_EXCLUSION& aEx );
74};
75
76void to_json( nlohmann::json& aJson, const DRC_EXCLUSION& aEx );
77void from_json( const nlohmann::json& aJson, DRC_EXCLUSION& aEx );
78
80{
81 bool operator()( const DRC_EXCLUSION& a, const DRC_EXCLUSION& b ) const
82 {
83 return a.GetSortKey() < b.GetSortKey();
84 }
85};
86
87#endif //KICAD_DRC_EXCLUSION_H
Container for an DRC exclusion, which is a PCB_MARKER plus an optional comment.
DRC_EXCLUSION & operator=(const DRC_EXCLUSION &aOther)
static DRC_EXCLUSION FromLegacyStrings(const wxString &aMarkerData, const wxString &aComment)
void SetComment(const wxString &aComment)
friend bool operator!=(const DRC_EXCLUSION &a, const DRC_EXCLUSION &b)
std::string GetSortKey() const
static DRC_EXCLUSION FromProto(const kiapi::board::DrcExclusion &aMessage)
std::unique_ptr< IMPL > m_impl
friend void to_json(nlohmann::json &aJson, const DRC_EXCLUSION &aEx)
wxString GetComment() const
friend void from_json(const nlohmann::json &aJson, DRC_EXCLUSION &aEx)
static DRC_EXCLUSION FromMarker(const PCB_MARKER &aMarker)
const kiapi::board::DrcExclusion & ToProto() const
friend bool operator==(const DRC_EXCLUSION &a, const DRC_EXCLUSION &b)
void to_json(nlohmann::json &aJson, const DRC_EXCLUSION &aEx)
void from_json(const nlohmann::json &aJson, DRC_EXCLUSION &aEx)
bool operator()(const DRC_EXCLUSION &a, const DRC_EXCLUSION &b) const