KiCad PCB EDA Suite
Loading...
Searching...
No Matches
project_file_patch.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_PROJECT_FILE_PATCH_H
25#define KICAD_DIFF_PROJECT_FILE_PATCH_H
26
27#include <kicommon.h>
29
30#include <nlohmann/json_fwd.hpp>
31#include <wx/string.h>
32
33#include <optional>
34#include <set>
35#include <string>
36
37
38namespace KICAD_DIFF
39{
40
56KICOMMON_API std::optional<std::string> DocPropJsonPointer( const wxString& aDocProp,
57 DOC_KIND aKind );
58
59KICOMMON_API std::optional<std::string> DocPropJsonPointer( const wxString& aDocProp );
60
61
73KICOMMON_API bool ApplyProjectFilePatch( nlohmann::json& aTarget,
74 const nlohmann::json& aSource,
75 const wxString& aDocProp,
76 DOC_KIND aKind );
77
78KICOMMON_API bool ApplyProjectFilePatch( nlohmann::json& aTarget,
79 const nlohmann::json& aSource,
80 const wxString& aDocProp );
81
82
98KICOMMON_API bool ApplyProjectFilePatches( const wxString& aOutputProPath,
99 const nlohmann::json& aSource,
100 const std::set<wxString>& aDocProps,
101 DOC_KIND aKind );
102
103KICOMMON_API bool ApplyProjectFilePatches( const wxString& aOutputProPath,
104 const nlohmann::json& aSource,
105 const std::set<wxString>& aDocProps );
106
107} // namespace KICAD_DIFF
108
109#endif // KICAD_DIFF_PROJECT_FILE_PATCH_H
#define KICOMMON_API
Definition kicommon.h:27
bool ApplyProjectFilePatch(nlohmann::json &aTarget, const nlohmann::json &aSource, const wxString &aDocProp, DOC_KIND aKind)
Copy the JSON sub-tree located at the pointer for aDocProp from aSource into aTarget.
DOC_KIND
Document type a diff/merge entry point should route to, derived from a file path's extension.
std::optional< std::string > DocPropJsonPointer(const wxString &aDocProp, DOC_KIND aKind)
Return the JSON pointer (RFC 6901, slash-separated) under which aDocProp is persisted in a ....
bool ApplyProjectFilePatches(const wxString &aOutputProPath, const nlohmann::json &aSource, const std::set< wxString > &aDocProps, DOC_KIND aKind)
Higher-level orchestrator: load the existing aOutputProPath as JSON (or start from aSource if the fil...