KiCad PCB EDA Suite
Loading...
Searching...
No Matches
auto_resolution.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 * or you may search the http://www.gnu.org website for the version 3 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef KICAD_DIFF_AUTO_RESOLUTION_H
25#define KICAD_DIFF_AUTO_RESOLUTION_H
26
27#include <kicommon.h>
28
30
31#include <wx/string.h>
32
33#include <map>
34#include <string>
35#include <vector>
36
37
38namespace KICAD_DIFF
39{
40
61
62
74
75
88ParseAutoResolutionJson( const std::string& aJsonContent );
89
90
111
112
123
124
138 const std::vector<std::size_t>& aConflictActionIndices,
139 const std::map<wxString, ITEM_RES>& aResolutions );
140
141
157
158
159KICOMMON_API std::vector<CONFLICT_LIST_ENTRY> BuildConflictList( const MERGE_PLAN& aPlan );
160
161
169KICOMMON_API std::vector<KIID_PATH>
171 const std::vector<std::size_t>& aConflictActionIndices );
172
173
199KICOMMON_API std::optional<BOX2I>
201 const std::map<KIID_PATH, BOX2I>& aPrimary,
202 const std::map<KIID_PATH, BOX2I>& aOurs,
203 const std::map<KIID_PATH, BOX2I>& aTheirs,
204 const std::map<KIID_PATH, BOX2I>& aAncestor );
205
206
219KICOMMON_API wxString
220BuildConflictDetailText( const ITEM_RESOLUTION& aResolution );
221
222} // namespace KICAD_DIFF
223
224#endif // KICAD_DIFF_AUTO_RESOLUTION_H
#define KICOMMON_API
Definition kicommon.h:27
wxString BuildConflictDetailText(const ITEM_RESOLUTION &aResolution)
Build the human-readable detail text shown in the merge dialog's resolution panel for a given ITEM_RE...
AUTO_RESOLUTION_PARSE_RESULT ParseAutoResolutionJson(const std::string &aJsonContent)
Parse a KICAD_MERGETOOL_AUTO-format JSON object mapping item IDs (KIID_PATH strings) to ITEM_RES spel...
AUTO_RESOLUTION_STATUS
Outcome of parsing a KICAD_MERGETOOL_AUTO JSON document.
@ BAD_VALUE
at least one entry's value wasn't a string
@ NOT_OBJECT
JSON parsed but the root was not an object.
@ INVALID_JSON
input could not be parsed as JSON
@ UNKNOWN_KIND
at least one entry's string wasn't a known ITEM_RES
@ OK
parsed cleanly; resolutions is populated
@ ENGINE_INTERNAL_KIND
at least one entry asked for an engine-internal kind (KEEP / DELETE / MERGE_PROPS); only the TAKE_* f...
std::vector< CONFLICT_LIST_ENTRY > BuildConflictList(const MERGE_PLAN &aPlan)
std::optional< BOX2I > ResolveConflictBBox(const KIID_PATH &aId, const std::map< KIID_PATH, BOX2I > &aPrimary, const std::map< KIID_PATH, BOX2I > &aOurs, const std::map< KIID_PATH, BOX2I > &aTheirs, const std::map< KIID_PATH, BOX2I > &aAncestor)
Resolve the best bounding box for a conflicted item across the three sides of a 3-way merge.
APPLY_AUTO_RESOLUTIONS_STATUS
Outcome of applying an auto-resolution map to a MERGE_PLAN.
APPLY_AUTO_RESOLUTIONS_RESULT ApplyAutoResolutions(MERGE_PLAN &aPlan, const std::vector< std::size_t > &aConflictActionIndices, const std::map< wxString, ITEM_RES > &aResolutions)
Apply a parsed auto-resolution map to a MERGE_PLAN's conflicts.
std::vector< KIID_PATH > CollectUnresolvedConflicts(const MERGE_PLAN &aPlan, const std::vector< std::size_t > &aConflictActionIndices)
Return the subset of conflict actions whose kind is NOT one of the concrete TAKE_OURS / TAKE_THEIRS /...
APPLY_AUTO_RESOLUTIONS_STATUS status
KIID_PATH firstMissingId
Set only when status == PARTIAL AND the partial result was caused by a missing entry in the auto-reso...
Result of ParseAutoResolutionJson.
std::map< wxString, ITEM_RES > resolutions
Build the list of conflict-action indices the dialog walks (i.e.
std::size_t actionIndex
KIID_PATH id
wxString label
Result of planning a 3-way merge.