KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_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 SCH_MERGE_APPLIER_H
22#define SCH_MERGE_APPLIER_H
23
26
27#include <map>
28#include <memory>
29#include <vector>
30
31
32class SCHEMATIC;
33class SCH_ITEM;
34class SCH_SHEET_PATH;
35
36
37namespace KICAD_DIFF
38{
39
57{
58public:
59 SCH_MERGE_APPLIER( SCHEMATIC* aAncestor, const SCHEMATIC* aOurs,
60 const SCHEMATIC* aTheirs, MERGE_PLAN aPlan );
61
65 bool Apply();
66
67 struct REPORT
68 {
69 std::size_t itemsTakenOurs = 0;
70 std::size_t itemsTakenTheirs = 0;
71 std::size_t itemsMergedProps = 0;
72 std::size_t itemsDeleted = 0;
73 std::size_t itemsKept = 0;
74 std::size_t propertiesApplied = 0;
75 std::size_t propertiesFailed = 0;
76
81 std::size_t sheetActionsSkipped = 0;
82
84
88 bool projectFileTouched = false;
91
95
100 };
101
102 const REPORT& GetReport() const { return m_report; }
103
104private:
110
112 std::map<KIID_PATH, PathedItem>
113 indexSchematic( const SCHEMATIC* aSchematic,
114 std::vector<std::unique_ptr<SCH_SHEET_PATH>>& aStorage ) const;
115
116 std::size_t applyPropertyResolutions( SCH_ITEM* aTarget,
117 const std::vector<PROPERTY_RESOLUTION>& aProps,
118 const SCH_ITEM* aOurs,
119 const SCH_ITEM* aTheirs,
120 const SCH_ITEM* aAncestor );
121
122private:
128};
129
130} // namespace KICAD_DIFF
131
132#endif // SCH_MERGE_APPLIER_H
bool Apply()
Apply the plan to the ancestor.
SCH_MERGE_APPLIER(SCHEMATIC *aAncestor, const SCHEMATIC *aOurs, const SCHEMATIC *aTheirs, MERGE_PLAN aPlan)
std::map< KIID_PATH, PathedItem > indexSchematic(const SCHEMATIC *aSchematic, std::vector< std::unique_ptr< SCH_SHEET_PATH > > &aStorage) const
Walk a schematic into a KIID_PATH-keyed table of (item, sheet_path).
std::size_t applyPropertyResolutions(SCH_ITEM *aTarget, const std::vector< PROPERTY_RESOLUTION > &aProps, const SCH_ITEM *aOurs, const SCH_ITEM *aTheirs, const SCH_ITEM *aAncestor)
const REPORT & GetReport() const
Holds all the data relating to one schematic.
Definition schematic.h:90
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:162
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Result of planning a 3-way merge.
bool projectFileTouched
True iff the applier resolved state that lives in the .kicad_pro.
std::size_t sheetActionsSkipped
Number of actions skipped because they targeted a SCH_SHEET.
bool connectivityRebuildPerformed
True iff the caller performed connectivity recomputation after the applier finished.
VALIDATION_REPORT validation
Post-apply validator pipeline result.