KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_merge_applier.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
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU 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, you may find one here:
18 * http://www.gnu.org/licenses/gpl-3.0.html
19 */
20
21#ifndef PCB_MERGE_APPLIER_H
22#define PCB_MERGE_APPLIER_H
23
26
27#include <wx/string.h>
28
29#include <memory>
30
31
32class BOARD;
33class BOARD_ITEM;
34
35
36namespace KICAD_DIFF
37{
38
68{
69public:
70 PCB_MERGE_APPLIER( const BOARD* aAncestor, const BOARD* aOurs, const BOARD* aTheirs,
71 MERGE_PLAN aPlan );
72
77 std::unique_ptr<BOARD> Apply();
78
82 struct REPORT
83 {
84 std::size_t itemsTakenOurs = 0;
85 std::size_t itemsTakenTheirs = 0;
86 std::size_t itemsMergedProps = 0;
87 std::size_t itemsDeleted = 0;
88 std::size_t itemsKept = 0;
89 std::size_t propertiesApplied = 0;
90 std::size_t propertiesFailed = 0;
91
92 bool requiresZoneRefill = false;
94
99 bool projectFileTouched = false;
101 bool netClassesTouched = false;
102
111
117 bool customDrcRulesSet = false;
118
122 wxString fpLibTable;
123 bool fpLibTableSet = false;
124
127 wxString symLibTable;
128 bool symLibTableSet = false;
129
135
143 };
144
145 const REPORT& GetReport() const { return m_report; }
146
147private:
151 const BOARD_ITEM* findItem( const BOARD* aBoard, const KIID& aId ) const;
152
155 BOARD_ITEM* cloneInto( BOARD* aTarget, const BOARD_ITEM* aSource ) const;
156
159 std::size_t applyPropertyResolutions( BOARD_ITEM* aTarget,
160 const std::vector<PROPERTY_RESOLUTION>& aProps,
161 const BOARD_ITEM* aOurs,
162 const BOARD_ITEM* aTheirs,
163 const BOARD_ITEM* aAncestor );
164
165private:
167 const BOARD* m_ours;
171};
172
173} // namespace KICAD_DIFF
174
175#endif // PCB_MERGE_APPLIER_H
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:80
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:320
BOARD_ITEM * cloneInto(BOARD *aTarget, const BOARD_ITEM *aSource) const
Clone a board item using its virtual Clone(); returns nullptr if the source is null,...
std::unique_ptr< BOARD > Apply()
Produce the merged board.
PCB_MERGE_APPLIER(const BOARD *aAncestor, const BOARD *aOurs, const BOARD *aTheirs, MERGE_PLAN aPlan)
const REPORT & GetReport() const
std::size_t applyPropertyResolutions(BOARD_ITEM *aTarget, const std::vector< PROPERTY_RESOLUTION > &aProps, const BOARD_ITEM *aOurs, const BOARD_ITEM *aTheirs, const BOARD_ITEM *aAncestor)
Apply property-level resolutions to a clone of aOurs (or aTheirs per PROP_RES).
const BOARD_ITEM * findItem(const BOARD *aBoard, const KIID &aId) const
Locate an item (top-level or footprint child) by UUID on one of the source boards.
Definition kiid.h:44
Result of planning a 3-way merge.
Report on the application after Apply() runs.
bool connectivityRebuildPerformed
True iff the caller invoked connectivity recomputation after the applier produced the merged document...
wxString fpLibTable
fp-lib-table content the applier resolved.
VALIDATION_REPORT validation
Post-apply validator pipeline result (refdes uniqueness, connectivity-rebuild-ack,...
bool projectFileTouched
True iff the applier resolved state that lives in the .kicad_pro or a project sibling file.
wxString customDrcRules
Custom DRC rules (.kicad_dru) content the applier resolved.
wxString symLibTable
sym-lib-table content the applier resolved.
wxString drawingSheetFile
Drawing sheet path the applier resolved (from a doc-level resolution).